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â€ť

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 ?

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:

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:

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.