Usage troubles with KalmanEstimator - Not converging

Once again hi guys !

I’m trying to use a Kalman filter in order to estimate my initial orbit from noised measurements (Range, RangeRate, AngularAzEl).

I’d like to feed my estimator with one mesurement of each at each timestep but I have some difficulties whit the usage of the Kalman Filter with orekit. I don’t really understand how to builder the estimator and ho to feed it correclty.

Here is the function I created, is anybody who has the kindness to take a look and tell me what going on please ?

def performEKF(mesurementsFrame, initialOrbit, initialCOV):
    # Init lists to get the evolution of the filter
    listPropagators = np.array([])
    listOrbits = np.array([])
    listStates = np.array([])
    listCOVmatrixes = np.array([])

    # Init process noise matrix
    Q = MatrixUtils.createRealDiagonalMatrix([1e-8, 1e-8, 1e-8, 1e-8, 1e-8, 1e-8])

    # Init Keplerian Propagator Builder
    integratorBuilder = DormandPrince853IntegratorBuilder(PROP_MIN_STEP, PROP_MAX_STEP, PROP_POS_TOLERANCE)
    kepPropagatorBuilder = NumericalPropagatorBuilder(CartesianOrbit(orbitEstimate), integratorBuilder, PositionAngle.MEAN, estimator_position_scale)

    # Build the Kalman filter
    kalman = KalmanEstimatorBuilder().addPropagationConfiguration(kepPropagatorBuilder,
             ConstantProcessNoise(initialCOV, Q)).estimatedMeasurementsParameters(ParameterDriversList()).build()

    # Process filtering
    for date, meas in mesurements.iterrows():
        kalman.estimationStep(meas['rangeMes'])
        kalman.estimationStep(meas['rangeRateMes'])
        newPropagator = kalman.estimationStep(meas['angularAzElMes'])[0]

	newEstimatedOrbit = newPropagator.getInitialState().getOrbit()
	newEstimatedState = kalman.getPhysicalEstimatedState()
	newCovMatrix = kalman.getPhysicalEstimatedCovarianceMatrix()

        listPropagators = np.append(listPropagators, newPropagator)
        listOrbits = np.append(listOrbits, newEstimatedOrbit)
	listStates = np.append(listStates, newEstimatedState)
        listCovmatrixes = np.append(listCovmatrixes, kalman.getPhysicalEstimatedCovarianceMatrix())

    return listPropagators, listOrbits, listStates, listCovmatrixes

I Didn’t look at everything, but there is one issue with your code above.
You feed the three measurements range, range rate and angular one at a time despite
they are all at the same date. As a consequence, after you have fed the estimator with the
first measurement type (range here), its internal state corresponds to this date. Then
you feed it with a second measurement but there are not time change since previous
one, so the state evolution and its covariance are probably not correct.

When you have measurements that occur simultaneously, they must be fed to the Kalman filter
together. There is a special wrapper for that in Orekit: MultiplexedMeasurement.
So in your loop there should only be one call to kalman.estimationStep and the
argument should be a MultiplexedMeasurement built from the three simultaneous
range, range rate and angular measurements occurring at that time.

Thank you very much luc to noticed that !

I made a modification in order to fit with what you said:

  1. During the generation of the Measurement Dataframe, I added a column multiMeas of MultiplexedMeasurement defined by adding the range, rangeRate and angularAzEl measurements to an empty ArrayList of ObservedMeasurements
  2. I’m using now the MultiplexedMeasurement list to feed the estimator with only one usage of the function estimationStep in the loop for each step
  3. The Kalmanfilter is still running quite randomly ann not converging to the right orbit.

Hi guys !

I finally found something to explain the problem of convergence of my Kalman filter.

I putted a process noise matrix initialized at too small values (1e-8). My kalman was so too mush confident on the predictions. With a Q matrix at 20. for exemple, my Kalman is converging quickly !

Thank you for the help @luc