org.orekit.attitudes
Class AttitudeLegsSequence

java.lang.Object
  extended by org.orekit.attitudes.AttitudeLegsSequence
All Implemented Interfaces:
Serializable, AttitudeLeg, AttitudeProvider

public final class AttitudeLegsSequence
extends Object
implements AttitudeLeg

This class handles a sequence of different attitude providers AttitudeLeg.

This class is different from the AttitudesSequence class in Orekit because even if they both represent a sequence of attitude laws, AttitudeLegsSequence contains attitude laws version "Attitude", while AttitudesSequence contains attitude laws version "Orbit determination"; moreover, AttitudeLegsSequence does not perform events detection between two consecutive attitude laws. This class implements AttitudeLeg, so it can be used as one.

VERY IMPORTANT NOTICE : this class breaches the contract for AttitudeLeg : the PVCoordinatesProvider parameter in the getAttitude() calls is never used, the instance uses the inner PVCoordinatesProvider instead. This breach was necessary; it ensures the consistency between the attitude law legs and the slews between them. Indeed, to avoid performances problems, the slews are built and computed given a specific PVCoordinatesProvider. Therefore, all inner AttitudeLeg instances use the same PVCoordinatesProvider instance.

Since:
1.1
Version:
$Id: AttitudeLegsSequence.java 17582 2017-05-10 12:58:16Z bignon $
Author:
cardosop
See Also:
Serialized Form
Concurrency :
not thread-safe
Concurrency comment :
The instances are mutable.

Constructor Summary
AttitudeLegsSequence(PVCoordinatesProvider pvcp)
          Only constructor for this class.
 
Method Summary
 void add(String code, AttitudeLeg leg)
          Adds an AttitudeLeg instance to the sequence, with conditions.
The conditions are : A new instance can only be inserted at the beginning or the end of the sequence (except the first one of course).
 Attitude getAttitude(Orbit orbit)
          Compute the attitude corresponding to an orbital state.
 Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame)
          Gets the attitude from the sequence.
The AttitudeLeg matching the date is called to compute the attitude.
 AttitudeLeg getAttitudeLeg(AbsoluteDate date)
          Gets the AttitudeLeg corresponding to the date.
 AttitudeLeg getAttitudeLeg(String code)
          Get the attitude leg in the sequence with the selected code.
 AttitudeLeg getFirstAttitudeLeg()
          Gets the first leg.
 AttitudeLeg getLastAttitudeLeg()
          Gets the last leg.
 AttitudeLeg getNextAttitudeLeg(AttitudeLeg law)
          Gets the next attitude law after the selected AttitudeLeg law.
 AttitudeLeg getNextAttitudeLeg(String law)
          Gets the next attitude law after the AttitudeLeg law with the selected code.
 Attitude getOldAttitudeOnTransition(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame)
          Returns the attitude at a transition date for the old attitude law (the law previous to the valid transition law).
 AttitudeLeg getPreviousAttitudeLeg(AttitudeLeg law)
          Gets the previous attitude law before the selected AttitudeLeg law.
 AttitudeLeg getPreviousAttitudeLeg(String law)
          Gets the previous attitude law before the selected AttitudeLeg law.
 LinkedHashMap<String,AttitudeLeg> getSequence()
          Returns a copy of the map containing of all AttitudeLeg instances.
 AbsoluteDateInterval getTimeInterval()
          Return the time interval of validity
 boolean isEmpty()
          Returns true if the sequence is empty.
 void setSpinDerivativesComputation(boolean computeSpinDerivatives)
          Method to activate spin derivative computation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttitudeLegsSequence

public AttitudeLegsSequence(PVCoordinatesProvider pvcp)
Only constructor for this class. A PVCoordinatesProvider is needed.

Parameters:
pvcp - the PVCoordinates instances that all AttitudeLeg providers are meant to use.
Method Detail

getAttitude

public Attitude getAttitude(PVCoordinatesProvider pvProv,
                            AbsoluteDate date,
                            Frame frame)
                     throws OrekitException
Gets the attitude from the sequence.
The AttitudeLeg matching the date is called to compute the attitude. If none is found, an OrekitException is thrown.
If two laws are juxtaposed at the given date, the SECOND law is the valid one.
VERY IMPORTANT : the PVCoordinatesProvider parameter is IGNORED (see class comment).
The derivation order is : velocity.

Specified by:
getAttitude in interface AttitudeProvider
Parameters:
pvProv - unused provider, can be null. See class comments.
date - the date for which the attitude is computed
frame - the frame for which the attitude is computed
Returns:
the attitude
Throws:
OrekitException - if the date is out of the sequence's range.

getTimeInterval

public AbsoluteDateInterval getTimeInterval()
Description copied from interface: AttitudeLeg
Return the time interval of validity

