Event detectors for implementations of FieldPropagator

Hi everyone,

I am trying to pass an event detector (not sure it is of the right Field class but that should create a different error) to objects than can be FieldKeplerianPropagator, FieldDSSTPropagator or FieldNumericalPropagator for example.
However I get this:

AttributeError: ‘super’ object has no attribute ‘addEventDetector’

I have tried casting into various classes with no success. Any ideas?

Cheers,
Romain.

Hi,

I would assume the propagator should be casted to a FieldPropagator and then the addEventDetector should be available? (should…)

Hi Petrus,

That seemed to do the trick, thanks.
I am now struggling with the actual detector though. Let’s say the original object is an ImpulseManeuver based on a DateDetector.
To pass it to a FieldPropagator, do I need to use a FieldDateDetector and if yes how? I can’t do ImpulseManeuver<FieldDateDetector> in Python I believe.

Cheers,
Romain.

An update:

  • of_ can be used to specify generics in Python, however it is of no use for me here because there is an error before when the constructor of ImpulseManeuver fails (see message below)
  • the Python docstring of ImpulseManeuver seems wrong, as the first argument is labelled as an ImpulseManeuver, while it should be an EventDetector or something no @petrus.hyvonen?

Anyway I’m unable to instantiate ImpulseManeuver with a FieldDateDetector (while it works fine with a DateDetector):

orekit.InvalidArgsError: (<class ‘org.orekit.forces.maneuvers.ImpulseManeuver’>, ‘init’, (<FieldDateDetector: org.orekit.propagation.events.FieldDateDetector@726dd367>, <AttitudeProvider: org.orekit.attitudes.LofOffset@1f4de96e>, <Vector3D: {0; 1; 0}>, 500.0))

Romain.

Hi,

Not sure I can help much, but in case you have not seen it there are a few examples using field propagation in the python test suite: orekit_python_artifacts/test at version-11.3 · petrushy/orekit_python_artifacts · GitHub

The docstring (which are automatically generated) is a bit odd yes, but there must be something with the generic types in Java that gives this. The java class is:

public class ImpulseManeuver extends AbstractDetector<ImpulseManeuver>

This is a bit of a spell for me, but what I can understand the ImpulseManouever shouldn’t need to be art of the first (generic) type. But the python docstrings are just for guidance, the core is following the java implementation.

Have you tried to “_of(EventDetector)” of the FieldDateDetector?

The first argument of ImpulseManeuver is indeed an EventDetector. However, FieldDateDetector is a FieldEventDetector, not an EventDetector. That’s why you have the InvalidArgsError.

They are some solutions:

  1. Use DateDetector instead of FieldDateDetector to create the ImpulseManeuver detector.
  2. Implement a FieldImpulseManeuver class which takes a FieldEventDetector as first argument.

Looking at the signature of addEventDetector() method of FieldPropagator, which requires a FieldEventDetector, maybe the second solution should be privileged.

Best regards,
Bryan

Hi Petrus and Bryan,

first of all thank you both for your answers, I appreciate the time!

The docstring (which are automatically generated) is a bit odd yes, but there must be something with the generic types in Java that gives this.

I did suspect that it was generated automatically. Having docstring for the Python wrapper is actually pretty awesome. I remember a time when there was none (or at least PyCharm wouldn’t see it), making it basically impossible to program without having the Java project open on one screen.

Have you tried to “_of(EventDetector)” of the FieldDateDetector?

I hadn’t before you suggested it, but it doesn’t work, good try :wink:

  1. Use DateDetector instead of FieldDateDetector to create the ImpulseManeuver detector.

I did try that but then as you feared, the call to addEventDetector fails.

  1. Implement a FieldImpulseManeuver class which takes a FieldEventDetector as first argument.

I will do that when I get the time, thanks. It’s just a bit of a shame that there is no readily available way of doing this in Orekit already, after all who doesn’t want impulsive maneuvers within a FieldPropagator? :sweat_smile:

Cheers,
Romain.

1 Like

Hi all,

Quick question: if we add a FieldImpulseManeuver with a FieldEventDetector but also a FieldVector3D deltaVsat attribute, can we get the effect of the \Delta{V} on the final spacecraft state ?

Usually, for any other type of event, I would say no but since the purpose of the (Field)ImpulseManeuver is to reset the spacecraft state for the integrator I’m wondering if it wouldn’t work.

Hi everyone,

I am still very interested in a potential FieldImpulsiveManeuver class and I do think it could benefit other Orekit users. Should I open an issue?
@MaximeJ I believe that whatever information you put in the FieldVector3D will be propagated consistently yes.

Cheers,
Romain.

Hi @Serrof ,

I also think that it would be very beneficial to add this FieldImpulsiveManeuver. You should indeed open an issue about it :+1:.

Cheers,
Vincent

1 Like