Adding State Covariance to a NumericalPropagator in Orekit

Hi everyone,

I’m working on a CR3BP trajectory propagation using the Orekit Python wrapper, and I’m currently trying to include covariance propagation using StateCovarianceMatrixProvider.

Here’s the relevant snippet:

        propagator = NumericalPropagator(integration)
        scmHarvester = propagator.setupMatricesComputation("stm", None, None)
        scmProvider = StateCovarianceMatrixProvider("covariance", "stm", scmHarvester, stateCovariance)
        propagator.addAdditionalStateProvider(scmProvider)
        return (propagator, scmProvider)

In previous versions of Orekit, I’ve seen .addAdditionalStateProvider() used to add the STM to a numerical propagator. However, now that I’m using Orekit 13.0.1, it looks like this method has been removed or replaced.

Does anyone know the correct way to attach a StateCovarianceMatrixProvider to a NumericalPropagator in the current version? I’d really appreciate any guidance on how to properly enable state covariance propagation with the updated API.

Thanks so much for your time!

Hi @daniellaluciani

The state transition matrices API has been changed to use a MatrixHarvester. This change allowed to get these matrices for all propagators types, not only numerical ones.
So propagators implement a setupMatricesComputation method (internally a specialized one for each different propagator implementation). This method should be called before the start of the propagation and the harvester should be kept somewhere in your code. Then, either during the propagation in event handlers, step handlers or at the end of the propagation, the MatrixHarvester that was kept can be used to extract the matrices from any of the produced states, by calling its getStateTransitionMatrix or getParametersJacobian.

Internally, what happens in numerical propagator is just that the additional state providers are hidden, they are still there but the API is simpler as users directly get matrices. The most important thing is that there are now harvesters also for non-numerical propagation types, which was impossible before the change.

This change is in fact quite old now, I think it was in 11.1 or so, but at the beginning only a few propagators did really implement the setupMatricesComputation, it took some time to generalize this.

1 Like

Hi there,

Please check this tutorial out.

Cheers,
Romain.

2 Likes

Thank you! I appreciate it :slight_smile:

Hi Luc,

Thank you for the clear and thoughtful explanation, the update to support harvesters across all propagators is a really cool improvement.

I had one quick follow-up question. I’m currently using a CR3BP setup with the numerical propagator:

    propagator = NumericalPropagator(integration)
    propagator.setOrbitType(None)  # Non-Keplerian system
    propagator.setIgnoreCentralAttraction(True)   
    propagator.addForceModel(CR3BPForceModel(cr3bpSystem))

My initial state is defined using AbsolutePVCoordinates, and when I try to add a StateCovarianceMatrixProvider, I get an error saying the orbit is not defined.

Is there a way to perform covariance propagation in this kind of setup (i.e., CR3BP with PV-based state and no defined orbit)? Or is that currently unsupported?

Thanks again for your time and help!