Dear Orekit community,
I am working on parsing and manipulating data from an OEM. In particular, I would like to read the covariance evolution and interpolate it at any epoch.
I am using Orekit v12.2.
After reading the OEM and getting the propagator:
OemParser oemParser = new ParserBuilder().buildOemParser();
Oem oem = oemParser.parse(new DataSource(new File(oemStringPath)));
OemSegment oemSegment = oem.getSegments().get(0);
prop = oem.getPropagator(); // Gives an EphemerisSegmentPropagator
I tried, at first, to interpolate the covariance matrix with a StateCovarianceBlender using an OrbitBlender. Here I create an instance of StateCovarianceBlender and obtain the interpolationSamples:
// 1) Create Blender
// Smoothing function
SmoothStepFunction sf = SmoothStepFactory.getQuintic();
// Build orbit blender
OrbitBlender ob = new OrbitBlender(sf, prop, FramesFactory.getEME2000());
// Assign state covariance blender to instance variable
stateCovInterpolator = new StateCovarianceBlender(sf, ob, LOFType.TNW);
// 2) Create samples
List<TimeStampedPair<Orbit, StateCovariance>> samples = new ArrayList<>();
for (CartesianCovariance cov : oem.getCovarianceMatrices()) {
AbsoluteDate date = cov.getEpoch();
Orbit orbit = prop.propagate(date).getOrbit(); // orbit at covariance epoch
StateCovariance stateCov = new StateCovariance(
cov.getCovarianceMatrix(), date, cov.getReferenceFrame().asFrame(),
OrbitType.CARTESIAN, null);
samples.add(new TimeStampedPair<>(orbit, stateCov));
}
// Assign samples to instance variable
intepolationSamples = samples;
However, on the line:
StateCovariance cov = stateCovInterpolator.interpolate(s.getDate(), intepolationSamples).getSecond()
I get the following error:
Caused by: org.orekit.errors.OrekitException: reset state not allowed
at org.orekit.files.general.EphemerisSegmentPropagator.resetInitialState(EphemerisSegmentPropagator.java:143)
at org.orekit.orbits.OrbitBlender.propagateOrbit(OrbitBlender.java:131)
at org.orekit.orbits.OrbitBlender.interpolate(OrbitBlender.java:104)
at org.orekit.orbits.OrbitBlender.interpolate(OrbitBlender.java:59)
at org.orekit.time.AbstractTimeInterpolator.interpolate(AbstractTimeInterpolator.java:94)
at org.orekit.orbits.AbstractOrbitInterpolator.interpolate(AbstractOrbitInterpolator.java:81)
at org.orekit.orbits.AbstractOrbitInterpolator.interpolate(AbstractOrbitInterpolator.java:34)
at org.orekit.propagation.AbstractStateCovarianceInterpolator.interpolateOrbit(AbstractStateCovarianceInterpolator.java:189)
at org.orekit.propagation.AbstractStateCovarianceInterpolator.interpolate(AbstractStateCovarianceInterpolator.java:129)
at org.orekit.propagation.AbstractStateCovarianceInterpolator.interpolate(AbstractStateCovarianceInterpolator.java:41)
at org.orekit.time.AbstractTimeInterpolator.interpolate(AbstractTimeInterpolator.java:94)
After some research, it seems that the EphemerisSegmentPropagator (as other AnalyticalPropagators) does not support the resetInitialState method (“Try (and fail) to reset the initial state.”).
I also tried to implement it with the StateCovarianceKeplerianHermiteInterpolator with an OrbitHermiteInterpolator, with a very similar approach (I will not share my code for now, otherwise this post will become a TLDR), but I get this error:
Caused by: java.lang.NullPointerException
at org.orekit.orbits.Orbit.getJacobianWrtParameters(Orbit.java:606)
at org.orekit.propagation.StateCovariance.changeTypeAndCreate(StateCovariance.java:458)
at org.orekit.propagation.StateCovariance.changeCovarianceType(StateCovariance.java:257)
at org.orekit.propagation.StateCovarianceKeplerianHermiteInterpolator.computeAndCombineCovarianceValueAndDerivatives(StateCovarianceKeplerianHermiteInterpolator.java:311)
at org.orekit.propagation.StateCovarianceKeplerianHermiteInterpolator.computeInterpolatedCovarianceInOrbitFrame(StateCovarianceKeplerianHermiteInterpolator.java:275)
at org.orekit.propagation.AbstractStateCovarianceInterpolator.interpolate(AbstractStateCovarianceInterpolator.java:134)
at org.orekit.propagation.AbstractStateCovarianceInterpolator.interpolate(AbstractStateCovarianceInterpolator.java:41)
at org.orekit.time.AbstractTimeInterpolator.interpolate(AbstractTimeInterpolator.java:94)
I suppose it is because, in the interpolated states I am providing, the Jacobian is missing.
What am I missing? What is the common way to obtain covariance interpolation from an OEM? Is there any simpler way than this?
I guess that creating a NumericalPropagator and re-propagate might work but I would avoid re-propagation of OEM data.
I am very likely missing something here, so I apologize in advance.
Thank you for your answer and for your work!
Cheers,
Giacomo