00001 /************************************************************************************************/ 00002 /*! \file DMU.h 00003 * \brief The DMU class provides the interface for the DMU hardware device. 00004 * \author $Author: cakinli $ 00005 * \version $Revision: 1.9 $ 00006 * \date $Date: 2005/04/26 17:20:38 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #ifndef __SSSL_DMU_H__ 00013 #define __SSSL_DMU_H__ 00014 00015 #include <vector> 00016 #include <string> 00017 #include <sys/time.h> 00018 00019 #include <matrix/Matrix.h> 00020 #include <rotation/Rotation.h> 00021 #include <Utils/CfgParse.h> 00022 #include <Hardware/DAQCard.h> 00023 00024 extern "C" { 00025 #include <Hardware/satctl.h> 00026 #include <Hardware/common.h> 00027 #include <Hardware/dmu.h> 00028 } 00029 00030 00031 using namespace std; 00032 using namespace O_SESSAME; 00033 00034 class DMU { 00035 00036 public: 00037 00038 /*! Constructors */ 00039 DMU(int _mode); 00040 //DMU(cfgBody&); 00041 00042 /*! Deconstructors */ 00043 ~DMU(); 00044 00045 /*! Facilitators */ 00046 /*! Gets the reading when the MoPak is used in digital operating mode */ 00047 void GetDigitalReading( int _channelID, timeval& _timeStamp, double& _rateData); 00048 00049 /*! Gets the reading when the MoPak is used in analog operating mode */ 00050 void GetAnalogReading( int _channelID, DAQCard* _mycard, timeval& _timeStamp, double& _rateData); 00051 00052 /*! Get the location of the MoPak */ 00053 Vector GetLocation(); 00054 00055 /*! Get the quaternion from the Sensor frame to the body frame */ 00056 Vector GetSensorToBodyQuaternion( int id ); 00057 00058 /*! Mutators */ 00059 /*! Initialize the attitude sensor */ 00060 int Initialize(int _mode); 00061 00062 /*! Set the location of the physical DMU device. */ 00063 void SetLocation(const Vector& newDeviceLocation); 00064 00065 /*! Set the DMU to body quaternion, and from that the individual quaternions for each the sensors that comprise the DMU. */ 00066 void SetSensorToBodyQuaternions(const Vector& newDeviceQuaternion); 00067 00068 /*! Function to return an instance of a single DMU, to prevent the application from trying to create multiple physical DMUs */ 00069 static DMU* Instance(int _mode); 00070 protected: 00071 00072 private: 00073 /*! A static instance of a DMU, declared here and defined elsewhere, to assure all separate rate gyros and accelerometers refer to the same single DMU */ 00074 static DMU* s_instance; 00075 00076 Vector m_location; 00077 Vector m_sensorToBodyQuaternion; 00078 00079 Vector m_dmuXToBodyQuaternion; 00080 Vector m_dmuYToBodyQuaternion; 00081 Vector m_dmuZToBodyQuaternion; 00082 00083 adat_t* m_ptrToReadData; /* pointer to type adat_t, will point to the temporary buffer of the read data */ 00084 00085 int m_prate; // poll rate 00086 int m_tempBuffSize; /* size of the temporary buffer of the read data */ 00087 00088 timeval m_initTime; /* time of DMU initialization. For now, used as reference time for fakeDMU.cpp */ 00089 00090 timeval m_GetReadingTime; 00091 long m_delta_t; // actual time difference between current and previous calls to GetReading, in usecs. 00092 long m_timeToler; // the desired time tolerance between current and previous cals to GetReading, in usecs. 00093 int m_firstCall; // 0=false 1=true 00094 int m_numread; // number of data sets read each time by dmuReadData call 00095 00096 }; 00097 00098 #endif 00099 // Do not change the comments below - they will be added automatically by CVS 00100 /***************************************************************************** 00101 * $Log: DMU.h,v $ 00102 * Revision 1.9 2005/04/26 17:20:38 cakinli 00103 * Updated Makefiles to build a single libdsacss.a in the src directory to alleviate linking issues with the multiple, per-directory libraries. 00104 * 00105 * Revision 1.8 2005/03/16 18:08:16 cakinli 00106 * *** empty log message *** 00107 * 00108 * Revision 1.7 2004/04/08 06:07:08 shoemaker 00109 * Added analog MoPak calibration routines 00110 * 00111 * Revision 1.6 2004/03/29 16:43:11 shoemaker 00112 * Added code to work with analog DAQ card code 00113 * 00114 * Revision 1.5 2003/08/08 16:52:19 shoemaker 00115 * Hopefully fixed issues with data wasting and efficiency. 00116 * 00117 * Revision 1.4 2003/07/18 17:21:10 shoemaker 00118 * Redefined GetReading to use timeval struct for time stamp 00119 * 00120 * Revision 1.3 2003/07/08 21:03:09 shoemaker 00121 * Cleaned up in accordance with fakeDMU.cpp and realDMU.cpp 00122 * 00123 * Revision 1.2 2003/07/03 16:54:50 shoemaker 00124 * Added semi-working versions of DMU code 00125 * 00126 * Revision 1.1 2003/06/24 01:05:39 mavandyk 00127 * The class for interfacing with the DMU. 00128 * 00129 ******************************************************************************/