Finite Maneuver Start/End callback

Hi all,

I’m trying to update internal state of my Spacecraft object based on maneuver (burn) initiation or stop. What would be the best way to handle that?

I’m using DateBasedManeuverTriggers where the handler is set-up via a private method. Is there another way how I could catch the start/stop of a maneuver? I was considering to simply use DateDetector. Would that be a good approach? or is there something I’m missing?

Thank you,

Hi @michal, welcome to the Orekit forum and sorry for the delay !

Regarding the update of your SpacecraftState object, this is done within the private handler of ImpulseManeuver as shown below:

    private static class Handler implements EventHandler {

        /** {@inheritDoc} */
        public Action eventOccurred(final SpacecraftState s, final EventDetector detector,
                                    final boolean increasing) {

            // filter underlying event
            final ImpulseManeuver im = (ImpulseManeuver) detector;
            final Action underlyingAction = im.trigger.getHandler().eventOccurred(s, im.trigger, increasing);

            return (underlyingAction == Action.STOP) ? Action.RESET_STATE : Action.CONTINUE;


        /** {@inheritDoc} */
        public SpacecraftState resetState(final EventDetector detector, final SpacecraftState oldState) {

            final ImpulseManeuver im = (ImpulseManeuver) detector;
            final AbsoluteDate date = oldState.getDate();
            final AttitudeProvider override = im.getAttitudeOverride();
            final Rotation rotation;

            if (override == null) {
                rotation = oldState.getAttitude().getRotation();
            } else {
                rotation = override.getAttitudeRotation(oldState.getOrbit(), date, oldState.getFrame());

            // convert velocity increment in inertial frame
            final Vector3D deltaV = rotation.applyInverseTo(im.deltaVSat);
            final double sign     = im.forward ? +1 : -1;

            // apply increment to position/velocity
            final PVCoordinates oldPV = oldState.getPVCoordinates();
            final PVCoordinates newPV =
                            new PVCoordinates(oldPV.getPosition(),
                                              new Vector3D(1, oldPV.getVelocity(), sign, deltaV));
            final CartesianOrbit newOrbit =
                    new CartesianOrbit(newPV, oldState.getFrame(), date, oldState.getMu());

            // compute new mass
            final double normDeltaV = im.control3DVectorCostType.evaluate(im.deltaVSat);
            final double newMass = oldState.getMass() * FastMath.exp(-sign * normDeltaV / im.vExhaust);

            // pack everything in a new state
            SpacecraftState newState = new SpacecraftState(oldState.getOrbit().getType().normalize(newOrbit, oldState.getOrbit()),
                                                           oldState.getAttitude(), newMass);
            for (final DoubleArrayDictionary.Entry entry : oldState.getAdditionalStatesValues().getData()) {
                newState = newState.addAdditionalState(entry.getKey(), entry.getValue());
            for (final DoubleArrayDictionary.Entry entry : oldState.getAdditionalStatesDerivatives().getData()) {
                newState = newState.addAdditionalStateDerivative(entry.getKey(), entry.getValue());
            return newState;



As you can see, when you return an Action.RESET_STATE, it will call the “resetState” method of the handler.

Now coming onto your second question, i assume that you’re going to do some kind of continuous maneuver so this is where it gets a little more complicated.

Personnally, i would recreate a class similar to DateBasedManeuverTriggers where i can manually input my own ParameterDrivenDateIntervalDetector which would have been configured with my own EventHandler in order to update the SpacecraftState at burn initiation and/or stop.

Hope this can help you !