00001 /*--------------------------------------------------------------- 00002 FILE: CBoardDLMS.h 00003 00004 Part of the MRPT Library 00005 ISA - Universidad de Malaga - http://www.isa.uma.es 00006 ---------------------------------------------------------------*/ 00007 00008 #ifndef CBoardDLMS_H 00009 #define CBoardDLMS_H 00010 00011 #include <mrpt/hwdrivers/CGenericSensor.h> 00012 #include <mrpt/hwdrivers/CInterfaceFTDIMessages.h> 00013 #include <mrpt/utils/CConfigFileBase.h> 00014 #include <mrpt/poses/CPose3D.h> 00015 00016 namespace mrpt 00017 { 00018 namespace hwdrivers 00019 { 00020 /** An interface to a custom board which interfaces two SICK laser scanners. 00021 * Implemented for the board v1.0 designed by 2008 @ ISA (University of Malaga). 00022 * 00023 * \code 00024 * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS: 00025 * ------------------------------------------------------- 00026 * [DualLMS] 00027 * driver = CBoardDLMS 00028 * process_rate = 30 ; Hz 00029 * USB_serialname = DLMS-001 00030 * 00031 * mPose_x = 0 ; Master laser range scaner 6D position on the robot (meters) 00032 * mPose_y = 0 00033 * mPose_z = 0 00034 * mPose_yaw = 0 00035 * mPose_pitch = 0 00036 * mPose_roll = 0 00037 * 00038 * sPose_x = 0 ; Slave laser range scaner 6D position on the robot (meters) 00039 * sPose_y = 0 00040 * sPose_z = 0 00041 * sPose_yaw = 0 00042 * sPose_pitch = 0 00043 * sPose_roll = 0 00044 * \endcode 00045 * 00046 */ 00047 class HWDLLIMPEXP CBoardDLMS : public hwdrivers::CInterfaceFTDIMessages, public CGenericSensor 00048 { 00049 DEFINE_GENERIC_SENSOR(CBoardDLMS) 00050 protected: 00051 /** A copy of the device serial number (to open the USB FTDI chip) 00052 */ 00053 std::string m_usbSerialNumber; 00054 uint32_t m_timeStartUI; 00055 mrpt::system::TTimeStamp m_timeStartTT; 00056 00057 mrpt::poses::CPose3D m_mSensorPose, m_sSensorPose; 00058 00059 /** Tries to connect to the USB device (if disconnected). 00060 * \return True on connection OK, false on error. 00061 */ 00062 bool checkConnectionAndConnect(); 00063 00064 bool checkCRC( const std::vector<unsigned char> &frame ); 00065 uint16_t CreateCRC( const std::vector<unsigned char> &CommData, uint16_t uLen ); 00066 00067 public: 00068 /** Constructor 00069 * \param serialNumberUSBdevice The serial number (text) of the device to open. 00070 * The constructor will try to open the device. You can check if it failed calling "isOpen()". 00071 */ 00072 CBoardDLMS( ); 00073 00074 /** Destructor 00075 */ 00076 virtual ~CBoardDLMS(); 00077 00078 /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) 00079 * See hwdrivers::CBoardDLMS for the possible parameters 00080 */ 00081 void loadConfig( 00082 const mrpt::utils::CConfigFileBase &configSource, 00083 const std::string &iniSection ); 00084 00085 /** This method should be called periodically (at least at 1Hz to capture ALL the real-time data) 00086 * It is thread safe, i.e. you can call this from one thread, then to other methods from other threads. 00087 * This method processes data from the GPS and update the object state accordingly. 00088 */ 00089 void doProcess(); 00090 00091 /** This method can or cannot be implemented in the derived class, depending on the need for it. 00092 * \exception This method must throw an exception with a descriptive message if some critical error is found. 00093 */ 00094 virtual void initialize(); 00095 00096 /** Query the firmware version on the device (can be used to test communications). 00097 * \return true on success, false on communications errors or device not found. 00098 */ 00099 bool queryFirmwareVersion( std::string &out_firmwareVersion ); 00100 00101 /** Send a command to the DLMS Board 00102 * \return true on success, false on communications errors or device not found. 00103 */ 00104 bool sendCommand( uint8_t command, std::vector<unsigned char> &response ); 00105 00106 bool queryTimeStamp( mrpt::system::TTimeStamp &tstamp ); 00107 00108 }; // end of class 00109 00110 } // end of namespace 00111 } // End of namespace 00112 00113 #endif
Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:20:53 EDT 2009 |