KalmanEstimator : KalmanObserver and negative eccentricity with NumericalPropagatorBuilder

Hi everyone,

I try to get the innovation from a KalmanEstimator object. I use the KalmanObserver interface as mentioned in this topic1 but it seems that the method evaluationPerformed is not called. Bellow an example:

#My Kalman Observer class
class MyObserverTest(KalmanObserver):
    def __init__(self):
    def evaluationPerformed(self, estimation):

# Setting up the estimator
kalman_estimator_builder = KalmanEstimatorBuilder()
kalman_estimator_builder.addPropagationConfiguration(numerical_propagator_builder,ConstantProcessNoise(Q, initial_covariance_matrix))
kalman_estimator = kalman_estimator_builder.build()

#Adding the observer
my_observer_test = MyObserverTest()

for spacecraft_state in list_spacecraft_state:
    #Creating the measurement from the spacecraft state
    date = spacecraft_state.getDate()
    pv_coordinates = spacecraft_state.getPVCoordinates()
    position = pv_coordinates.getPosition()
    velocity = pv_coordinates.getVelocity()
    pv_measurement = PV(date, position, velocity, sigma_pv, base_weight, obs_satellite)
    #Estimation step
    propagator_estimated = kalman_estimator.estimationStep(pv_measurement)[0]
    #Testing the estimation

It only prints the covariance matrix but not the ‘step’ string from the evaluationPerformed method.
Do you have any idea where the error is ?

Otherwise I have a doubt an another issue. When I use a NumericalPropagatorBuilder in the KalmanEstimatorBuilder it rises me the error of negative eccentricity for some initial state during the estimation steps. However there is no setOrbitType method in NumericalPropagatorBuilder as in NumericalPropagator, so I can’t use it as in topic2. I found a solution by setting the initial orbit as an equinoctial one. Bellow an example:

orbit = EquinoctialOrbit(initial_spacecraft_state.getOrbit())
propagator_builder = NumericalPropagatorBuilder(orbit, integrator_builder, PositionAngle.MEAN, 1.0, attitude_provider)

Is it the right way to solve this issue ?

Thanks a lot,
Kind regards,

Hi @sbaudier,

Not sure about your negative eccentricity issue, but I can probably help walk through the other part - since posting that topic you linked, I have gotten the orekit EKF working quite well.

First off, you should subclass the observer with the python-specific subclass. Also I have found that the subclassing can have issues if you don’t superclass it with itself in the init. See below:

#My Kalman Observer class
from org.orekit.estimation.sequential import PythonKalmanObserver
class MyObserverTest(PythonKalmanObserver):
    def __init__(self):
        super(MyObserverTest, self).__init__()
    def evaluationPerformed(self, estimation):

A thought or two on the negative eccentricity thing:

  1. Check that the position/velocity states are in an inertial reference frame. Fixed/ECEF could slip through here since you are building measurements on the fly, but the PV class does not have a reference frame. You can ensure that by making sure your PV coordinates coming out of spacecraft_state are forced into an inertial frame via pv_coordinates = spacecraft_state.getPVCoordinates(FramesFactory.getEME2000())
  2. The orbit type should have been configured from the initial orbit used in the construction of your NumericalPropagatorBuilder. Not sure if this helps, but in mine I have PositionAngle.TRUE and have not had to make mine into an Equinoctial orbit

Hi @aerow610 ,

Thank you for your quick answer.

About the KalmanObserver issue, it works with the dedicated PythonKalmanObserver class and the superclass init.

About the second one, I try your suggestions without success. However, making the orbit an equinoctial one seems to work, I will continue with this method.

Thanks again,