[Bug ?] Problem with EclipseDetector around Mars

I’m trying to use the EclipseDetector for simple Keplerian orbit around Mars.
Here is my code :

final double MARS_EQUATORIAL_RADIUS = 3394200;
final double MARS_FLATTENING = 0.00589;
final double SUN_EQUATORIAL_RADIUS = 696000000;

// Orbital parameters around Mars
final double a = 20427505.0;
final double e = 0.0;
final double i = 0.0;
final double pa = 0.0;
final double raan = 1.91143616391;
final double ta = 0.0;

final AbsoluteDate startDate = new AbsoluteDate(2010,11,19,7,57,37.816,TimeScalesFactory.getTT());
final AbsoluteDate endDate = new AbsoluteDate(2010,11,20,8,34,51.816,TimeScalesFactory.getTT());
final double duration = endDate.durationFrom(startDate);

CelestialBody mars = CelestialBodyFactory.getMars();
OneAxisEllipsoid marsEllipsoid = new OneAxisEllipsoid(MARS_EQUATORIAL_RADIUS, MARS_FLATTENING, mars.getBodyOrientedFrame());
KeplerianOrbit orbit = new KeplerianOrbit(a, e, i, pa, raan, ta, PositionAngle.TRUE, mars.getInertiallyOrientedFrame(), startDate, mars.getGM());

KeplerianPropagator propagator = new KeplerianPropagator(orbit, mars.getGM());

EventsLogger logger = new EventsLogger();

EclipseDetector eclipseDetector = new EclipseDetector(CelestialBodyFactory.getSun(), SUN_EQUATORIAL_RADIUS, marsEllipsoid).withHandler(new ContinueOnEvent<>());
eclipseDetector = eclipseDetector.withUmbra();	  


List<LoggedEvent> eventList = logger.getLoggedEvents();

The propagation raise an exception :

Exception in thread “main” 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.events.EventState.check(EventState.java:533)
at org.orekit.propagation.events.EventState.findRoot(EventState.java:253)
at org.orekit.propagation.events.EventState.evaluateStep(EventState.java:218)
at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.acceptStep(AbstractAnalyticalPropagator.java:231)
at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:166)
at org.orekit.propagation.AbstractPropagator.propagate(AbstractPropagator.java:261)
at main.OrekitWrapperTest.main(OrekitWrapperTest.java:298)

As far as I analyzed, the Ellipsoid pointOnLimb method generate NaN value ( gamma variable) which lead to raise the exception.
Is it a bug or I my usage is wrong ?


Hi Guillaume,

Indeed this is a bug. This bug is due to a numerical problem during computations. We recently fixed this issue (see #639). The fix will be available in version 10.1 of Orekit (released next week) but you can already take advantage of the fix by using our development branch.

Kind regards,

I tested with the fix and your code works perfectly.

Thank you really much for your fast answer.