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

Attitude.cpp

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file Attitude.cpp
00003 *  \brief Implementation of the attitude class.
00004 *  \author $Author: cakinli $
00005 *  \version $Revision: 1.1.1.1 $
00006 *  \date    $Date: 2005/04/26 17:40:55 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
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 */ 
00011 //////////////////////////////////////////////////////////////////////////////////////////////////
00012 
00013 #include "Attitude.h"
00014 #include "utils/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 {
00026 /*! \todo determine how to clean up the attitude pointers without leaving references hanging
00027     if(m_pEnvironment)
00028         delete m_pEnvironment;
00029     if(m_pPropagator)
00030         delete m_pPropagator;
00031 */
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 {
00075     /** \todo add error checking */
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.1.1.1  2005/04/26 17:40:55  cakinli
00140 *       Adding OpenSESSAME to DSACSS distrib to capture fixed version.
00141 *       
00142 *       Revision 1.11  2003/10/18 21:37:27  rsharo
00143 *       Removed "../utils" from all qmake project paths. Prepended "utils
00144 *       /" to all #include directives for utils. Removed ".h" extensions from STL header
00145 *       s and referenced STL components from "std::" namespace.  Overall, changed to be
00146 *       more portable.
00147 *       
00148 *       Revision 1.10  2003/06/10 14:51:41  nilspace
00149 *       Changed GetHistory to GetHistoryObject
00150 *       
00151 *       Revision 1.9  2003/05/20 17:46:25  nilspace
00152 *       Updated comments.
00153 *       
00154 *       Revision 1.8  2003/04/28 20:12:44  nilspace
00155 *       GetHistory return by reference.
00156 *       
00157 *       Revision 1.7  2003/04/28 14:29:18  nilspace
00158 *       Added data member constructor calls in default constructor.
00159 *       
00160 *       Revision 1.6  2003/04/27 22:11:51  nilspace
00161 *       Moved all of the function definitions out of the class interface definition.
00162 *       
00163 *       Revision 1.5  2003/04/27 22:04:31  nilspace
00164 *       Created the namespace O_SESSAME.
00165 *       
00166 *       Revision 1.4  2003/04/25 13:44:58  nilspace
00167 *       Updated to work with current History, Environment & Propagator objects.
00168 *       
00169 *       Revision 1.3  2003/04/23 21:54:32  nilspace
00170 *       Updated to work with AttitudeState, Environment.
00171 *       Removed the setting and getting of AngVel, AngAccel, Rotation.
00172 *       
00173 *       Revision 1.2  2003/04/23 16:30:58  nilspace
00174 *       Various bugfixes & uploading of all changed code for new programmers.
00175 *       
00176 *       Revision 1.1  2003/04/08 22:51:24  nilspace
00177 *       Initial submission in new directory.
00178 *
00179 ******************************************************************************/

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