Attitude interpolation degree

Hi all!

I am using the Python wrapper to parse an AEM file and perform an orbit determination taking attitude into account, to compute surface forces in a more precise manner. The AEM contains quaternions (without derivatives) that cover a 12-hour period with a 30-second time step.

I am parsing the AEM and building an attitude provider from it as follows :

with open("/home/example.aem", "r") as f:
    data_source = DataSource("AEM File", StringReaderOpener(f.read()))

aem = Aem.cast_(ParserBuilder().buildAemParser().parseMessage(data_source))
attitude_provider = AemSegment.cast_(aem.getSegments().get(0)).getAttitudeProvider()

The attitude provider is then incorporated into the propagator to be used in the estimation process. This works fine when setting the interpolation degree in the AEM metadata to 1 (or simply removing this parameter in the AEM file, I guess the default value is also 1).

However, I end up getting the following error at the estimation stage in Hipparchus when using an interpolation degree higher than 1 :

orekit.JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
org.orekit.errors.OrekitException: impossible de calculer la factorisation Q.R de la matrice jacobienne 6 000x7
	at org.orekit.estimation.leastsquares.BatchLSEstimator.estimate(BatchLSEstimator.java:465)
Caused by: org.hipparchus.exception.MathIllegalStateException: impossible de calculer la factorisation Q.R de la matrice jacobienne 6 000x7
	at org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer.qrDecomposition(LevenbergMarquardtOptimizer.java:978)
	at org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer.optimize(LevenbergMarquardtOptimizer.java:344)
	at org.orekit.estimation.leastsquares.BatchLSEstimator.estimate(BatchLSEstimator.java:459)

There seems to be an outlier in the Jacobian matrix which prevents the QR decomposition to be performed (maybe a NaN derivative somewhere ?).

Given this behavior, I was wondering :

  • Is there some kind of condition to fulfill in order to interpolate quaternions with a degree higher than 1 (e.g. time step, rotation rates …) ? I tried making the orientation constant and interpolating with higher degrees seems to work.
  • Maybe I should try building the attitude provider another way (using a bounded attitude provider for example) ? Why should it work better in this case ?

I can provide a sample code in case you need any more details.

Thanks !