Hi @Giacomo
There is an interesting workaround to try. Because you have only have two spacecrafts, you can use the first one as a classical Propagator performing the orbit propagation and the second one as a PVCoordinatesProvider
to compute the angular separation.
Let MinimumSeparationDetector
be the detector you want. You can imagine something like that:
public class MinimumSeparationDetector extends AbstractDetector<MinimumSeparationDetector> {
/** PV Coordinates provider for the second satellite. */
private final PVCoordinatesProvider secondarySatellite;
/** Constructor. */
public MinimumSeparationDetector(final PVCoordinatesProvider secondarySatellite) {
this(DEFAULT_MAXCHECK, DEFAULT_THRESHOLD, secondarySatellite);
}
/** Constructor. */
public MinimumSeparationDetector(final double maxCheck, final double threshold,
final PVCoordinatesProvider secondarySatellite) {
this(maxCheck, threshold, DEFAULT_MAX_ITER, new StopOnIncreasing<ElevationExtremumDetector>(),
secondarySatellite);
}
/** Constructor. */
private MinimumSeparationDetector(final double maxCheck, final double threshold,
final int maxIter, final EventHandler<? super ElevationExtremumDetector> handler,
final PVCoordinatesProvider secondarySatellite) {
super(maxCheck, threshold, maxIter, handler);
this.secondarySatellite = secondarySatellite;
}
public double g(final SpacecraftState s) {
final TimeStampedPVCoordinates pvSecondary = secondarySatellite.getPVCoordinates(s.getDate(), s.getFrame());
final FieldPVCoordinates<UnivariateDerivative1> pvSecondaryUD1 = pvOtherInS.toUnivariateDerivative1PV();
final FieldPVCoordinates<UnivariateDerivative1> pvPrimaryUD1 = s.getPVCoordinates().toUnivariateDerivative1PV();
final UnivariateDerivative1 angle = ... // Compute the angle
return angle.getDerivative(1);
}
Beware, I have just written this code snippet in the forum editor, it is not validated and I probably made some syntax errors.
In the code above, s
represents the spacecraft state of the primary satellite, computed by the orbit propagator, and the secondary satellite is represented by the PVCoordinatesProvider. The advantage of using PVCoordinatesProvider
is that this interface is implemented by all the Orekit’s orbit propagators. Therefore, you can use the orbit propagator of you second satellite to initialize the MinimumSeparationDetector
.
// Initialize the propagators (the ones used in your application to initialize the PropagatorParallelizer)
final Propagator sat1 = ...
final Propagator sat2 = ...
// Add the event detector to the first propagator (you can customize the detector like any Orekit detectors before adding it to the propagator)
sat1.addEventDetector(new MinimumSeparationDetector(sat2));
// Propagate
final SpacecraftState state = sat1.propagate(targetEpoch); // this should stop a minimum angular separation detection
// Epoch of minimum separation
state.getDate();
I never tried it but I think it can work
I hope this will help you,
Best regards,
Bryan