TLE does not accept negative RAAN and AOP whereas KeplerianOrbit does
Original discussion: https://forum.orekit.org/t/negative-raan-and-aop-keplerianorbit-vs-tle/777
Context
- In a KeplerianOrbit object, the Right Ascension of Ascending Node (RAAN) and the Argument of Perigee (AOP) are defined in the [-
\pi
, +\pi
] interval - In a TLE object (and the TLE format in general), the RAAN and the AOP are defined in the [0, 2
\pi
] interval
What happens
When passing osculating elements from a KeplerianOrbit to a TLE (as a first guess before fitting mean elements):
- The TLE constructor does not complain
- When calling the
toString()
method, an exception is raised:
---------------------------------------------------------------------------
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)
Possible "solutions"
I see three possibilities:
- Throw an exception if the user initialized negative angles.
- If the angles are negative, then normalize them between 0 and 2 pi inside the TLE constructor (more user-friendly because no exceptions are thrown).
- Change nothing, just document the angles range in the javadoc