Skip to content

PositionAngleDetector not initialized in ConfigurableLowThrustManeuver

Adding a PositionAngleDetector to a ConfigurableLowThrustManeuver as start and stop firing detector leads to a java.lang.NullPointerException error.

The issue had been solved in the Orekit forum by @bcazabonne:

The fix to apply in Orekit is straightforward. In the init method of the EventBasedManeuverTriggers class, the following implementation.

/** {@inheritDoc} */
@Override
public void init(final SpacecraftState initialState, final AbsoluteDate target) {

    if (!initialized) {

        initialized = true;
        forward     = target.isAfterOrEqualTo(initialState);
        if (!forward && !allowBackwardPropagation) {
            // backward propagation was forbidden
            throw new OrekitException(OrekitMessages.BACKWARD_PROPAGATION_NOT_ALLOWED);
        }

        checkInitialFiringState(initialState);

    } // multiples calls to init : because it is a force model and by each detector
}

must be improved by

/** {@inheritDoc} */
@Override
public void init(final SpacecraftState initialState, final AbsoluteDate target) {

    if (!initialized) {

        initialized = true;
        forward     = target.isAfterOrEqualTo(initialState);
        if (!forward && !allowBackwardPropagation) {
            // backward propagation was forbidden
            throw new OrekitException(OrekitMessages.BACKWARD_PROPAGATION_NOT_ALLOWED);
        }
        startFiringDetector.init(initialState, target);
        stopFiringDetector.init(initialState, target);

        checkInitialFiringState(initialState);

    } // multiples calls to init : because it is a force model and by each detector
}