Estimate Measurement Parameters in the Unscented Kalman Model

Hello everyone!

Recently, I’ve been implementing the Unscented Kalman Filter (UKF) for attitude estimations using parameter drivers (quaternions) obtained from magnitude measurements. While working with the latest version of Orekit 12.0.1 and utilizing the UKF, I’ve encountered an issue where the model doesn’t allow estimating measurements without first estimating orbital parameters.

In the UnscentedKalmanModel.java class, the covarianceIndirection is created through a new int[covarianceMatrixProviders.size()][columns] as shown in the image. The problem arises because I’ve modified the code to skip the estimation of both orbital and propagation parameters, focusing solely on magnitude estimation, specifically the 4 quaternions. This causes the value of columns to be 4. The fact that columns is set to 4 makes covarianceIndirection[k][i++] in the first for (final ParameterDriver driver : orbitDrivers.getDrivers()) result in an error when i=4:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4

Given the current code structure, I’m unsure if I can perform measurements estimation without estimating orbital parameters. In the case of propagation parameters, the code detects that c = null, so it doesn’t add values to covarianceIndirection.

Is there a way to resolve this issue?

Thank you in advance, everyone!

Hi @diegoth99

Welcome to the Orekit forum! :slight_smile:

Does it work with the extended Kalman filter?

If yes, we shall think about doing the same work in the unscented filter.

Regards,
Bryan

Before using the extended filter could you try using builder.deselectDynamicParameters() before Initializing your filter.
This method is used to disable the estimation of the orbital and propagation parameter from the propagator point of view.

Bryan

Hello! Thank you very much for your prompt response @bcazabonne! :slightly_smiling_face:

I’ve tried using the Extended Kalman Filter; however, a similar issue arises since there are no orbital parameters to estimate in the SemiAnalyticalKalmanModel.java. You can see that an error (matrix must have at least one row) will occur as there are no orbital parameters to estimate.

// Initialize inverse of the orbital part of the state transition matrix
this.phiS = MatrixUtils.createRealIdentityMatrix(getNumberSelectedOrbitalDriversValuesToEstimate());

The only estimator that seems to work correctly with magnitude measurements is the KalmanEstimator. As soon as I use the UnscentedKalmanEstimator, the problem described in the previous post occurs. Below, I show in the following image one of the key differences between the Unscented Kalman Model and the Kalman Model in this process.

On the left is the Unscented Kalman Model, while on the right is the Kalman Model. There is a clear difference between lines 227-230 of the UKM and lines 221-226 of the KM. It can be observed that in the case of the KM, it works because it first detects that c != null before adding the value to covarianceIndirection. In the case of the UKM, the value of i increases even if c == null, causing the model to stop working when the number of the four quaternions I want to measure is exceeded (which defines the size of columns = 4). This leads to the problem mentioned in the previous post.

On the other hand, it’s worth mentioning that I’ve tried using builder.deselectDynamicParameters(), but I’m using an EphemerisPropagatorBuilder instead of a NumericalPropagatorBuilder as in previous versions. However, I was already performing this treatment previously before the builder:

    for (final ParameterDriver parameterDriver : propagatorBuilder.getOrbitalParametersDrivers().getDrivers())
        {parameterDriver.setSelected(false);}
    for (final ParameterDriver parameterDriver : propagatorBuilder.getPropagationParametersDrivers().getDrivers())
        {parameterDriver.setSelected(false);}

I appreciate your time in advance for the offered assistance. Best regards, and I look forward to your response!

SemiAnalyticalKalmanModel is not the classical Extended Kalman Filter (EKF). It is an EKF adapted to semi analytical propagators.
It is the dark side of the black magic of the Kalman filters. :slight_smile:

Great! This class is the classical EKF.
So, if the EKF is able to perform the estimation without orbital and propagation parameters, the UKF shall do it too.
Could you open an issue in our Gitlab repository?

Just note an important information. Even if the UKF code is adapted, I don’t think it will work with the current version of Orekit because of the current issue: Improve estimation of propagation and measurement parameters with Unscented Kalman Filter (#1036) · Issues · Orekit / Orekit · GitLab

These are two different issues that shall be fixed separately.

Thank you,
Bryan