Dear all,
I am working on fitting Two-Line Elements from an orbit propagator. To compute a “first guess”, I initialize a TLE object from osculating elements from a KeplerianOrbit object.
However, I run into issues when the Right Ascension of Ascending Node (RAAN) or the Argument of Perigee (AOP) are negative. These values can indeed be negative in a KeplerianOrbit object, but a TLE does not accept them. When creating the TLE, no exception is raised, and I can even use this TLE object for further computations, but an exception is raised when asking for a string representing this TLE.
The code is the following:
from org.orekit.orbits import KeplerianOrbit
initial_orbit_keplerian = KeplerianOrbit(initial_orbit)
perigee_argument = initial_orbit_keplerian.getPerigeeArgument()
raan = initial_orbit_keplerian.getRightAscensionOfAscendingNode()
from org.orekit.propagation.analytical.tle import TLE
tle_first_guess = TLE(satellite_number,
classification,
launch_date.year,
launch_number,
launch_piece,
ephemeris_type,
element_number,
separation_date,
initial_orbit_keplerian.getKeplerianMeanMotion(),
0.0, # Mean motion first derivative
0.0, # Mean motion second derivative
initial_orbit_keplerian.getE(),
initial_orbit_keplerian.getI(),
perigee_argument,
raan,
initial_orbit_keplerian.getMeanAnomaly(),
revolution_number,
b_star_first_guess)
print(tle_first_guess.toString())
Raises the following exception:
---------------------------------------------------------------------------
JavaError Traceback (most recent call last)
<ipython-input-20-da382527e187in <module>
----1 tle_first_guess.toString()
JavaError: <super: <class 'JavaError'>, <JavaError object>>
Java stacktrace:
org.orekit.errors.OrekitInternalError: internal error, please notify development team by creating an issue at https://gitlab.orekit.org/orekit/orekit/issues
at org.orekit.propagation.analytical.tle.TLE.toString(TLE.java:693)
Caused by: org.orekit.errors.OrekitException: invalid TLE parameter for object 99,999: raan = -120.1314
at org.orekit.propagation.analytical.tle.TLE.addPadding(TLE.java:507)
at org.orekit.propagation.analytical.tle.TLE.buildLine2(TLE.java:461)
at org.orekit.propagation.analytical.tle.TLE.getLine2(TLE.java:357)
at org.orekit.propagation.analytical.tle.TLE.toString(TLE.java:691)
For now I am checking the sign before creating the TLE object (see code below). It is no big deal, but maybe it would be good to add the angle ranges to the documentation or to check the sign in the TLE constructor.
perigee_argument = initial_orbit_keplerian.getPerigeeArgument()
if perigee_argument < 0:
perigee_argument += float(2*np.pi)
raan = initial_orbit_keplerian.getRightAscensionOfAscendingNode()
if raan < 0:
raan += float(2*np.pi)
Cheers
Clément