shashwatak / satellite-js Goto Github PK
View Code? Open in Web Editor NEWModular set of functions for SGP4 and SDP4 propagation of TLEs.
License: MIT License
Modular set of functions for SGP4 and SDP4 propagation of TLEs.
License: MIT License
I'm trying to predict the position of a satellite with a Molniya orbit, Molniya 3-47:
1 23642U 95042A 18058.62866679 .00000210 00000-0 -75405-2 0 9996
2 23642 62.9606 257.1441 7218342 288.9618 10.0525 2.01983768165381
The prediction turns out to be completely incorrect. The minimal example below is taken from the readme almost line-by-line:
var tleLine1 = '1 23642U 95042A 18058.62866679 .00000210 00000-0 -75405-2 0 9996',
tleLine2 = '2 23642 62.9606 257.1441 7218342 288.9618 10.0525 2.01983768165381';
var satrec = twoline2satrec(tleLine1, tleLine2);
var positionAndVelocity = propagate(satrec, new Date());
var positionEci = positionAndVelocity.position;
var gmst = gstime(new Date());
var positionGd = eciToGeodetic(positionEci, gmst);
console.log('Molniya', positionGd.latitude * (180 / Math.PI), positionGd.longitude * (180 / Math.PI));
It gives me 39.8491516985329 -157.00043723551485
, while the correct coordinates are 38.64 72.56
. At other times it's even more off. Here's the plotting of the orbit on Google Maps:
In reality it's supposed to look like this (see n2yo):
Predictions for any other orbit (including highly elliptical orbits, like the Tundra orbit of QZSS satellites) seem to be correct.
After updating from version 1.3.0 to 2.0.2, now the sgp4 function is taking like 100 times the previous time to calculate the propagation. After profiling my code all points out that sgp4 is the problematic function. For now I will stay in 1.3.0, but I just want to point it out.
Is it normal or maybe just a bug?
Since vkmpersec is a constant, it should be solved in the code rather than recalculating it when iterating through the whole satellite catalog.
Is it possible to get this information directly from satellite.js?
Hi,
ecfToEci is available but not in index.d.ts.
This cause a fake typescript error .
Thansk,
Thanks for the library! I've been using it a while and it's really fun to play around with.
I've been experimenting with smoothly animating a satellite's position in realtime. It seems like the browser is more than capable of computing SGP4 several times per second, but despite that it appears that the lat/lon values only change once per second?
Just was wondering if this is some built in restraint in the SGP4 calculation?
Hi, Shashwat!
Many thanks for your efforts on bringing this library to JavaScript!
I forked this library and made many changes to meet the requirements fixed for projects in our organization. These changes also affect the naming convention, so probably you will not accept them due to reasons mentioned in your README.md
. Anyway, take a look at this, probably you will be interested in having a pull request from me.
First of all, source code is reorganized as Requirejs AMD modules and can be built with Grunt instead of Makefile
. This is more JavaScript way! As the result, the library has both minified and non-minified versions. It can be used by accessing global satellite
object as well as by requiring it as module in Require.js.
Build script also validates the code with JSHint. It helped me to make code cleaner, follow lower camel case naming convention and locate all unused variables. They are commented and marked by:
TODO: defined but never used
I also added the support of running tests written with Jasmine, and it doesn't depend on browser because Phantom.js is used. Unfortunatelly, I had no enough time to rewrite all your tests with Jasmine but it should be pretty easy. There is only one sgp4
test at the moment that checks calculations of satellite's position and velocity.
Another major requirement was to make the library installable with Bower package manager:
bower install satellitejs
Is there any built in method that will give me pass information, given a point on the Earth and a satellite object? Currently, I'm looping through from now until a week from now, 30 seconds at a time, checking the lookAngle elevation against a minimum angle.
I'm trying to upgrade from an older version of the library to a newer version, and I'm running into an issue where I'm getting strange latitude/longitude values. From what I can tell, I isolated the issue to satellite.eciToGeodetic.
Here's a reduced test case:
// Stubs for a reduced test
var gmst = 5.310370926944962;
var positionEci = {
x: 1370.4661987034153,
y: 2426.9993741505536,
z: -6434.977887390488
};
var positionGd = satellite.eciToGeodetic(positionEci, gmst);
// Actual result:
console.log({
lat: positionGd.latitude, // -1.1642744947642691
lng: positionGd.longitude, // -4.253614852559047
height: positionGd.height // 652.5452213255094
});
// Expected result:
// (from http://www.apsalin.com/convert-cartesian-to-geodetic.aspx)
console.log({
lat: positionGd.latitude, // -86.7625980501545
lng: positionGd.longitude, // 60.5476630371258
height: positionGd.height // -6350170.45890334
});
With my full code, when plotting the values produced by satellite.js I strangely see a miniaturized version of a ground track (ignore the line at the top):
Am I mixing up coordinate systems or something? I'm not sure if it's a bug in the library or if I'm going wrong somewhere.
Thanks!
Lines 334-348 call Math.abs up to 20 times per sgp4 call. If you are iterating the whole catalogue that is ~340,000 Math.abs calls.
It looks like some browsers perform substantially (10x faster) better with "tem5abs = tem5 < 0 ? -tem5 : tem5;" instead. I will try it tonight to see if I get noticeable results.
It's very hard to figure out the code path to get from a time and satellite config to this value: the section about satellite.degrees_lat
says you can get lat/lon from geodetic coordinates, but then gives examples with geodetic radians and no clue as to which part of the output of sgp4
, if any, is the input to this.
First of all, thanks a lot for this great library!
I have a question: I know how to calculate look angle and range. But I need help calculating heading (e.g. 320 degrees), velocity (3 km/s) and altitude (12000 km over ground). How can I achieve these?
Thanks!
Moving this check from line 421 to 386 would reduce unnecessary calculations if it is going to fail anyway.
Having trouble with these TLEs for some reason.
FLOCK 1B-28
1 40423U 98067FP 15219.24788283 .05567779 12028-4 14293-2 0 9997
2 40423 51.6133 170.3484 0007348 241.2767 118.7501 16.27910103 34192
MICROMAS
1 40457U 98067GA 15213.38588329 .08885032 12472-4 72013-3 0 9998
2 40457 51.6142 195.6182 0009646 310.7124 49.3640 16.38908268 33335
When I load them, I get Uncaught TypeError: Cannot read property 'x' of undefined
on line 713
Most TLEs do work though. I'm using the library to create groundtracks with D3.js
http://bl.ocks.org/syntagmatic/6c149c08fc9cde682635
http://bl.ocks.org/syntagmatic/raw/6c149c08fc9cde682635/noaa.html
http://bl.ocks.org/syntagmatic/raw/6c149c08fc9cde682635/cubesat.html
http://bl.ocks.org/syntagmatic/raw/6c149c08fc9cde682635/molniya.html
http://bl.ocks.org/syntagmatic/raw/6c149c08fc9cde682635/gps.html
http://bl.ocks.org/syntagmatic/raw/6c149c08fc9cde682635/intelsat.html
I may go digging into the source to find the error. Some of these examples can also stop working after running for a few minutes, especially Molniya.
Thanks for the awesome library. It took me just an hour or two to get something together, after spending a couple days looking into calculating ground tracks from scratch. I would love to submit some graphical, web-based examples for the library if you're interested.
The TypeScript definition for gstime
is defined as export function gstime(date: Date): GMSTime;
This is not correct, since gstime
can take a Date
, Julian date (number
), or any valid params for jday()
Hi there,
I was wondering if anyone could provide me with some newbie instructions, or set me in the right direction using this library with requirejs.
I'm using your example as a main.js and getting an 'amdefine' not defined, if I comment out that if statement, I"m getting a 'define not defined' reference error.
Any help you can offer would be greatly appreciated, I'm just starting out in my first dev job so like I said I'm very much a coming to terms with some understanding JS concepts.
I've been trying this a couple of ways, one using amdefine as per http://requirejs.org/docs/node.html and the other using the define syntax as described under 'Usage' on https://github.com/shashwatak/satellite-js
Any help greatly appreciated
thanks
Duncan
var requirejs = require('requirejs');
if (typeof define !== 'function') {
var define = require('amdefine')(module,require);
}
define(function(require) {
var dep = require('dependency');
//The value returned from the function is
// //used as the module export visible to Node.
return function () {};
});
requirejs.config({
//Pass the top-level main.js/index.js require
// //function to requirejs so that node modules
// //are loaded relative to the top-level JS file.
baseUrl: __dirname,
nodeRequire: require,
});
requirejs(['foo', 'bar'],
function (foo, bar) {
//foo and bar are loaded according to requirejs
//config, but if not found, then node's require
//is used to load the module.
});
module.exports = function () {};
// Sample TLE
var tleLine1 = '1 25544U 98067A 13149.87225694 .00009369 00000-0 16828-3 0 9031',
tleLine2 = '2 25544 051.6485 199.1576 0010128 012.7275 352.5669 15.50581403831869';
// Initialize a satellite record
define(['satellite.js/dist/satellite.min.js'], function(satellite) {
var satrec = satellite.twoline2satrec(tleLine1, tleLine2);
});
Example in README references:
dopplerFactor = satellite.dopplerFactor(observerCoordsEcf, positionEcf, velocityEcf);
But neither of observerCoordsEcf
or velocityEcf
appear to be available.
Any way to add a degrees to radians function in transforms.js?
Function can be:
function degreesToRadians(degrees) {
return degrees * _constants.deg2rad;
}
In the README, there is a section that says:
// Convert the RADIANS to DEGREES for pretty printing (appends "N", "S", "E", "W", etc).
var longitudeStr = satellite.degreesLong(longitude),
latitudeStr = satellite.degreesLat(latitude);
The code for degreesLong
and degreesLat
, however, only returns numerical values without any of "N", "S", "E", or "W" appended. I'm not sure if this is a documentation error or an implementation error.
If it's a documentation error, the TypeScript definitions should be changed so that degreesLat
and degreesLong
return number
instead of string
.
I am working on a project and I was wondering if satellite-js provided a function to tell me if a specific satellite is in eclipse or not.
Now that CelesTrak is a non-profit, we have been redirecting all traffic going to other CelesTrak domains (e.g., .com, .net, .space) to celestrak.org (not www.celestrak.org). If your software does not handle the standard HTTP 301 response (Moved Permanently), you should change any references to other CelesTrak domains (typically celestrak.com or www.celestrak.com) to celestrak.org. While using HTTPS is not required, it is highly recommended, to prevent potential future issues.
Also, please note that CelesTrak does not update any data more often than every 2 hours. Processes that check hundreds or thousands of times each day for a specific file or files use limited resources needed to support about a quarter million unique users we see on CelesTrak every day. For orbital data, the 18 SDS data is only updated ~3 times each day (and not all data gets updated each time). The same is true for CelesTrak's SupGP orbital data. Please consider limiting checks to 3-4 times a day to help us all out. Adding checks to limit repeated attempts on an unexpected result (e.g., the HTTP 301 response) can also help us make the most of our resources.
CelesTrak also now supports alternative formats to the TLE format, including CSV and JSON. These are not only easier and more efficient to parse than TLE data, but they also support larger NORAD catalog numbers (and 4-digit years). The current public catalog will run out of 5-digit catalog numbers at 70000 (not 100000), since 70000-99999 are used as 'working space' by 18 SDS. We have already used 3,113 catalog numbers (as of 2022 Jul 15) since going over 50000 on 2021 Dec 13 and increases in things like Starlink launches are likely to accelerate. If you would like more information on these formats, please see our article, "A New Way to Obtain GP Data (aka TLEs)" at https://celestrak.org/NORAD/documentation/gp-data-formats.php.
Our Best,
CelesTrak
nit, documented as observerGeodetic (and Ecf coords don't work as a parameter)
satellite-js/src/transforms.js
Line 171 in 226d8d5
Hi, I really like this library! I was able to track satellite's position using the example from readme. Now I would like to know how to predict future satellite passes for a given location, but I don't even know where to start. Is there an example or some tutorial you could point me to?
I followed what you have in your README.md where I made timeSinceTleEpochMinutes = increments of 300.
var tleLine1 = '1 25544U 98067A 13149.87225694 .00009369 00000-0 16828-3 0 9031',
tleLine2 = '2 25544 051.6485 199.1576 0010128 012.7275 352.5669 15.50581403831869';
var satrec = satellite.twoline2satrec(tleLine1, tleLine2);
var positionAndVelocity = satellite.sgp4(satrec, timeSinceTleEpochMinutes);
But when I print out the x, y, and z positions and velocity values, the values differ from what I get using the python library you said you copied your satellite-js library from. At first the differences are small but they become a problem as my 300 second increments get larger and larger
Am I missing a step?
I'm comparing the jday
output with http://aa.usno.navy.mil/data/docs/JulianDate.php for some unit test errors I'm seeing in code I'm migrating.
When compared to the algorithm from http://aa.usno.navy.mil/faq/docs/JD_Formula.php, all dates from March 1 1900 to now are correctly converted.
Starting with February 28 1900, all older dates are off by one day. The output from the formula, for example, is 2415077.5 for Feb 28 1900, while the output of jday
is 2415078.5.
I saw on the readme page that there is support for script tag, but I cant find the satellite.min.js anywhere, does anybody know where to find it or download it?
In my project, I need to get the position of celestial bodies in real time, for example Venus&Moon&Sun which is in the solar system and Big Dipper which is further away.
Can i use SDP4?
Any suggestions, thank you.
Hi, first I want to thank you for this great library.
I'm using it to display orbits of the ISS and it works great but I'm interested in one specific action: get the exactly the orbit of the ISS starting from a longitude of -180 degree to the longitude of 180 degree starting from an internal timestamp of the orbit.
What I'm doing right now is to get the ISS position at the initial timestamp, then I go back in time for x minutes until the ISS position goes from < 0 to > 0 and than I start from that point to get the full orbit.
It's not a very smart way to get the orbit but it works: the drawback is that an orbit can start e.g. at -178.23 or at -179.34.
Now I'm facing the need to have the orbit exactly starting at -180 degree: how can I calculate the exact timestamp for that?
Thanks
I realized that two functions jday() and invjday() skip computations for milliseconds.
In jdayInternal(), it is:
function jdayInternal(year, mon, day, hr, minute, sec, msec = 0) {
...
}
where msec = 0 as the input sets milliseconds to zero.
Also, in invjday(), it is:
export function invjday(jd, asArray) {
...
return new Date(Date.UTC(year, mon - 1, day, hr, minute, Math.floor(sec)));
}
where Math.floor(sec) as the output eliminates milliseconds.
It is easy to test by converting and reconverting:
var mytime = new Date();
console.log(mytime.getMilliseconds()); // it returns some milliseconds.
var newtime = satellite.invjday( satellite.jday(mytime) );
console.log(newtime.getMilliseconds()); // it returns zero!
These functions need revisions.
I'm trying to predict when a satellite will cross some coordinates, is there a way to know if it's visible from said coordinates?
Thanks,
Lachlan
Currently having issues getting back valid look angles. Maybe someone can review my code to see the hangup, but as it is right now I am getting azimuth reading of 2.xxxx* and switching around satellites I don't see anything over 5, or 6, degrees.
Example Output:
azimuth:2.738130998510715
elevation:0.869799331216238
rangeSat:37079.4326120618
Code example following the readme:
var satrec = sat2.twoline2satrec(thisSat.Line1, thisSat.Line2);
var positionAndVelocity = sat2.propagate(satrec, new Date());
var positionEci = positionAndVelocity.position,
velocityEci = positionAndVelocity.velocity;
var deg2rad = Math.PI / 180;
var observerGd = {
longitude: -92.000000 * deg2rad,
latitude: 31.000000 * deg2rad,
height: 0.302
};
var gmst = sat2.gstime(new Date());
var positionEcf = sat2.eciToEcf(positionEci, gmst),
lookAngles = sat2.ecfToLookAngles(observerGd, positionEcf)
console.log(lookAngles)
I'm comparing results with:
http://www.satellite-calculations.com/TLETracker/SatTracker.htm
And I can't seem to get matching results. Besides the TLE, the only two inputs from me are the time for satellite.propagate, and satellite.gmstime_from_date
I'm using this code
var iss = [
'1 25544U 98067A 14074.90256052 .00016379 00000-0 28535-3 0 8761',
'2 25544 51.6489 201.9469 0004294 307.0067 147.1768 15.50879666876859'];
var satrec = satellite.twoline2satrec(iss[0], iss[1]);
var now = new Date();
var pv = satellite.propagate( satrec,
now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),
now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()
);
//pv = satellite.propagate( satrec,
// now.getFullYear(), now.getMonth(), now.getDate(),
// now.getHours(), now.getMinutes(), now.getSeconds()
// );
var position_eci = pv.position;
var gmst = satellite.gstime_from_date (now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),
now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds());
var p_eci = satellite.eci_to_ecf( position_eci, gmst );
var p_gf = satellite.eci_to_geodetic( p_eci, gmst );
The TLE is
ISS (ZARYA)
1 25544U 98067A 14074.90256052 .00016379 00000-0 28535-3 0 8761
2 25544 51.6489 201.9469 0004294 307.0067 147.1768 15.50879666876859
I propose all contributors to follow some Git workflow similar to Gitflow workflow. It will allow to keep master
branch clean and use it for tagged releases only.
I already created a develop
branch but not sure whether it should be set as base branch in repository settings. At the moment, master
branch is a default (base) branch, and all pull requests proposed by other contributors are based to this branch by default. It doesn't fit the proposed workflow and each time contributor creates a pull request he/she should set a base branch of pull request to develop
manually to follow this workflow. Changing default branch from master
to develop
in repository settings can make develop
branch a default base branch for new pull requests but only @shashwatak is able to change this branch as repo's owner.
What do you think about this, guys?
Hey, I was trying to generate a list containing the lat/lon of the ISS in every second (preferably millisecond) of the day, I tried to do this and ended up crashing my browser, is there any efficient way to do so without crashing my browser?
function predPoints(tle1, tle2){
var dateTime = new Date();
var i;
for (i = 0; i < 86401; i++){
var satrec = satellite.twoline2satrec(tle1, tle2);
var positionAndVelocity = satellite.propagate(satrec, dateTime.setSeconds(dateTime.getSeconds() + i ));
var positionEci = positionAndVelocity.position;
var gmst = satellite.gstime( dateTime.setSeconds(dateTime.getSeconds() + i ));
var positionGd = satellite.eciToGeodetic(positionEci, gmst);
var longitude = positionGd.longitude,
latitude = positionGd.latitude;
var longitudeStr = satellite.degreesLong(longitude),
latitudeStr = satellite.degreesLat(latitude);
position = [longitudeStr, latitude]
console.log(position);
}
Hi,
I work with orbit propagation and I have been used Vallado MATLAB package for a long time. Currently, I am using satellite.js for a web-based project and I realized not all of the functions are converted from the original Vallado code. Since I personally needed the Sun position in my project, I converted the MATLAB function "sun.mat" from the Vallado package to Javascript "sun.js".
Since it is very short and simple, I would like to share it here. Maybe it becomes useful for some users.
sun.js.txt
(Remove .txt extension)
To use, just simply add sun.js after loading satellite.js in your page. This function gets JulianDate as input and returns Sun position/ascension/declination as the output.
Since the MATLAB syntax is very simple, it is easy to convert the whole Vallado package to JavaScript and satellite.js. I think adding this (and also other functions from the original package) to satellite.js makes it more practical for various projects.
Cheers
In v8 the following code crashes Chrome Renderer due to an infinite loop somewhere.
var longstr1 = '39084U 13008A 13176.79917516 -.00000822 00000-0 -17253-3 0 1895';
var longstr2 = '39084 098.2108 247.6600 0001542 113.0024 247.1454 14.57100224 19555';
var sat_rec = satellite.twoline2satrec(longstr1, longstr2);
var position_velocity = satellite.sgp4(sat_rec, +new Date());
I need to know if a satellite is illuminated by the sun and possibly be able to estimate its brightness. I read that I would need to calculate phase angle between the satellite, observer and the sun. Does anyone know how to do that?
The parameter gmst is left unspecified. It could be confusing since it implies a time unit, but the function itself seems to expect an angle.
Stack Overflow question regarding gmst:
http://physics.stackexchange.com/questions/98466/radians-to-rotate-earth-to-match-eci-lat-lon-with-ecef-lat-lon
There are 4 calls to check satrec.method. These could be replaced with an isSatrecMethodD boolean that is set at the beginning of the function to reduce string evaluation.
I've forked and converted this library to be Browserify-friendly, i.e. I removed RequireJS so now it uses node-like module.exports
and require
instead, and thus can be bundled with Browserify. If this is of interest to you, I can send a pull request.
I also plan to heavily refactor the library in the future, towards a more OO-style, although I'm guessing that this won't be of interest since it will not be backward-compatible at all.
In cesuim,the function that determines the position of an object is “let position = new Cesium.Cartesian3(x, y, z))”.
As it happens, there is such a function in satellite.js:
var positionAndVelocity = satellite.propagate(satrec, times[i]);
var positionEci = positionAndVelocity.position;
var satelliteX = positionEci.x*1000,
satelliteY = positionEci.y*1000,
satelliteZ = positionEci.z*1000;
Of course, each value needs to be multiplied by 1000, converting from kilometers to meters.
Enter this x, y, Z into the cesuim function “let position = new Cesium.Cartesian3(x, y, z))”,get the result is not correct!
Please point out the maze, thank you!
Just saw https://www.thehumanitystar.com/ and noticed that they're using satellite.js
, albeit an older version. Pretty cool!
Wonder if we should keep track of some cool places where it's being used?
I'm using satellite-js in a 3d view. It takes the currentTime and and a delta and creates a point in the future filling a VBO. When it works it works wonderfully.
If try to created new buffer per frame I'm getting very odd behavior
When the trails are short it looks like "popping" but its much clearer at this scale that it's very wrong. The only thing changing in these 2 screenshots is the Date used in propagate
. I'm using new Date(milliseconds)
. Is there something about that resolution that's cause floating point errors or do I need to clamp to some interval?
Thanks for your time.
Hi, I was using this TLE (downloaded from norad http://www.celestrak.com/NORAD/elements/stations.txt ) few in the last days but I can't get the the coordinates, I'm getting NaN as coordinates.
1 25544U 98067A 14329.23485703 -.00026060 00000-0 -42757-3 0 4574
2 25544 51.6461 21.1442 0006610 69.1751 39.9679 15.51409999916316
Is there something wrong with the tle?
I have seen all the comments on this issue and tried all but couldn't resolve my issue, so I am opening a new issue as it's urgent for me to get it resolved
Maybe there is some understanding issue because of which I am not able to generate correct results. Please help me regarding this.
I have compared the results with AGI STK Desktop application. AGI STK Help Page says
By default, STK utilizes the CSSI SGP4 routine, Version 2008-11-03.
Following is the full description of my usage:
TLE Data:
1 20959U 90103A 14044.72615235 .00000027 00000-0 00000+0 0 2724
2 20959 54.3261 214.0472 0115346 348.3774 11.3322 2.00583365170051
ECI Data generated from AGI STK software:
Time (UTCG) x (km) y (km) z (km)
28 Jul 2017 02:55:06.000 -6749.036399 -14064.485321 21282.805742
28 Jul 2017 02:55:07.000 -6745.397433 -14065.853241 21283.102965
28 Jul 2017 02:55:08.000 -6741.758320 -14067.220855 21283.399727
28 Jul 2017 02:55:09.000 -6738.119061 -14068.588164 21283.696028
28 Jul 2017 02:55:10.000 -6734.479656 -14069.955168 21283.991866
28 Jul 2017 02:55:11.000 -6730.840105 -14071.321867 21284.287243
28 Jul 2017 02:55:12.000 -6727.200408 -14072.688260 21284.582158
28 Jul 2017 02:55:13.000 -6723.560565 -14074.054349 21284.876612
28 Jul 2017 02:55:14.000 -6719.920576 -14075.420132 21285.170603
28 Jul 2017 02:55:15.000 -6716.280441 -14076.785610 21285.464134
My Code( using satellite.js):
updateEntityToCurrentSimTime: function (time) {
var date = new Date( "07/28/2017 08:25:05");
var tleLines = ["1 20959U 90103A 14044.72615235 .00000027 00000-0 00000+0 0 2724",
"2 20959 54.3261 214.0472 0115346 348.3774 11.3322 2.00583365170051"];
var satrec = satellite.twoline2satrec(tleLines[0], tleLines[1]);
//update current date
date.setSeconds(date.getSeconds() + time);
var gmst = satellite.gstimeFromDate(date);
var posAndVelECI = satellite.propagate(satrec, date);
}
ECI data from my code:
28 Jul 2017 02:55:06 GMT -6729.586681293093 -14090.192704493444 21271.96936623743
28 Jul 2017 02:55:07 GMT -6725.942904316204 -14091.546319840401 21272.272757457347
28 Jul 2017 02:55:08 GMT -6722.298834777501 -14092.899684035754 21272.57569941536
28 Jul 2017 02:55:09 GMT -6718.654766124882 -14094.252688097995 21272.87816771835
28 Jul 2017 02:55:10 GMT -6715.010551711341 -14095.605386498912 21273.18017456913
28 Jul 2017 02:55:11 GMT -6711.366191662034 -14096.9577791936 21273.481719959364
28 Jul 2017 02:55:12 GMT -6707.721686056604 -14098.309866154083 21273.782803884547
28 Jul 2017 02:55:13 GMT -6704.077034974806 -14099.661647352345 21274.083426340152
28 Jul 2017 02:55:14 GMT -6700.432238496194 -14101.013122760447 21274.383587321685
28 Jul 2017 02:55:15 GMT -6696.787150063399 -14102.364346701132 21274.683298872136
I don’t know how to create a simple satellite trajectory.
Can we get its trajectory by some formula instead of listing it?
if the drag term has a leading zero(s), the code converts it to an integer (parseInt), but then back in to a string later when it gives it to parseFloat. This causes the leading zero to be dropped and it erroneously calculates the drag term.
I'm guessing that the nddot parameter suffers from the same issue.
I think that we should drop Bower support (probably, after version 1.4.0 release of satellite.js
) as it seems deprecated:
$ npm install -g bower
npm WARN deprecated [email protected]: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
/home/ezze/.nvm/versions/node/v6.11.0/bin/bower -> /home/ezze/.nvm/versions/node/v6.11.0/lib/node_modules/bower/bin/bower
/home/ezze/.nvm/versions/node/v6.11.0/lib
└── [email protected]
The same depreaction warning is placed on Bower home page and Bower Github repo (there is also an issue).
If anybody still uses Bower package of satellite.js
consider switching to Yarn or NPM.
Another reason to drop Bower support is the following: anytime we change the source code of the library we should rebuild everything in dist
directory including minified file which introduces a big diff even if a change was small. Dropping Bower we can exclude built files in dist
from the repo.
I don't want to claim this package as mine on npmjs.com, but you should publish it there ("npm publish") so folks can use satellite.js directly from npm.
Thanks!
Hello,
I'm making a fun sat sim for a museum project, with satellite-js generating positions for all the satellites. You can see a work-in-progress rendering at:
https://vimeo.com/117338834
Awesome so far, however the video is missing some "dots" due to error-less errors. At the moment, 901 out of the 15116-ish available TLEs (space-track.org) are not producing errors, but are producing NaN values when getting the position and velocity.
Here's a script with sample TLE to reproduce the issue:
//includes (if using node.js)
var fs = require('fs');
eval(fs.readFileSync('satellite.js')+'');
//end includes
//resulting in 0/no error, but also NaN position_and_velocity values
var tle_line_1 = '1 40206U 12008R 15023.55601235 -.00000295 00000-0 -21454-2 0 493';
var tle_line_2 = '2 40206 018.2524 027.2161 7231113 143.1101 300.2726 02.17805022 13667';
//works for reference:
//var tle_line_1 = '1 25544U 98067A 13149.87225694 .00009369 00000-0 16828-3 0 9031';
//var tle_line_2 = '2 25544 051.6485 199.1576 0010128 012.7275 352.5669 15.50581403831869';
var satrec = satellite.twoline2satrec (tle_line_1, tle_line_2);
var now = new Date();
var position_and_velocity = satellite.propagate (satrec,
now.getUTCFullYear(),
now.getUTCMonth() + 1,
now.getUTCDate(),
now.getUTCHours(),
now.getUTCMinutes(),
now.getUTCSeconds());
console.log('error?: ' + satrec.error);
console.log(position_and_velocity);
Results:
error?: 0
{ position: { x: NaN, y: NaN, z: NaN },
velocity: { x: NaN, y: NaN, z: NaN } }
Checking the same in Python, I'm getting different results:
from sgp4.earth_gravity import wgs72
from sgp4.io import twoline2rv
l1 = "1 40206U 12008R 15023.55601235 -.00000295 00000-0 -21454-2 0 493"
l2 = "2 40206 018.2524 027.2161 7231113 143.1101 300.2726 02.17805022 13667"
satellite = twoline2rv(l1, l2, wgs72)
position, velocity = satellite.propagate(2014, 1, 2, 7, 5, 52)
print(position)
print(velocity)
print(satellite.error)
Results:
[-29081.687479920645, -23277.652884337618, 10048.18022009547]
[0.22139732150168656, -2.094087251764308, 0.6054312911186175]
0
Any thoughts on what I might be doing wrong or if this is an issue that can be looked into? Does the TLE format look alright?
Thanks for taking a look in advance! :D
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.