Hello,

I have a trajectory (time, position and velocity are defined) from Earth to the Moon and cannot really define an orbit with this trajectory as such.

I have defined a variable of type SpacecraftState using AbsPVCoordinates.

I then use this variable as an input for PartialDerivativesEquations.setInitialJacobian(SpacecraftState)

However, I get an error of: orbit not defined, state rather contains an absolute position-velocity-acceleration when trying to compute the Jacobian matrix.

Orekit states that inputting a variable of type SpacecraftState to compute the Jacobian matrix is allowed and a SpacecraftState can be defined using AbsPVCoordinates but I still get this error. Could anyone identify what I’m doing incorrectly? Or is there another way of computing the Jacobian matrix - without having to define an orbit?

Thank you!

Hi @benoist

What you’ve done is probably correct. Your problem comes from a missing feature in Orekit. Indeed, it’s not currently possible to use `PartialDerivatesEquations`

class with a `SpacecraftState`

built from `AbsPVCoodinates`

.

We will add in the next version of Orekit (i.e. 10.2) a new feature allowing to use `PartialDerivativesEquations`

class with a `SpacecraftState`

built from `AbsPVCoordinated`

. Probably, it will be a new class. Something like `AbsPartialDerivativesEquations`

. This feature is currently available on Vincent Mouraux’s Orekit projet (on its cr3bp branch). It will be soon added to the main Orekit project.

What you can try in the meantime, is to use `DerivativeStructure`

features of Orekit. If you want an example on how to use it, you can have a look on MaximeJ’s post here. In its post, he gives a small scrip explaining how to compute a Jacobian Matrix using DerivativeStructure features. You have just to use `AbsPVCoordinates`

instead of `Orbit`

to build your `SpacecraftState`

.

Kind regards,

Bryan

Though I haven’t tried it, I think it would also work to just use a `CartesianOrbit`

to initialize and to propagate in Cartesian elements.

Hi all,

Thank you very much for your answers, I’ve started implementing it but I still struggle on one part of the derivatives: as I’ve set the thrust as a ParameterDriver I also want to compute the derivatives of the thrust magnitude with respect to the positions and velocities only: dT/dx; dT/dy; dT/dz; dT/dVx etc.

What is the best way to compute these derivatives based on the example you sent? Would it be adding an extra element to the stateVector getting the norm of the thrust and applying the same logic?

Thank you!

B.

Hi benoist,

Are you using the “Field Propagation” from the example or the new `AbsolutePartialDerivativesEquations`

class ?

If you’re using the field propagation you will probably be stuck. I don’t think you can “field” the parameters of a force model, but maybe someone here will prove me wrong.

If you’re using the `cr3bp`

branch and the class AbsolutePartialDerivativesEquations, the computation of these derivatives should be done automatically and you’ll get them inside the dYdP array when calling `AbsolutePartialDerivativesEquations#getMapper().getParametersJacobian(final SpacecraftState state, final double[][] dYdP)`

.

Have a good day,

Maxime

Hi all,

I think I’ll go with the solution integrating the `cr3bp`

branch, sounds way easier. It’s a very basic question but how do I integrate the branch within my workspace on Eclipse? I’m only used to importing the compiled .jar file but have never tried integrating an external “raw” repository.

Thank you very much for your help.

Kind regards,

B.

Hi @benoist,

Please note that the cr3bp branch as been merged into the develop branch. Therefore, the cr3bp branch does no longer exists.

If you still want to use a .jar, you can access to the last .jar generated in the Nexus repository of Orekit by clicking here. The .jar will includes the features about the cr3bp.

Regards,

Bryan

Okay great, thank you very much !

B.

Hi Bryan,

I’ve downloaded the version you mentioned and everything seems to work just fine for the partial derivatives. Nevertheless I still get an error when it comes to propagate the state.

I feel like it is due to the fact that I’m using a `NumericalPropagator`

which I define as follow, with `orbitType = OrbitType.CARTESIAN`

and `angleType = PositionAngle.TRUE`

:

```
public NumericalPropagator setUpRK4Propagator(OrbitType orbitType, PositionAngle angleType, double stepSize, ForceModel ... models) throws OrekitException {
final double step = stepSize;
NumericalPropagator p = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(step));
p.setOrbitType(orbitType);
p.setPositionAngleType(angleType);
for (ForceModel model : models) {
p.addForceModel(model);
}
return p;
}
```

And then I’m initializing the propagator with `AbsolutePVCoordinates`

:

```
AbsolutePVCoordinates pvc = new AbsolutePVCoordinates(iniState.getFrame(), pvCoordinates);
propagator.setInitialState(new SpacecraftState(pvc));
```

But I get the following error once I try propagating:

```
Exception in thread "main" org.orekit.errors.OrekitIllegalStateException: orbit not defined, state rather contains an absolute position-velocity-acceleration
at org.orekit.propagation.SpacecraftState.getOrbit(SpacecraftState.java:577)
at org.orekit.propagation.numerical.NumericalPropagator$OsculatingMapper.mapStateToArray(NumericalPropagator.java:458)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.createInitialState(AbstractIntegratedPropagator.java:514)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:457)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:414)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:397)
```

Should I be using another class of Propagator? My goal is to handle trajectories around Lagrangian points where orbits cannot be defined with keplerian or equinoctial parameters.

Would you know where my error is coming from?

Thank you very much!

Kind regards,

B.

As your are using AbsolutePVCoordinates, you cannot define an orbit and a position angle. What you have to do first is to remove `p.setPositionAngleType(angleType)`

and use:

```
p.setOrbitType(null);
```

Moreover, as you want to handle trajectories around Lagrangian points, you can also use:

```
p.setIgnoreCentralAttraction(true);
```

Finally, you will find some interesting examples in the Orekit tutorial project. Especially in the propagation.cr3bp package. If think that EarthMoonHaloOrbit and PropagationInCR3BP examples can help you.

Regards,

Bryan

Hi Bryan,

Thank you very much I think that will help me a lot!

I was looking into the examples you mentionned and I had a quick question on how PV is defined using the CR3BP package. I understand the position is normalized using the characteristic length of the system. But I couldn’t see if any normalization is used for the velocity?

Kind regards,

B.