00001 00002 00008 /* \todo Fix propagate & resizing of the attitude history 00009 * \todo Implement History object that stores the state and history dependent on the parameters being stored (by registering variables?) 00010 */ 00012 00013 #include "Attitude.h" 00014 #include "RungeKutta.h" 00015 00016 00017 namespace O_SESSAME { 00018 00019 Attitude::Attitude(): m_AttitudeState(), m_ControlTorques(3), m_pPropagator(NULL), m_Parameters(), m_pEnvironment(NULL), m_AttitudeHistory() 00020 { 00021 00022 } 00023 00024 Attitude::~Attitude() 00025 { 00032 } 00033 00034 void Attitude::SetStateObject(const AttitudeState &_newAttitudeState) 00035 { 00036 m_AttitudeState = _newAttitudeState; 00037 } 00038 00039 AttitudeState Attitude::GetStateObject() const 00040 { 00041 return m_AttitudeState; 00042 } 00043 00044 void Attitude::SetPropagator(Propagator *_propagator) 00045 { 00046 m_pPropagator = _propagator; 00047 m_pPropagator->SetAttitudeObject(this); 00048 return; 00049 } 00050 00051 odeFunctor Attitude::GetDynamicsEq() const 00052 { 00053 return m_AttDynEqFuncPtr; 00054 } 00055 00056 void Attitude::SetDynamicsEq(odeFunctor _AttDynEqFuncPtr) 00057 { 00058 m_AttDynEqFuncPtr = _AttDynEqFuncPtr; 00059 m_Integrateable = true; 00060 return; 00061 } 00062 00063 void Attitude::SetStateConversion(IntegratedAttitudeStateConversionFunction _ConversionFunction) 00064 { 00065 m_AttitudeStateConversionFunction = _ConversionFunction; 00066 } 00067 00068 IntegratedAttitudeStateConversionFunction Attitude::GetStateConversion() const 00069 { 00070 return m_AttitudeStateConversionFunction; 00071 } 00072 00073 void Attitude::SetControlTorques(const Vector &_ControlTorques) 00074 { 00076 m_ControlTorques.initialize(_ControlTorques); 00077 return; 00078 } 00079 Vector Attitude::GetControlTorques() const 00080 { 00081 return m_ControlTorques; 00082 } 00083 00084 void Attitude::SetParameters(const Matrix &_Parameters) 00085 { 00086 m_Parameters.initialize(_Parameters); 00087 } 00088 00089 Matrix Attitude::GetParameters() const 00090 { 00091 return m_Parameters; 00092 } 00093 00094 Matrix Attitude::Propagate(const vector<ssfTime> &_propTime) 00095 { 00096 cout << "Begin propagating... " << endl; 00097 m_pPropagator->Propagate(_propTime); 00098 // Store the propagated states 00099 return Matrix(3,3); 00100 } 00101 00102 bool Attitude::IsIntegrateable() 00103 { 00104 return m_Integrateable; 00105 } 00106 00107 // ***************************** 00108 // ******** ENVIRONMENT ******** 00109 // ***************************** 00110 void Attitude::SetEnvironment(Environment *_pEnvironment) 00111 { 00112 m_pEnvironment = _pEnvironment; 00113 m_EnvironmentForcesFunctor.Set(m_pEnvironment, &Environment::GetTorques); 00114 } 00115 00116 Environment* Attitude::GetEnvironment() const 00117 { 00118 return m_pEnvironment; 00119 } 00120 00121 ObjectFunctor<Environment> Attitude::GetEnvironmentForcesFunctor() 00122 { 00123 return m_EnvironmentForcesFunctor; 00124 } 00125 00126 // ************************* 00127 // ******** HISTORY ******** 00128 // ************************* 00129 AttitudeHistory& Attitude::GetHistoryObject() 00130 { 00131 return m_AttitudeHistory; 00132 } 00133 00134 } // close namespace O_SESSAME 00135 00136 // Do not change the comments below - they will be added automatically by CVS 00137 /***************************************************************************** 00138 * $Log: Attitude.cpp,v $ 00139 * Revision 1.10 2003/06/10 14:51:41 nilspace 00140 * Changed GetHistory to GetHistoryObject 00141 * 00142 * Revision 1.9 2003/05/20 17:46:25 nilspace 00143 * Updated comments. 00144 * 00145 * Revision 1.8 2003/04/28 20:12:44 nilspace 00146 * GetHistory return by reference. 00147 * 00148 * Revision 1.7 2003/04/28 14:29:18 nilspace 00149 * Added data member constructor calls in default constructor. 00150 * 00151 * Revision 1.6 2003/04/27 22:11:51 nilspace 00152 * Moved all of the function definitions out of the class interface definition. 00153 * 00154 * Revision 1.5 2003/04/27 22:04:31 nilspace 00155 * Created the namespace O_SESSAME. 00156 * 00157 * Revision 1.4 2003/04/25 13:44:58 nilspace 00158 * Updated to work with current History, Environment & Propagator objects. 00159 * 00160 * Revision 1.3 2003/04/23 21:54:32 nilspace 00161 * Updated to work with AttitudeState, Environment. 00162 * Removed the setting and getting of AngVel, AngAccel, Rotation. 00163 * 00164 * Revision 1.2 2003/04/23 16:30:58 nilspace 00165 * Various bugfixes & uploading of all changed code for new programmers. 00166 * 00167 * Revision 1.1 2003/04/08 22:51:24 nilspace 00168 * Initial submission in new directory. 00169 * 00170 ******************************************************************************/