Specified by:
getTimeInterval in interface AttitudeLeg
Returns:
time interval of validity

setSpinDerivativesComputation

public void setSpinDerivativesComputation(boolean computeSpinDerivatives)
Method to activate spin derivative computation.

Spin derivatives computation does not apply to provided laws. Call setSpinDerivativesComputation(boolean) on each law to activate/deactivate underlying law spin derivative computation.

Specified by:
setSpinDerivativesComputation in interface AttitudeProvider
Parameters:
computeSpinDerivatives - true if spin derivatives should be computed

getSequence

public LinkedHashMap<String,AttitudeLeg> getSequence()
Returns a copy of the map containing of all AttitudeLeg instances. (the instances themselves are not copies however).

Returns:
a copy of the map of all AttitudeLeg instances

add

public void add(String code,
                AttitudeLeg leg)
         throws OrekitException
Adds an AttitudeLeg instance to the sequence, with conditions.
The conditions are : If the AttitudeLeg instance does not match these conditions, an IllegalArgumentException will be raised.

Parameters:
code - the code of the attitude leg to be added to the sequence
leg - the attitude leg to be added to the sequence
Throws:
OrekitException - if the AttitudeLeg is a non computed slew
IllegalArgumentException - if the attitude leg does not match the conditions

isEmpty

public boolean isEmpty()
Returns true if the sequence is empty.

Returns:
true if the sequence is empty.

getFirstAttitudeLeg

public AttitudeLeg getFirstAttitudeLeg()
Gets the first leg.

Returns:
the first leg of the sequence if the sequence is empty.

getLastAttitudeLeg

public AttitudeLeg getLastAttitudeLeg()
Gets the last leg.

Returns:
the last leg of the sequence if the sequence is empty.

getNextAttitudeLeg

public AttitudeLeg getNextAttitudeLeg(AttitudeLeg law)
                               throws OrekitException
Gets the next attitude law after the selected AttitudeLeg law.

Parameters:
law - the previous AttitudeLeg
Returns:
the next AttitudeLeg
Throws:
OrekitException - attitude exception

getNextAttitudeLeg

public AttitudeLeg getNextAttitudeLeg(String law)
                               throws OrekitException
Gets the next attitude law after the AttitudeLeg law with the selected code.

Parameters:
law - the code of the previous AttitudeLeg
Returns:
the next AttitudeLeg
Throws:
OrekitException - attitude exception

getPreviousAttitudeLeg

public AttitudeLeg getPreviousAttitudeLeg(AttitudeLeg law)
                                   throws OrekitException
Gets the previous attitude law before the selected AttitudeLeg law.

Parameters:
law - the next AttitudeLeg
Returns:
the previous AttitudeLeg
Throws:
OrekitException - attitude exception

getPreviousAttitudeLeg

public AttitudeLeg getPreviousAttitudeLeg(String law)
                                   throws OrekitException
Gets the previous attitude law before the selected AttitudeLeg law.

Parameters:
law - the next AttitudeLeg
Returns:
the previous AttitudeLeg
Throws:
OrekitException - attitude exception

getOldAttitudeOnTransition

public Attitude getOldAttitudeOnTransition(PVCoordinatesProvider pvProv,
                                           AbsoluteDate date,
                                           Frame frame)
                                    throws OrekitException
Returns the attitude at a transition date for the old attitude law (the law previous to the valid transition law).

Parameters:
pvProv - unused provider, can be null. See class comments.
date - the date for which the attitude is computed
frame - the frame for which the attitude is computed
Returns:
the attitude of the previous attitude law at the transition date.
Throws:
OrekitException - attitude exception

getAttitudeLeg

public AttitudeLeg getAttitudeLeg(AbsoluteDate date)
                           throws OrekitException
Gets the AttitudeLeg corresponding to the date. If date corresponds to the limit of an interval, the second law is returned.

Parameters:
date - the date at which you want the AttitudeLeg
Returns:
the corresponding AttitudeLeg
Throws:
OrekitException - attitude exception

getAttitudeLeg

public AttitudeLeg getAttitudeLeg(String code)
                           throws OrekitException
Get the attitude leg in the sequence with the selected code.

Parameters:
code - the code
Returns:
the attitude leg with the input code
Throws:
OrekitException - when the law with the selected code is not in the sequence

getAttitude

public Attitude getAttitude(Orbit orbit)
                     throws OrekitException
Compute the attitude corresponding to an orbital state.

Specified by:
getAttitude in interface AttitudeProvider
Parameters:
orbit - current orbit
Returns:
attitude attitude on the current orbit
Throws:
OrekitException - if attitude cannot be computed


Copyright © 2017 CNES. All Rights Reserved.