00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file WhorlSim.h 00003 * \brief Provides an encapsulation of a particular simulation run. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.8 $ 00006 * \date $Date: 2007/08/31 16:00:19 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /*! 00009 */ 00010 ////////////////////////////////////////////////////////////////////////////////////////////////// 00011 00012 #ifndef __SSSL_WHORLSIM_H__ 00013 #define __SSSL_WHORLSIM_H__ 00014 00015 #include <Utils/Error.h> 00016 #include <matrix/Matrix.h> 00017 #include <Base/Whorl.h> 00018 #include <string> 00019 #include <map> 00020 00021 // Parsers 00022 #include <dsacssinterface.h> 00023 00024 // Observers 00025 #include <Observer/Observer.h> 00026 #include <Observer/atterrbiasObserver.h> 00027 #include <Observer/DefaultObserver.h> 00028 #include <Observer/AttitudeObserver.h> 00029 #include <Observer/triadObserver.h> 00030 #include <Observer/QuaternionEKFObserver.h> 00031 00032 // Controllers 00033 #include <Controller/Controller.h> 00034 #include <Controller/MWCMGController.h> 00035 #include <Controller/OpenLoopMWController.h> 00036 #include <Controller/DefaultController.h> 00037 #include <Controller/AngularRateController.h> 00038 #include <Controller/MRPTracking.h> 00039 #include <Controller/slidingModeControlMRPMW.h> 00040 00041 // Orbit Observers 00042 #include <OrbitObserver/OrbitObserver.h> 00043 #include <OrbitObserver/GPSObserver.h> 00044 #include <OrbitObserver/OrbitPropObserver.h> 00045 00046 // Orbit Controllers 00047 #include <OrbitController/OrbitController.h> 00048 #include <OrbitController/COENaaszController.h> 00049 00050 00051 using namespace std; 00052 using namespace O_SESSAME; 00053 00054 class WhorlSim { 00055 00056 public: 00057 // Constructor/Deconstructor 00058 WhorlSim( ); 00059 00060 WhorlSim( Whorl* ptr_whorl ); 00061 00062 virtual ~WhorlSim( ); 00063 00064 /*! Initializes the simulator */ 00065 int Initialize( TiXmlHandle handle ); 00066 00067 void SetObserver( TiXmlHandle handle ); 00068 00069 void SetController( TiXmlHandle handle ); 00070 00071 /* Set Orbit Observer for spacecraft navigation */ 00072 void SetOrbitObserver( TiXmlHandle handle ); 00073 00074 /* Set Orbit Controller for spacecraft navigation */ 00075 void SetOrbitController( TiXmlHandle handle ); 00076 00077 /*! Get current state */ 00078 inline Vector GetState( ) { return m_omniscient->GetState(); }; 00079 00080 /*! Get current time of estimate */ 00081 inline timeval GetTime( ) { return m_omniscient->GetTimeOfEstimate(); }; 00082 00083 /*! Runs the observer */ 00084 inline void Observe( ) { m_omnipresent->Run(); }; 00085 00086 /*! Runs the controller */ 00087 inline void Control( ) { m_omnipotent->Run(); }; 00088 00089 /*! Runs the Orbit observer */ 00090 inline void OrbitObserve( ) { m_omnipresent2->Run(); }; 00091 00092 /*! Runs the Orbit controller */ 00093 inline void OrbitControl( ) { m_omnipotent2->Run(); }; 00094 00095 /*! \brief Value-Definitions of the different string values */ 00096 enum StringValue{ OFF, 00097 ON, 00098 s_atterrbiasObserver, 00099 s_AttitudeObserver, 00100 s_DefaultObserver, 00101 s_triadObserver, 00102 s_QuaternionEKFObserver, 00103 s_DefaultController, 00104 s_AngularRateController, 00105 s_MWCMGController, 00106 s_OpenLoopMWController, 00107 s_MRPTracking, 00108 s_slidingModeControlMRPMW, 00109 s_GPSObserver, 00110 s_OrbitPropObserver, 00111 s_COENaaszController }; 00112 00113 /*! \brief Map to associate the strings with the enum values */ 00114 map<string, StringValue> s_mapStringValues; 00115 00116 protected: 00117 00118 private: 00119 00120 Whorl* m_omniscient; 00121 Observer* m_omnipresent; 00122 Controller* m_omnipotent; 00123 00124 OrbitObserver* m_omnipresent2; 00125 OrbitController* m_omnipotent2; 00126 00127 string m_observerName; 00128 string m_controllerName; 00129 00130 string m_OrbitObserverName; 00131 string m_OrbitControllerName; 00132 }; 00133 00134 #endif 00135 00136 // Do not change the comments below - they will be added automatically by CVS 00137 /***************************************************************************** 00138 * $Log: WhorlSim.h,v $ 00139 * Revision 1.8 2007/08/31 16:00:19 jayhawk_hokie 00140 * Added Orbit Control Capability. 00141 * 00142 * Revision 1.7 2007/07/24 09:40:35 jayhawk_hokie 00143 * Removed matrix and vector pointers. 00144 * 00145 * Revision 1.6 2007/05/29 19:14:58 jayhawk_hokie 00146 * Added Constructor Comments 00147 * 00148 * Revision 1.5 2007/05/21 17:50:34 jayhawk_hokie 00149 * Added Quaternion Observer 00150 * 00151 * Revision 1.4 2007/03/27 19:12:35 jayhawk_hokie 00152 * Added Switch case for observers and Controllers. 00153 * 00154 * Revision 1.3 2007/01/12 20:31:04 bwilliam 00155 * Modified to use XML parser. 00156 * 00157 * Revision 1.2 2005/02/25 18:40:52 cakinli 00158 * Created Makefiles and organized include directives to reduce the number of 00159 * include paths. Reorganized libraries so that there is now one per source 00160 * directory. Each directory is self-contained in terms of its Makefile. 00161 * The local Makefile in each directory includes src/config.mk, which has all 00162 * the definitions and general and pattern rules. So at most, to see what 00163 * goes into building a target, a person needs to examine the Makefile in 00164 * that directory, and ../config.mk. 00165 * 00166 * Revision 1.1 2003/08/18 19:24:05 mavandyk 00167 * *** empty log message *** 00168 * 00169 * Revision 1.9 2003/08/06 21:44:49 mavandyk 00170 * Altered to get config parsing to work. 00171 * 00172 * Revision 1.8 2003/08/01 11:17:42 mavandyk 00173 * Fundamental changes to the map structure and fixed bugs. 00174 * 00175 * Revision 1.7 2003/07/25 14:25:04 mavandyk 00176 * Fixed bugs, It compiles. 00177 * 00178 * Revision 1.6 2003/07/22 21:26:19 mavandyk 00179 * Fixed bugs. 00180 * 00181 * Revision 1.5 2003/07/10 19:52:30 mavandyk 00182 * Changed time storage and handling. 00183 * 00184 * Revision 1.4 2003/07/09 21:35:19 cakinli 00185 * Updated Whorl::Initialize(), added getCmdIndex(), and class Measurement. 00186 * 00187 * Revision 1.3 2003/07/07 14:37:58 simpliciter 00188 * Minor modifications. Measurement stuff needs work. 00189 * 00190 * Revision 1.2 2003/07/04 16:12:18 simpliciter 00191 * Fixed variable and function names. 00192 * 00193 * Revision 1.1 2003/07/04 14:08:05 simpliciter 00194 * Rearranged directory tree. 00195 * 00196 * Revision 1.5 2003/07/03 21:18:12 simpliciter 00197 * Added functions based on requirements of Observer and Controller classes. 00198 * 00199 * Revision 1.4 2003/07/03 16:54:48 shoemaker 00200 * Added semi-working versions of DMU code 00201 * 00202 * Revision 1.3 2003/07/02 16:36:32 nicmcp 00203 * added some comments 00204 * 00205 * Revision 1.2 2003/06/17 23:32:28 simpliciter 00206 * Updated based on comments from Andy. 00207 * 00208 * Revision 1.1.1.1 2003/06/06 18:44:15 simpliciter 00209 * Initial submission. 00210 * 00211 * Revision 1.1.1.1 2003/06/06 14:44:15 simpliciter 00212 * Initial import. 00213 * 00214 * 00215 ******************************************************************************/