Class AttitudesSwitcher

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

public class AttitudesSwitcher extends Object
This classes manages a sequence of different attitude providers that are activated in turn according to switching events. Changes in attitude mode are instantaneous, so state derivatives need to be reset and the Action returned by the event handler is ignored.
Since:
13.0
Author:
Luc Maisonobe, Romain Serra
See Also:
  • Constructor Details

    • AttitudesSwitcher

      public AttitudesSwitcher()
      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, 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.

      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.

      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
      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
    • 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