Main MRPT website > C++ reference
MRPT logo

CIMUXSens.h

Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                   http://mrpt.sourceforge.net/                            |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 
00029 #ifndef CIMUXSens_H
00030 #define CIMUXSens_H
00031 
00032 
00033 #include <mrpt/hwdrivers/CGenericSensor.h>
00034 #include <mrpt/hwdrivers/CSerialPort.h>
00035 
00036 #include <mrpt/poses/CPose3D.h>
00037 
00038 namespace mrpt
00039 {
00040         namespace hwdrivers
00041         {
00042 
00043                 /** A class for interfacing Inertial Measuring Units (IMUs) of the type "XSens MTi"
00044                   *  It uses a serial port connection to the device. The class implements the generic
00045                   *  See also the application "rawlog-grabber" for a ready-to-use application to gather data from the scanner.
00046                   *
00047                   *  \code
00048                   *  PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
00049                   * -------------------------------------------------------
00050                   *   [supplied_section_name]
00051                   *    pose_x=0     ; Sensor 3D position relative to the robot (meters)
00052                   *    pose_y=0
00053                   *    pose_z=0
00054                   *    pose_yaw=0       ; Angles in degrees
00055                   *    pose_pitch=0
00056                   *    pose_roll=0
00057                   *        sensorLabel = <label> ; Label of the sensor
00058                   *        COM_port_LIN = /dev/ttyUSB0       ; COM PORT in LINUX (optional. If not provided, the system will search the connected port)
00059                   *        COM_port_WIN = COM1               ; COM PORT in Windows (optional. If not provided, the system will search the connected port)
00060                   *        baudRate                              ; Baudrate for communicating with the COM port (mandatory for Linux)
00061                   *                                                                 (for Windows, if COM_port_WIN is not provided, this value is ignored)
00062                   *  \endcode
00063                   */
00064                 class HWDRIVERS_IMPEXP CIMUXSens : public hwdrivers::CGenericSensor
00065                 {
00066                         DEFINE_GENERIC_SENSOR(CIMUXSens)
00067                 protected:
00068 
00069                         /** This serial port will be attempted to be opened automatically when this class is first used to request data from the device.
00070                           * \sa hwdrivers::CSerialPort
00071                           */
00072                         int                                                     m_COMbauds;
00073                         std::string                                     m_com_port;
00074                         uint64_t                                        m_timeStartUI;
00075                         mrpt::system::TTimeStamp        m_timeStartTT;
00076 
00077                         mrpt::poses::CPose3D            m_sensorPose;
00078 
00079                         /** Search the port where the sensor is located and connect to it
00080                           */
00081                         bool                    searchPortAndConnect();
00082 
00083                         //CSerialPort           m_serial_port;                  //!< The serial port connection
00084 
00085                         void * /*xsens::Cmt3 */         m_cmt3_ptr;
00086                         void * /*CmtDeviceId */         m_deviceId_ptr;
00087                         unsigned int                            m_toutCounter;                          //!< Timeout counter (for internal use only)
00088 
00089                         /** 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)
00090                           *  See hwdrivers::CIMUXSens for the possible parameters
00091                           */
00092                         void  loadConfig_sensorSpecific(
00093                                 const mrpt::utils::CConfigFileBase &configSource,
00094                                 const std::string         &iniSection );
00095 
00096                 public:
00097                         /** Constructor
00098                           */
00099                         CIMUXSens( );
00100 
00101                         /** Destructor
00102                           */
00103                         virtual ~CIMUXSens();
00104 
00105 
00106                         /** This method will be invoked at a minimum rate of "process_rate" (Hz)
00107                           *  \exception This method must throw an exception with a descriptive message if some critical error is found.
00108                           */
00109                         void doProcess();
00110 
00111                         /** Turns on the xSens device and configure it for getting orientation data */
00112                         void initialize();
00113 
00114                 }; // end of class
00115 
00116         } // end of namespace
00117 } // end of namespace
00118 
00119 #endif
00120 
00121 



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011