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
00026
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 }
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122