Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

AttitudeState.cpp

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file AttitudeState.cpp
00003 *  \brief Implementation of the Attitude State Interface Class.
00004 *  \author $Author: cakinli $
00005 *  \version $Revision: 1.1.1.1 $
00006 *  \date    $Date: 2005/04/26 17:40:55 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
00008 /* 
00009 *
00010 */
00011 //////////////////////////////////////////////////////////////////////////////////////////////////
00012 
00013 #include "AttitudeState.h"
00014 #include "orbitstaterep/Keplerian.h"
00015 #include "OrbitState.h"
00016 namespace O_SESSAME {
00017 AttitudeState::AttitudeState() : m_AngularVelocity(3)
00018 {
00019 
00020 }
00021 AttitudeState::~AttitudeState()
00022 {
00023     /*! \todo delete AttitudeState data members */
00024 /*
00025     if(m_pAttitudeFrame)
00026         delete m_pAttitudeFrame;*/
00027 }
00028 AttitudeState::AttitudeState(const Rotation &_Rot, AttitudeFrame* _pAttFrame)
00029 {
00030     SetRotation(_Rot);
00031     SetAttitudeFrame(_pAttFrame);
00032 }
00033 
00034 AttitudeState::AttitudeState(const Rotation &_Rot, const Vector &_AngVel, AttitudeFrame* _pAttFrame)
00035 {
00036     SetRotation(_Rot);
00037     SetAngularVelocity(_AngVel);
00038     SetAttitudeFrame(_pAttFrame);
00039 }
00040 void AttitudeState::SetAttitudeFrame(AttitudeFrame* _pNewAttitudeFrame)
00041 { /** \todo add conversion of Rotation to the new frame */
00042     m_pAttitudeFrame = _pNewAttitudeFrame;
00043     return;
00044 }
00045 
00046 AttitudeFrame* AttitudeState::GetAttitudeFrame() const
00047 {
00048     return m_pAttitudeFrame;
00049 }
00050 
00051 void AttitudeState::SetRotation(const Rotation &_Rot)
00052 {
00053     m_AttitudeRotation = _Rot;
00054 }
00055 
00056 void AttitudeState::SetRotation(const Rotation &_Rot,  AttitudeFrame* _pAttFrame)
00057 {
00058     SetRotation(_Rot);
00059     SetAttitudeFrame(_pAttFrame);
00060 }
00061 
00062 Rotation AttitudeState::GetRotation() const
00063 {
00064     return m_AttitudeRotation;
00065 }
00066 
00067 void AttitudeState::SetState(const Rotation& _Rotation, const Vector& _AngVel, AttitudeFrame* _attFrame)
00068 {
00069     SetRotation(_Rotation);
00070     SetAngularVelocity(_AngVel);
00071     if(_attFrame)
00072         SetAttitudeFrame(_attFrame);
00073     return;
00074 }
00075 
00076 
00077 Vector AttitudeState::GetState(const RotationType& _rotType, AttitudeFrame* _attFrame, const int& _Sequence) const
00078 {
00079     Vector rotOutput = GetRotation().GetRotation(_rotType, _Sequence);
00080     Vector output(rotOutput.getIndexBound() + m_AngularVelocity.getIndexBound());
00081     output(_(VectorIndexBase, VectorIndexBase + rotOutput.getIndexBound() - 1)) = rotOutput(_);
00082     output(_(VectorIndexBase + rotOutput.getIndexBound(), VectorIndexBase + rotOutput.getIndexBound() + m_AngularVelocity.getIndexBound() - 1)) = m_AngularVelocity(_); 
00083     return output;
00084 }
00085 
00086 void AttitudeState::SetAngularVelocity(const Vector &_angVel)
00087 {
00088     m_AngularVelocity = _angVel;
00089 }
00090 
00091 Vector AttitudeState::GetAngularVelocity() const
00092 {
00093     return m_AngularVelocity;
00094 }
00095 
00096 Rotation AttitudeState::GetRotation2Orbital(const OrbitState& _orbState) const 
00097 {
00098     Keplerian kepElements; kepElements.SetPositionVelocity(_orbState.GetStateRepresentation()->GetPositionVelocity());
00099     return GetRotation() * R3(kepElements.GetLongAscNode()) * R1(kepElements.GetInclination()) * R3(kepElements.GetArgPerigee());
00100 }
00101 
00102 } // close namespace O_SESSAME
00103 // Do not change the comments below - they will be added automatically by CVS
00104 /*****************************************************************************
00105 *       $Log: AttitudeState.cpp,v $
00106 *       Revision 1.1.1.1  2005/04/26 17:40:55  cakinli
00107 *       Adding OpenSESSAME to DSACSS distrib to capture fixed version.
00108 *       
00109 *       Revision 1.5  2003/06/12 23:07:08  nilspace
00110 *       Fixed to calculate Orbital rotation.
00111 *       
00112 *       Revision 1.4  2003/04/27 22:04:31  nilspace
00113 *       Created the namespace O_SESSAME.
00114 *       
00115 *       Revision 1.3  2003/04/23 19:16:35  nilspace
00116 *       Removed default argument for AttitudeState::SetState.
00117 *       
00118 *       Revision 1.2  2003/04/23 16:30:58  nilspace
00119 *       Various bugfixes & uploading of all changed code for new programmers.
00120 *       
00121 *       Revision 1.1  2003/04/08 22:51:24  nilspace
00122 *       Initial submission in new directory.
00123 *       
00124 *
00125 ******************************************************************************/

Generated on Wed Sep 5 12:54:18 2007 for DSACSS Operational Code by  doxygen 1.3.9.1