Class AttitudesSequence

java.lang.Object
org.orekit.attitudes.AttitudesSequence
All Implemented Interfaces:
AttitudeProvider, AttitudeRotationModel, EventDetectorsProvider, ParameterDriversProvider

public class AttitudesSequence extends Object
This classes manages a sequence of different attitude providers that are activated in turn according to switching events. It includes non-zero transition durations between subsequent modes.
Since:
5.1
Author:
Luc Maisonobe
See Also:
  • Constructor Details

    • AttitudesSequence

      public AttitudesSequence()
      Constructor for an initially empty sequence.
  • Method Details

    • addSwitchingCondition

      public <T extends EventDetector> void addSwitchingCondition(AttitudeProvider past, AttitudeProvider future, T switchEvent, boolean switchOnIncrease, boolean switchOnDecrease, double transitionTime, AngularDerivativesFilter transitionFilter, AttitudeSwitchHandler switchHandler)
      Add a switching condition between two attitude providers.

      The past and future attitude providers are defined with regard to the natural flow of time. This means that if the propagation is forward, the propagator will switch from past provider to future provider at event occurrence, but if the propagation is backward, the propagator will switch from future provider to past provider at event occurrence. The transition between the two attitude laws is not instantaneous, the switch event defines the start of the transition (i.e. when leaving the past attitude law and entering the interpolated transition law). The end of the transition (i.e. when leaving the interpolating transition law and entering the future attitude law) occurs at switch time plus transitionTime.

      An attitude provider may have several different switch events associated to it. Depending on which event is triggered, the appropriate provider is switched to.

      If the underlying detector has an event handler associated to it, this handler will be triggered (i.e. its eventOccurred method will be called), regardless of the event really triggering an attitude switch or not. As an example, if an eclipse detector is used to switch from day to night attitude mode when entering eclipse, with switchOnIncrease set to false and switchOnDecrease set to true. Then a handler set directly at eclipse detector level would be triggered at both eclipse entry and eclipse exit, but attitude switch would occur only at eclipse entry. Note that for the sake of symmetry, the transition start and end dates should match for both forward and backward propagation. This implies that for backward propagation, we have to compensate for the transitionTime when looking for the event. An unfortunate consequence is that the eventOccurred method may appear to be called out of sync with respect to the propagation (it will be called when propagator reaches transition end, despite it refers to transition start, as per transitionTime compensation), and if the method returns Action.STOP, it will stop at the end of the transition instead of at the start. For these reasons, it is not recommended to set up an event handler for events that are used to switch attitude. If an event handler is needed for other purposes, a second handler should be registered to the propagator rather than relying on the side effects of attitude switches.

      The smoothness of the transition between past and future attitude laws can be tuned using the transitionTime and transitionFilter parameters. The transitionTime parameter specifies how much time is spent to switch from one law to the other law. It should be larger than the event convergence threshold in order to ensure attitude continuity. The transitionFilter parameter specifies the attitude time derivatives that should match at the boundaries between past attitude law and transition law on one side, and between transition law and future law on the other side. AngularDerivativesFilter.USE_R means only the rotation should be identical, AngularDerivativesFilter.USE_RR means both rotation and rotation rate should be identical, AngularDerivativesFilter.USE_RRA means both rotation, rotation rate and rotation acceleration should be identical. During the transition, the attitude law is computed by interpolating between past attitude law at switch time and future attitude law at current intermediate time.

      Type Parameters:
      T - class type for the switch event
      Parameters:
      past - attitude provider applicable for times in the switch event occurrence past
      future - attitude provider applicable for times in the switch event occurrence future
      switchEvent - event triggering the attitude providers switch
      switchOnIncrease - if true, switch is triggered on increasing event
      switchOnDecrease - if true, switch is triggered on decreasing event
      transitionTime - duration of the transition between the past and future attitude laws
      transitionFilter - specification of transition law time derivatives that should match past and future attitude laws
      switchHandler - handler to call for notifying when switch occurs (may be null)
      Since:
      13.0
    • getEventDetectors

      public Stream<EventDetector> getEventDetectors()
      Description copied from interface: AttitudeProvider
      Get the discrete events related to the model.

      This method is not intended to be called several time, only once by a propagator, as it has the side effect of rebuilding the events detectors when called

      Returns:
      stream of event detectors
    • getFieldEventDetectors

      public <T extends CalculusFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventDetectors(Field<T> field)
      Description copied from interface: AttitudeProvider
      Get the discrete events related to the model.

      This method is not intended to be called several time, only once by a propagator, as it has the side effect of rebuilding the events detectors when called

      Type Parameters:
      T - extends CalculusFieldElement<T>
      Parameters:
      field - field to which the state belongs
      Returns:
      stream of event detectors
    • getSwitches

      public List<AttitudesSequence.Switch> getSwitches()
      Gets a deep copy of the switches stored in this instance.
      Returns:
      deep copy of the switches stored in this instance
    • resetActiveProvider

      public void resetActiveProvider(AttitudeProvider provider)
      Reset the active provider.

      Calling this method clears all already seen switch history, so it should not be used during the propagation itself, it is intended to be used only at start

      Parameters:
      provider - provider to activate
    • setActivated

      protected void setActivated(TimeSpanMap<AttitudeProvider> activated)
      Setter for map of activate attitude providers.
      Parameters:
      activated - new map
    • getActivated

      protected TimeSpanMap<AttitudeProvider> getActivated()
      Getter for map of activated attitude providers.
      Returns:
      map of providers
    • getAttitude

      public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame)
      Compute the attitude corresponding to an orbital state.
      Specified by:
      getAttitude in interface AttitudeProvider
      Parameters:
      pvProv - local position-velocity provider around current date
      date - current date
      frame - reference frame from which attitude is computed
      Returns:
      attitude on the specified date and position-velocity state
    • getAttitude

      public <T extends CalculusFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame)
      Compute the attitude corresponding to an orbital state.
      Specified by:
      getAttitude in interface AttitudeProvider
      Type Parameters:
      T - type of the field elements
      Parameters:
      pvProv - local position-velocity provider around current date
      date - current date
      frame - reference frame from which attitude is computed
      Returns:
      attitude on the specified date and position-velocity state
    • getAttitudeRotation

      public Rotation getAttitudeRotation(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame)
      Compute the attitude-related rotation corresponding to an orbital state.
      Specified by:
      getAttitudeRotation in interface AttitudeProvider
      Parameters:
      pvProv - local position-velocity provider around current date
      date - current date
      frame - reference frame from which attitude is computed
      Returns:
      attitude-related rotation on the specified date and position-velocity state
    • getAttitudeRotation

      public <T extends CalculusFieldElement<T>> FieldRotation<T> getAttitudeRotation(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame)
      Description copied from interface: AttitudeProvider
      Compute the attitude-related rotation corresponding to an orbital state.
      Specified by:
      getAttitudeRotation in interface AttitudeProvider
      Type Parameters:
      T - type of the field elements
      Parameters:
      pvProv - local position-velocity provider around current date
      date - current date
      frame - reference frame from which attitude is computed
      Returns:
      rotation on the specified date and position-velocity state
    • getFieldEventDetector

      protected <T extends CalculusFieldElement<T>> FieldEventDetector<T> getFieldEventDetector(Field<T> field, org.orekit.attitudes.AbstractSwitchingAttitudeProvider.AbstractAttitudeSwitch attitudeSwitch)
      Method creating a Field attitude switch from a non-Field one.
      Type Parameters:
      T - field type
      Parameters:
      field - field
      attitudeSwitch - attitude switch
      Returns:
      Field detector