Class RelativeDistanceDetector

  • All Implemented Interfaces:
    EventDetector

    public class RelativeDistanceDetector
    extends AbstractDetector<RelativeDistanceDetector>
    Detector of specific value for the distance relative to another trajectory (using the Euclidean norm).

    The default implementation behavior is to stop propagation. This can be changed by calling AbstractDetector.withHandler(EventHandler) after construction.

    As this detector needs two objects (moving relative to each other), it embeds one coordinates provider for the secondary object and is registered as an event detector in the propagator of the primary object. The secondary object coordinates provider will therefore be driven by this detector (and hence by the propagator in which this detector is registered).

    In order to avoid infinite recursion, care must be taken to have the secondary object provider being completely independent from anything else. In particular, if the provider is a propagator, it should not be run together in a propagators parallelizer with the propagator this detector is registered in. It is fine however to configure two separate propagators PsA and PsB with similar settings for the secondary object and one propagator Pm for the primary object and then use Psa in this detector registered within Pm while Pm and Psb are run in the context of a propagators parallelizer.

    For efficiency reason during the event search loop, it is recommended to have the secondary provider be an analytical propagator or an ephemeris. A numerical propagator as a secondary propagator works but is expected to be computationally costly.

    Since:
    12.1
    Author:
    Romain Serra
    See Also:
    Propagator.addEventDetector(EventDetector)
    • Constructor Detail

      • RelativeDistanceDetector

        public RelativeDistanceDetector​(PVCoordinatesProvider secondaryPVProvider,
                                        double distanceThreshold)
        Constructor with default values.

        By default, the implemented behavior is to stop propagation at detection.

        Parameters:
        secondaryPVProvider - PVCoordinates provider of the other object defining relative distance.
        distanceThreshold - Relative distance threshold for event detection
      • RelativeDistanceDetector

        protected RelativeDistanceDetector​(EventDetectionSettings detectionSettings,
                                           EventHandler handler,
                                           PVCoordinatesProvider secondaryPVProvider,
                                           double distanceThreshold)
        Constructor.

        This constructor is to be used if the user wants to change the default behavior of the detector.

        Parameters:
        detectionSettings - Detection settings
        handler - Event handler to call at event occurrences.
        secondaryPVProvider - PVCoordinates provider of the other object defining relative distance.
        distanceThreshold - Relative distance threshold for event detection
        Since:
        12.2
        See Also:
        EventHandler
      • RelativeDistanceDetector

        @Deprecated
        protected RelativeDistanceDetector​(AdaptableInterval maxCheck,
                                           double threshold,
                                           int maxIter,
                                           EventHandler handler,
                                           PVCoordinatesProvider secondaryPVProvider,
                                           double distanceThreshold)
        Deprecated.
        as of 12.2
        Constructor.

        This constructor is to be used if the user wants to change the default behavior of the detector.

        Parameters:
        maxCheck - Maximum checking interval.
        threshold - Convergence threshold (s).
        maxIter - Maximum number of iterations in the event time search.
        handler - Event handler to call at event occurrences.
        secondaryPVProvider - PVCoordinates provider of the other object defining relative distance.
        distanceThreshold - Relative distance threshold for event detection
        See Also:
        EventHandler
    • Method Detail

      • g

        public double g​(SpacecraftState s)
        The g is positive when the relative distance is larger or equal than the threshold, non-positive otherwise.
        Parameters:
        s - the current state information: date, kinematics, attitude
        Returns:
        value of the switching function
      • create

        protected RelativeDistanceDetector create​(AdaptableInterval newMaxCheck,
                                                  double newThreshold,
                                                  int newMaxIter,
                                                  EventHandler newHandler)
        Build a new instance.
        Specified by:
        create in class AbstractDetector<RelativeDistanceDetector>
        Parameters:
        newMaxCheck - maximum checking interval (s)
        newThreshold - convergence threshold (s)
        newMaxIter - maximum number of iterations in the event time search
        newHandler - event handler to call at event occurrences
        Returns:
        a new instance of the appropriate sub-type WARNING: this method will be removed in 13.0. It doesn't have the deprecated annotation because the method is abstract and shall be implemented
      • getSecondaryPVProvider

        public PVCoordinatesProvider getSecondaryPVProvider()
        Get the secondary position-velocity provider stored in this instance.
        Returns:
        the secondary position-velocity provider stored in this instance
      • getDistanceThreshold

        public double getDistanceThreshold()
        Get the relative distance threshold.
        Returns:
        threshold triggering detection