Field Orbit and OrbitType.mapArrayToOrbit Issues

I was upgrading my orekit from 9.3 to 10.1 and encountered a problem I have not been able to solve. In my 9.3 I used the following code:
FieldOrbit initialOrbit = orbitType.mapArrayToOrbit(stateVectorDS, null,
positionAngle, date,mu, initialOrbitI.getFrame());

where stateVectorDS is a DerivativeStructure[], positionAngle is a PositionAngle, the date is an FieldAbsoluteDate, and mu is a double.

After upgrading it seems like the method no longer works. The only difference in the constructor is that mu should be a T. I have tried changing mu to a derivativestructure but im not sure if i did this correctly. I just used factory.constant( mu). Is this correct?

EDIT: I ask because the behavior no longer seems accurate. My next line is:

	FieldSpacecraftState<DerivativeStructure> spacecraftState = new FieldSpacecraftState<>(initialOrbit);

This works in equinoctial or keplerian defined orbits but for cartesian orbits I get: “MathRuntimeException: cannot normalize a zero norm vector”

Hi @paul,

If your are not estimating the mu parameter, this line is correct. Another possibility is to use the derivative field from the factory. Something like:

final Field<DerivativeStructure> field = factory.getDerivativeField();
final DerivativeStructure muField = field.getZero().add(mu);

Do you have zero elements in your stateVectorDS object ? This error can occur when the 3 components of the position (or the velocity) are equals to 0.0.
Is it possible to know the class and line for which this exception occurs ?



1 Like

I’ve figured out why this issue is occuring but not how to fix it. I’m using the BLSEstimator to do some orbit determination. I have a check which nulls out an orbit if the covariance matrix is badly conditioned. This seems to happen every single time I use cartesian elements, where the observations contain noise. Here is the code which generates noise:

ObservableSatellite obs = new ObservableSatellite(observableSat);
NormalizedRandomGenerator NRG = new GaussianRandomGenerator(new RandomDataGenerator());
RealMatrix cov2 = MatrixUtils
.createRealDiagonalMatrix(new double[] { Math.pow(azElError[0], 2), Math.pow(azElError[1], 2) });
CorrelatedRandomVectorGenerator cRVG2 = new CorrelatedRandomVectorGenerator(new double[] { 0, 0 }, cov2, 1e-8,
RealMatrix cov1 = MatrixUtils.createRealIdentityMatrix(1).scalarMultiply(Math.pow(rangeSigma, 2));
CorrelatedRandomVectorGenerator cRVG1 = new CorrelatedRandomVectorGenerator(new double[] { 0 }, cov1, 0.0001,

The cRVG2 is used for the angular observation generator and the other for the range generator. The problem is not nearly as dramatic if i disinclude this error. Here are my questions/thoughts about what may or may not solve this issues?

  • Am I performing the error generation incorrectly?
  • Could this be an issue with my propagator? I’m using a DormandPrince853 integrator. Should the dP element be the same as the standard deviation for position? Should I be using a better propagator. I make sure to use the same propagator for least squares and initial observation generation. I don’t think this is the issue. When I build the propagator I set the normalized parameters to be {1.0,1.0,1.0,1.0,1.0,1.0}. Is that incorrect?
  • I’ve messed around with the batch least squares routine extensively, and have settled on using the nondamped version (Gaussian) with singular value decomp in the hopes that would help with the conditioning. I don’t think this is the issue.
  • I’ve tried changing versions to the 10.1 experimental and stable version. It doesn’t seem like its something to do with my issue.

EDIT: To be clear the covariance matricies when ill conditioned basically are useless to me as propagating those will cause huge problems

Maybe you can try with another RandomGenerator. A Well19937a for instance.
To build the covariance matrix for the range measurements, you can directly use:

MatrixUtils.createRealDiagonalMatrix(new double[] { rangeSigma * rangeSigma });

What are the values of rangeSigma and azElError ? Maybe you use too important or to small values for these parameters. For instance you can try with 10.0 for the rangeSigma and 1.0e-3 for both azElError.

Otherwise,I think your error generation looks good.

There is no rule for these two parameters. They can be equal or different. However, I think you should first put the same value for these two parameters. A typical value is 10.0.

You can call the method getSelectedNormalizedParameters() from your propagator builder in order to have the normalized parameters.

1 Like