AttitudeState.cpp

Go to the documentation of this file.
00001 
00002 
00008 /* 
00009 *
00010 */
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 {
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 { 
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.5  2003/06/12 23:07:08  nilspace
00107 *       Fixed to calculate Orbital rotation.
00108 *       
00109 *       Revision 1.4  2003/04/27 22:04:31  nilspace
00110 *       Created the namespace O_SESSAME.
00111 *       
00112 *       Revision 1.3  2003/04/23 19:16:35  nilspace
00113 *       Removed default argument for AttitudeState::SetState.
00114 *       
00115 *       Revision 1.2  2003/04/23 16:30:58  nilspace
00116 *       Various bugfixes & uploading of all changed code for new programmers.
00117 *       
00118 *       Revision 1.1  2003/04/08 22:51:24  nilspace
00119 *       Initial submission in new directory.
00120 *       
00121 *
00122 ******************************************************************************/

Generated on Wed Aug 6 12:58:43 2003 for Open-Sessame Framework by doxygen1.3