EphemerisGenerator and jacobian computation

Hello,

I have a question about the compatibility of the computation of the jacobian (w.r.t. maneuver parameters) and the EphemerisGenerator (the call to orekit is done from Matlab).
I tried to propagate a trajectory with a maneuver and requested the computation of the jacobian w.r.t. median date and duration of the maneuver (with the “setupMatricesComputation” method). During the same propagation, I also requested to enable the ephemerisGenerator to be able to get a state at any time later.
The propagation executed nominally but I am unable to use the ephemeris generated. As soon as I request a state at a specific date, I get an exception linked to the maneuver (during “initializeAdditionalStates” of the propagator).

propagator.setInitialState(state);
generator = propagator.getEphemerisGenerator();
harvester = propagator.setupMatricesComputation("STM", [], []);
finalState = propagator.propagate(endDate);
ephemeris = generator.getGeneratedEphemeris();

intermediateState = ephemeris.propagate(midDate);

The exception is raised during “ephemeris.propagate(midDate)”.

Java exception occurred:
java.lang.NullPointerException

	at org.orekit.time.AbsoluteDate.isEqualTo(AbsoluteDate.java:1237)
	at org.orekit.time.AbsoluteDate.isAfterOrEqualTo(AbsoluteDate.java:1288)
	at org.orekit.forces.maneuvers.jacobians.TriggerDate.init(TriggerDate.java:204)
	at org.orekit.propagation.AbstractPropagator.initializeAdditionalStates(AbstractPropagator.java:248)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:126)
	at org.orekit.propagation.AbstractPropagator.propagate(AbstractPropagator.java:276)

Did anyone already try the same combination ? Is it a known limitation (or bug) or do I have to do it differently ?

Thanks!

Christophe

Hi @Christophe,

It is most probably an already known issue that is unfortunately waiting for a fix. You would already be the second person to encounter it in a short time frame so this is becoming more and more of a priority to us developers.

In order to be sure, I guess that you created your own maneuver additionnalStateProvider with a specific init() method ?

I’m currently working on issue 970 and i will probably tackle this problem as soon as I’m done.

Cheers,
Vincent

Hello Vincent,

thanks for your answer. I agree with you that it seems to be linked to this issue.
The code I used is really simple for the maneuvers and relies on the basic classes provided by Orekit. I used the ConstantThrustManeuver class together with DateBasedManeuverTriggers for the date and BasicConstantThrustPropulsionModel for the thrust model.

Here is the matlab code I used to add the maneuvers to the propagator:

for idx = 1:numel(manMedianDate)
  name = "man"+idx;
  fireDate = epoch.shiftedBy((manMedianDate(idx)-0.5*manDuration(idx)) * 86400);
  duration = manDuration(idx) * 86400;
  constantThrustPropulsionModel = BasicConstantThrustPropulsionModel(simData.thrust, simData.isp, manDirection(idx), name);
  maneuver = ConstantThrustManeuver( ...
    propagator.getAttitudeProvider(), ...
    DateBasedManeuverTriggers(name, fireDate, duration), ...
    constantThrustPropulsionModel);
  maneuver.getParameterDriver(name+"_MEDIAN").setSelected(true);
  maneuver.getParameterDriver(name+"_DURATION").setSelected(true);
  propagator.addForceModel(maneuver);
end

I don’t know if I had to do something more because it works well for the propagation. It’s only that the ephemeris from the EphemerisGenerator raises an exception when used.

Thanks you.

Hi @Christophe,

I took another look and i’m now 100% sure that it is the same issue. As pointed out in your first error log, we can see that the init() method of the TriggerDate is called. It then tries to see if the target date is after or equal to the initial state (as we can partly see in the log as well). Don’t know how I missed this yesterday though :sweat:. As we are in an Ephemeris, the initial state is not initialized so it throws a java.lang.NullPointerException.

Long story short, you did not do anything wrong :sweat_smile: !

I’m still working on the previously mentioned issue but i should finish it in a few days at most.

Cheers,
Vincent

Hi,

There might be a workaround for your case with Field objects (Gradient for example), although I’ve not thoroughly checked. Define your independent variables in your initial state as well as your maneuvers, then retrieve your ephemerides post propagation and finally extract the relevant partial derivatives. I must say that the combo of automatic differentiation and dense output of integrators available in Hipparchus/Orekit is pretty neat.

Best,
Romain.

1 Like

Hi @Christophe,

Wanted to keep you informed that the issue has now been solved in this merge request.

Cheers,
Vincent