Question about InterSatellitesRange


I met a problem with “InterSatellitesRange”. I’m not sure if it’s a bug or I don’t get it and made some mistakes. I hope you could help me.

I have a constellation with several satellites (assume 60) that connect with each other by ISL. Now I would like to simulate some measurements used for orbit determination. So I created one Generator and registered propagators of all satellites to it (so the propagatorIndex would be 0-59). Then I created the schedulers for each ISL and attached them to the Generator. After generating the measurements, I used BatchLSEstimator to do the estimation.

But when I did estimator.estimate(); I met an error:

Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: 41
	at org.orekit.estimation.measurements.InterSatellitesRange.theoreticalEvaluation(
	at org.orekit.estimation.measurements.AbstractMeasurement.estimate(
	at org.orekit.estimation.leastsquares.MeasurementHandler.handleStep(
	at org.orekit.propagation.PropagatorsParallelizer.propagate(
	at org.orekit.estimation.leastsquares.BatchLSModel.value(
	at org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresFactory$LocalLeastSquaresProblem.evaluate(
	at org.orekit.estimation.leastsquares.BatchLSEstimator$TappedLSProblem.evaluate(
	at org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer.optimize(
	at org.orekit.estimation.leastsquares.BatchLSEstimator.estimate(

I checked the source code of “InterSatellitesRange”. I noticed on the lines 126-132

// coordinates of both satellites
final ObservableSatellite local = getSatellites().get(0);
final SpacecraftState stateL = states[local.getPropagatorIndex()];
final TimeStampedFieldPVCoordinates<DerivativeStructure> pvaL = getCoordinates(stateL, 0, factory);
final ObservableSatellite remote = getSatellites().get(1);
final SpacecraftState stateR = states[remote.getPropagatorIndex()];
final TimeStampedFieldPVCoordinates<DerivativeStructure> pvaR = getCoordinates(stateR, 6, factory);

So I think the problem here is that since it’s an ISL measurement, the size of variable states is 2 (local and remote satellites). But the propagatorIndex it gets from local.getPropagatorIndex() is no longer 0 or 1 (in this case is 41).


I think a simple way to solve this problem is just changing the index directly as 0 and 1 (since the line above uses getSatellites().get(0) and getSatellites().get(1) respectively), like

final SpacecraftState stateL = states[0];
final SpacecraftState stateR = states[1];

Or maybe I don’t quite get the reason why it designs like that, and I made some other mistakes led to this? Do you have any suggestion?

Thanks a lot!

Congratulations, you found a bug!
However your proposed fix would not work. In fact, the bug is spread over several classes,
including MeasurementHandler which may not provide the correct states.

Could you open a bug report on

Thanks a lot for your reply!

I’ve opened a report on the website. Hope I did it right.

I hope it could be fixed soon. Many thanks for your great work!

The issue has been fixed, thanks for reporting it!

My pleasure. Thanks a lot for quick fixing!

Hi Luc, sorry to bother you again.

Today I tested the fixed code, it works fine. However, I met the same error with the range measurements again:

Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: 7
	at org.orekit.estimation.measurements.Range.theoreticalEvaluation(
	at org.orekit.estimation.measurements.AbstractMeasurement.estimate(
	at org.orekit.estimation.measurements.generation.EventBasedScheduler.generate(
	at org.orekit.estimation.measurements.generation.Generator$GeneratorHandler.handleStep(
	at org.orekit.propagation.PropagatorsParallelizer.propagate(
	at org.orekit.estimation.measurements.generation.Generator.generate(

I checked the source code of “Range” and I think it might be the same problem. Would you mind to check it too? Thanks a lot!

You are right.
I thought I had modified everything but obviously forgot some parts.
I will reopen the issue and provide a new fix soon.

Sorry for the mishap.

It’s OK. Many thanks for your work!

I hope it is fixed now, could you check it?

Yes, it works well now. Thanks a lot for the fixing!