Hohmann Transfer : Cannot activate second ImpulseManeuver

Hello all,

I am currently working on a OrbitControl/Transfer package and I would like to simply create 2 ImpulsiveManeuvers, for a Hohmann Transfer to give to a KeplerianPropagator. The starting and ending orbits could be two ellipses ( 0< e < 1), so not strictely restricted to circular orbits.
What I want is to activate a second ImpulsiveManeuver at the next apside node (apoapis or periapsis, depending if the first ImpulsiveManeuver was at the apoapis or periapsis), so creating the ImpulsiveManeuver with an apsideDetector, but only to be used once so using an EventEnablingPredicateFilter, with a custom EventEnabler “ManeuverActivator” :

final ManeuverActivator activator = new ManeuverActivator();
      activator.setActivate(true); --> with return true for calling eventIsEnabled

final ManeuverActivator activator2 = new ManeuverActivator();
      activator2.setActivate(false);--> with return false for calling eventIsEnabled

ManeuverActivator is defined following:
ManeuverActivator.java (569 Bytes)

Next :

  // ApsideDetector with a behavior or deactivating first activator and activating second one when apside node is reached 

ApsideDetector apsideDetector = new ApsideDetector(initialOrbit).withHandler((state, detector, increasing) -> {
            activator.setActivate(false); --> deactivate maneuver1 after crossing first Node on increasing
            activator2.setActivate(true); ---> activate maneuver2 after crossing first Node on increasing, should be calculated at the next apside node crossing
            return Action.STOP; --> as apsideDetector is used by ImpulsiveManeuver, the maneuver is activated when the sub-detector is having Action = STOP.
});

maneuver1 = new ImpulseManeuver(apsideDetector, dV1,isp); 
maneuver2 = new ImpulseManeuver(apsideDetector, dV2, isp);

final EventEnablingPredicateFilter filteredManeuver1 = new EventEnablingPredicateFilter(maneuver1, activator);
final EventEnablingPredicateFilter filteredManeuver2 = new EventEnablingPredicateFilter(maneuver2, activator2);

Then we give the two EventEnablingPredicateFilter to a propagator :

final KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit2, attitudeProvider);
      propagator.addEventDetector(filteredManeuver1);
      propagator.addEventDetector(filteredManeuver2);

The 1st ImpulseManeuver is well calculated at the first node crossing, but then the 2nd ImpulseManeuver is not working or not launched, resulting to only a half-Hohmann transfer.

Investigating a bit into the handling of events, the enabler attribute of the EventEnablingPredicateFilter, filteredManeuver2, is first at False then at True after the happening of the 1st Maneuver, which is the behavior expected. However, it seems that the propagator is not considering this new status of the filteredManeuver2 : when enabler is at True, the impulsiveManeuver2 should be activated at the next apside node.

If anyone has a better understanding of the handling of events in Orekit, so I could resolve this problem and after create generic classes to handle linked Events, I would appreciate any help :slight_smile:

Here is my code to test and reproduce my case (with ManeuverActivator.java)
Hohmann.java (6.3 KB)
HohmannTest.java (11.0 KB)

Cheers,

Julien