Attitude sequence with ephemeris


Hi all,

I’m trying to use the attitude sequence functionality of Orekit to switch from one attitude to another, starting from a given date and with a given time duration. As a result, I would like to retrieve the attitude state during the whole propagation (i.e. including the interpolation time from one attitude to the other).
So far I managed to get it working by using a numerical propagator and by setting a dedicated handler in the setMasterMode method.

However, if I try to use the same approach with an Ephemeris object (which replaces the NumericalPropagator) I get an OUT_OF_RANGE_SIMPLE exception, which I believe is due to the delay introduced by the switching duration.
Is there another way to achieve this?

Any help would be really appreciated, thanks.


P.S I attach a simple example which hopefully clarifies what I’m trying to do. (6.2 KB)


Hi Mirco,

I looked at your code and have the same error.
In your code, there is a small confusion between the ephemeris mode of numerical propagator and the way you generate your ephemeris propagator. If you use the ephemeris mode, you don’t need to explicitly extract the spacecraft state in your handler, you can obtain the BoundedPropagator with propagator.getGeneratedEphemeris(). However, the BoundedPropagator that you obtain have the same attitude provider as your numerical propagator, and as I understand it, you can’t change it later.

In your case, I suggest to don’t set the ephemeris mode of the numerical propagator and just add a FixedStepHandler that extract the current state at each step to add it to the SpacecraftState list.

Concerning the error, it seems to be a bug in the Ephemeris propagator during the attitude computation in the transition period. I tried with different transition times but have the same problem. As I understand it, the analytical propagator computes the attitude at the beginning and at the end of the transition period to interpolate the attitude during transition. When the attitude at the end of the transition period is computed, the getPVCoordinates method of Ephemeris class check that the PV date is the same as the current date, and find that the PV date is 600s later than the current date (in your case).

I tried to remove that date check and the code runs, but the results are strange and different from the results of the numerical propagator. With Ephemeris, the rotations are valid during the first phase but very close to {-1, 0, 0, 0} after the transition. I also tried with a KeplerianPropagator, and the results are the same as the Ephemeris propagator.

I think there is a bug with attitude transitions in analytical propagators. You can open an issue at this link:
The NumericalPropagator seems to do the job in your code (I didn’t check the attitude values).

I attach my modifications to your code concerning the ephemeris propagator generation and the KeplerianPropagator option. (7.1 KB)



Hi Romaric,

Many thanks for your reply. I will try to use a NumericalPropagator as you suggested.



Let me know if you planned to open an issue on gitlab. If you don’t, I will probably do it.



Yes, I already created a new issue on Gitlab for this.