00001 /************************************************************************************************/ 00002 /*! \file Magnetometer.h 00003 * \brief The Magnetometer class provides the interface for h/w magnetometers. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.9 $ 00006 * \date $Date: 2007/07/24 09:41:47 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #ifndef __SSSL_MAGNETOMETER_H__ 00013 #define __SSSL_MAGNETOMETER_H__ 00014 00015 #include <Base/Sensor.h> 00016 #include <rotation/Rotation.h> 00017 #include <matrix/Matrix.h> 00018 #include <sstream> 00019 #include "dsacssinterface.h" 00020 00021 extern "C"{ 00022 #include "Hardware/satctl.h" 00023 #include "Hardware/common.h" 00024 } 00025 00026 using namespace O_SESSAME; 00027 00028 class Magnetometer : public Sensor 00029 { 00030 public: 00031 // Contructors/Deconstructors 00032 Magnetometer( ); 00033 00034 Magnetometer( TiXmlHandle handle ); 00035 00036 virtual ~Magnetometer( ); 00037 00038 // Facilitators 00039 00040 // Inspectors 00041 Measurement GetMeasurement( ); 00042 00043 Vector GetRawVectorMeasurement( ); 00044 00045 Vector GetVectorMeasurement( ); 00046 00047 // Mutators 00048 virtual int Initialize( const string& magfn ); 00049 00050 void AsciiParser( ); 00051 00052 void BinaryParser( ); 00053 00054 void DefaultConfiguration( ); 00055 00056 void SetBaud19200Configuration( ); 00057 00058 void PolledDataConfiguration( ); 00059 00060 void ContinuousDataConfiguration( ); 00061 00062 void SetAsciiConfiguration( ); 00063 00064 void SetBinaryConfiguration( ); 00065 00066 void SetSampleRateConfiguration( ); 00067 00068 void SetResetOnConfiguration( ); 00069 00070 void SetResetOffConfiguration( ); 00071 00072 void SetAveragingOnConfiguration( ); 00073 00074 void SetAveragingOffConfiguration( ); 00075 00076 void ReEnterOnConfiguration( ); 00077 00078 void ReEnterOffConfiguration( ); 00079 00080 void QuerryConfiguration( ); 00081 00082 00083 private: 00084 /*! \brief Member variable for magnetometer file descriptor */ 00085 int m_magfd; 00086 /*! \brief Member variable for rotation matrix */ 00087 Matrix m_Rmb; 00088 /*! \brief Member variable for response from magnetometer */ 00089 char *buffer; 00090 /*! \brief Member variable for magnetometer counts */ 00091 char *magread; 00092 /*! \brief Member variable for magnetometer counts in the Sensor Frame */ 00093 Vector m_magCountsSensor; 00094 /*! \brief Member variable for magnetometer counts in the Body Frame */ 00095 Vector m_magCountsBody; 00096 /*! \brief Member variable to specify sample rate. Not implemented yet. */ 00097 int m_sampleRate; 00098 /*! \brief x offset */ 00099 double m_xOff; 00100 /*! \brief y offset */ 00101 double m_yOff; 00102 /*! \brief Major axis */ 00103 double m_majorA; 00104 /*! \brief Minor axis */ 00105 double m_minorA; 00106 /*! \brief Angle between x-axis and major axis */ 00107 double m_phi; 00108 00109 }; 00110 00111 #endif 00112 // Do not change the comments below - they will be added automatically by CVS 00113 /***************************************************************************** 00114 * $Log: Magnetometer.h,v $ 00115 * Revision 1.9 2007/07/24 09:41:47 jayhawk_hokie 00116 * Removed matrix and vector pointers. 00117 * 00118 * Revision 1.8 2007/05/30 20:37:09 bwilliam 00119 * Updated to include x-y calibration. 00120 * 00121 * Revision 1.7 2007/05/29 19:05:42 jayhawk_hokie 00122 * Update pointers 00123 * 00124 * Revision 1.6 2007/05/08 22:28:58 jayhawk_hokie 00125 * Added functions for configuration parameters. Changed Baud to 19,200. Still have random spike points on the Z sensor. 00126 * 00127 * Revision 1.5 2007/01/12 22:18:42 bwilliam 00128 * Modified to use XML parser. 00129 * 00130 * Revision 1.4 2006/07/10 21:47:28 bwilliam 00131 * Altered class structure and added code for magnetometer implementation. 00132 * 00133 * Revision 1.3 2005/03/16 18:08:17 cakinli 00134 * *** empty log message *** 00135 * 00136 * Revision 1.2 2003/07/04 14:13:01 simpliciter 00137 * Added newline at end of file. 00138 * 00139 * Revision 1.1.1.1 2003/06/06 18:44:15 simpliciter 00140 * Initial submission. 00141 * 00142 * 00143 ******************************************************************************/ 00144