00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file AttitudeState.h 00003 * \brief Interface to the AttitudeState class. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.2 $ 00006 * \date $Date: 2005/06/10 12:53:25 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /* 00009 * 00010 */ 00011 ////////////////////////////////////////////////////////////////////////////////////////////////// 00012 00013 #ifndef __SSF_ATTITUDE_STATE_H__ 00014 #define __SSF_ATTITUDE_STATE_H__ 00015 00016 #include <matrix/Matrix.h> 00017 #include <rotation/Rotation.h> 00018 00019 namespace O_SESSAME { 00020 typedef int AttitudeFrame; /** \todo Implement AttitudeFrame class */ 00021 class OrbitState; 00022 00023 /*! \brief Encapsulation of an Attitude State, including its coordinate type and reference frame. 00024 * \ingroup AttitudeToolkit 00025 * 00026 * \detail AttitudeState encapsulates an instantaneous representation of an attitude, as well as 00027 * the frame from which it is referenced. Also included is all the functionality for converting 00028 * between the frames and accessing or changing the associated rotation. 00029 * 00030 * \par Examples: 00031 \code 00032 AttitudeState satAtt; 00033 Vector AngVel(3); AngVel(1) = 0.1; 00034 satAtt.SetRotation(Rotation(Quaternion(0,0,0,1))); 00035 satAtt.SetFrame(new AttitudeFrameBO); 00036 satAtt.GetFrame()->SetReference(satOrbitState); 00037 satAtt.SetAngularVelocity(AngVel); 00038 00039 cout << satAtt.GetRotation().GetDCM() << endl; 00040 \endcode 00041 00042 * \example testAttitudeIntegration.cpp 00043 * \example testPropagation.cpp 00044 */ 00045 class AttitudeState 00046 { 00047 public: 00048 /*! \brief Default Constructor. 00049 */ 00050 AttitudeState(); 00051 /*! \brief Default Deconstructor. 00052 */ 00053 virtual ~AttitudeState(); 00054 00055 /*! \brief Creates an attitude state given a rotation and attitude frame (defaults to no frame) 00056 * @param _Rot rotation to be stored 00057 * @param _pAttFrame pointer to the attitude reference frame 00058 */ 00059 AttitudeState(const Rotation &_Rot, AttitudeFrame* _pAttFrame = NULL); 00060 00061 /*! \brief Creates an attitude state given a rotation, an angular velocity and attitude frame (defaults to no frame) 00062 * @param _Rot rotation to be stored 00063 * @param _AngVel angular velocity (rad/s) 00064 * @param _pAttFrame pointer to the attitude reference frame 00065 */ 00066 AttitudeState(const Rotation &_Rot, const Vector &_AngVel, AttitudeFrame* _pAttFrame = NULL); 00067 00068 /*! \brief Set the reference frame of the stored attitude. 00069 * \detail Will convert the old rotation to the new attitude frame if one was specified. 00070 * @param _pNewAttitudeFrame pointer to the new reference frame 00071 */ 00072 void SetAttitudeFrame(AttitudeFrame* _pNewAttitudeFrame); 00073 00074 /*! \brief Returns a pointer to the attitude reference frame. 00075 * @return pointer to the attitude reference frame 00076 */ 00077 AttitudeFrame* GetAttitudeFrame() const; 00078 00079 /*! \brief Set the attitude state given a rotation, an angular velocity and attitude frame (defaults to no frame) 00080 * @param _Rot rotation to be stored 00081 * @param _AngVel angular velocity (rad/s) 00082 * @param _pAttFrame pointer to the attitude reference frame 00083 */ 00084 void SetState(const Rotation& _Rotation, const Vector& _AngVel, AttitudeFrame* _attFrame = NULL); 00085 00086 /*! \brief Return the attitude state rotation in vector format. 00087 * @param _rotType Rotation type to return the attitude state in (ie QUAT_TYPE, MRP_TYPE, etc.) 00088 * @param _attFrame corresponding reference frame to return the rotation in (if none is specified, returns the rotation in the stored reference frame) 00089 * @param _Sequence if the requested rotation type is EULER_ANGLE_TYPE, then specify the desired rotation sequence. 00090 * @return full n x 1 vector of state values corresponding to the rotation and angular velocity components (n is the number of elements in specified rotation return type) 00091 */ 00092 Vector GetState(const RotationType& _rotType = Quaternion_Type, AttitudeFrame* _attFrame = NULL, const int& _Sequence = 123) const; 00093 00094 /*! \brief Set the stored rotation. 00095 * @param _Rot rotation to be stored as the state. 00096 */ 00097 void SetRotation(const Rotation &_Rot); 00098 00099 /*! \brief Set the stored rotation and corresponding reference frame. 00100 * @param _Rot rotation to be stored as the state. 00101 * @param _pAttFrame reference frame of the specified attitude. 00102 */ 00103 void SetRotation(const Rotation &_Rot, AttitudeFrame* _pAttFrame); 00104 00105 /*! \brief Returns the current rotation of the attitude state. 00106 * @param Rotation of the attitude state. 00107 */ 00108 Rotation GetRotation() const; 00109 00110 /*! \brief Set the stored angular velocity state. 00111 * @param _angVel 3x1 Vector of angular velocities about reference frame (rad/s) 00112 */ 00113 void SetAngularVelocity(const Vector &_angVel); 00114 00115 /*! \brief Returns the stored angular velocity state. 00116 * @return 3x1 Vector of angular velocities about reference frame (rad/s) 00117 */ 00118 Vector GetAngularVelocity() const; 00119 00120 /*! \brief Calculates the rotation from the current attitude state to the specified orbit reference frame. 00121 * 00122 * \todo Implement algorithm. 00123 * @param _orbState orbit state to use for specifying the reference orbital frame. 00124 * @return Rotation from current attitude frame to orbital frame. 00125 */ 00126 Rotation GetRotation2Orbital(const OrbitState& _orbState) const; 00127 00128 private: 00129 Rotation m_AttitudeRotation; /*!< internally stored attitude state rotation */ 00130 Vector m_AngularVelocity; /*!< internally stored angular velocity */ 00131 AttitudeFrame* m_pAttitudeFrame; /*!< rotation reference frame */ 00132 }; 00133 00134 } // close namespace O_SESSAME 00135 #endif 00136 00137 // Do not change the comments below - they will be added automatically by CVS 00138 /***************************************************************************** 00139 * $Log: AttitudeState.h,v $ 00140 * Revision 1.2 2005/06/10 12:53:25 jayhawk_hokie 00141 * Changed header file format to make it easier to link to the spacecraft code by only having to specify dsacss/dep/spacecraft/src (ex. "file.h" changed to <dir/file.h> where dir is a folder in src). 00142 * 00143 * Revision 1.1.1.1 2005/04/26 17:40:56 cakinli 00144 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00145 * 00146 * Revision 1.8 2003/10/18 21:37:27 rsharo 00147 * Removed "../utils" from all qmake project paths. Prepended "utils 00148 * /" to all #include directives for utils. Removed ".h" extensions from STL header 00149 * s and referenced STL components from "std::" namespace. Overall, changed to be 00150 * more portable. 00151 * 00152 * Revision 1.7 2003/06/12 23:07:08 nilspace 00153 * Fixed to calculate Orbital rotation. 00154 * 00155 * Revision 1.6 2003/06/12 17:59:35 nilspace 00156 * Added GetRotation2Orbit function. 00157 * 00158 * Revision 1.5 2003/05/20 17:46:25 nilspace 00159 * Updated comments. 00160 * 00161 * Revision 1.4 2003/05/13 18:50:24 nilspace 00162 * Fixed comments. 00163 * 00164 * Revision 1.3 2003/04/27 22:04:31 nilspace 00165 * Created the namespace O_SESSAME. 00166 * 00167 * Revision 1.2 2003/04/23 16:30:58 nilspace 00168 * Various bugfixes & uploading of all changed code for new programmers. 00169 * 00170 * Revision 1.1 2003/04/08 22:51:24 nilspace 00171 * Initial submission in new directory. 00172 * 00173 ******************************************************************************/