I am trying to build a Maneuver using two EventBasedManeuver triggers. The first trigger will be one of those already available (such as the apside detector or the node detector) but I would like to have as a stop trigger a “DeltaV” event detector so that, when I reach the desired DeltaV, the maneuver stops.
Does anything like this already exist? In case it doesn’t, is it possible to implement this kind of DeltaV detector using some other already available detectors?
EventBasedManeuver should work in this case.
You can set up any detector as the start one.
For stopping the maneuver, one way to do what you want would be to create a
DateDetector as the stop detector but without any date when creating it (i.e. calling the constructor with just
threshold), and use its
addEventDate method to set up the date at run time calling it from an event handler in the first detector, with an offset to consider maneuver duration. This way, the first detector finds the starting date and then set up the stop time relative to the start date.
Something along these lines:
final double duration = ... compute maneuver duration from ΔV ...
final DateDetector stopDetector = new DateDetector(maxCheck, thresold); // note we do not set any date yet
final AbstractDetector baseStartDetector = ... set up start detector ...
final EventDetector startDetector = baseStartDetector.withHandler((state, detector, increasing) -> stopDetector.addEventDate(state.getDate().shiftedBy(duration));
final EventBasedManeuverTriggers trigger = new EventBasedManeuverTriggers(startDetector, stopDector);