question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Generate Valid TLE from sgp4init

See original GitHub issue

I was trying to use sgp4 to construct tles from orbital parameters using latest version (2.12)

I am getting invalid tles back, however. This seems to be because export_tle expects epochyr and epochdays to be set, but they don’t seem to be set by sgp4init.

Maybe this is user error, but I couldn’t quite figure it out.

Here’s the test I constructed (using the sgp4init example from the documentation):

from sgp4.api import WGS72, Satrec
from sgp4.exporter import export_tle

satrec = Satrec()

satrec.sgp4init(
    WGS72,           # gravity model
    'i',             # 'a' = old AFSPC mode, 'i' = improved mode
    5,               # satnum: Satellite number
    18441.785,       # epoch: days since 1949 December 31 00:00 UT
    2.8098e-05,      # bstar: drag coefficient (/earth radii)
    6.969196665e-13, # ndot: ballistic coefficient (revs/day)
    0.0,             # nddot: second derivative of mean motion (revs/day^3)
    0.1859667,       # ecco: eccentricity
    5.7904160274885, # argpo: argument of perigee (radians)
    0.5980929187319, # inclo: inclination (radians)
    0.3373093125574, # mo: mean anomaly (radians)
    0.0472294454407, # no_kozai: mean motion (radians/minute)
    6.0863854713832, # nodeo: right ascension of ascending node (radians)
)

tle = export_tle(satrec)

assert tle[0][18:32] != '00000.00000000'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisrosnercommented, Oct 13, 2020

I will attempt to validate correctness next. I have validated that there are realistic looking epoch dates present in the tle now.

I know it doesn’t make any sense, but for this application I don’t need precision.

I’ll comment today with a test for correctness.

1reaction
chrisrosnercommented, Oct 13, 2020

I am now getting epochs in the tles.

I cannot believe how responsive you were on this, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python-sgp4/__init__.py at master - GitHub
"""Track Earth satellites given TLE data, using up-to-date 2020 SGP4 routines. This Python package computes the position and velocity of an.
Read more >
Earth Satellites — Skyfield documentation - Rhodes Mill
“The maximum accuracy for a TLE is limited by the number of decimal ... a current TLE cannot predict the satellite's position on...
Read more >
Knowledge: How to Create a TLE File
Right-click your satellite and in the shortcut menu select Satellite > Generate TLE…. Note: The Generate TLE Tool requires an STK SatPro license...
Read more >
SGP4 Orbit Determination - CelesTrak
Input a TLE, create the initial state vector and take that as the initial guess for the TLE, develop an ephemeris from the...
Read more >
Utilizing the Official SGP4 DLLs in Python
Project Setup. This tutorial aims for the simplest, most easily understood usage of the SAA DLLs. Make a directory called pysaademo/ and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found