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://www.mrpt.org/                                |
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                   * \ingroup mrpt_hwdrivers_grp
00064                   */
00065                 class HWDRIVERS_IMPEXP CIMUXSens : public hwdrivers::CGenericSensor
00066                 {
00067                         DEFINE_GENERIC_SENSOR(CIMUXSens)
00068                 protected:
00069 
00070                         /** This serial port will be attempted to be opened automatically when this class is first used to request data from the device.
00071                           * \sa hwdrivers::CSerialPort
00072                           */
00073                         int                                                     m_COMbauds;
00074                         std::string                                     m_com_port;
00075                         uint64_t                                        m_timeStartUI;
00076                         mrpt::system::TTimeStamp        m_timeStartTT;
00077 
00078                         mrpt::poses::CPose3D            m_sensorPose;
00079 
00080                         /** Search the port where the sensor is located and connect to it
00081                           */
00082                         bool                    searchPortAndConnect();
00083 
00084                         //CSerialPort           m_serial_port;                  //!< The serial port connection
00085 
00086                         void * /*xsens::Cmt3 */         m_cmt3_ptr;
00087                         void * /*CmtDeviceId */         m_deviceId_ptr;
00088                         unsigned int                            m_toutCounter;                          //!< Timeout counter (for internal use only)
00089 
00090                         /** 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)
00091                           *  See hwdrivers::CIMUXSens for the possible parameters
00092                           */
00093                         void  loadConfig_sensorSpecific(
00094                                 const mrpt::utils::CConfigFileBase &configSource,
00095                                 const std::string         &iniSection );
00096 
00097                 public:
00098                         /** Constructor
00099                           */
00100                         CIMUXSens( );
00101 
00102                         /** Destructor
00103                           */
00104                         virtual ~CIMUXSens();
00105 
00106 
00107                         /** This method will be invoked at a minimum rate of "process_rate" (Hz)
00108                           *  \exception This method must throw an exception with a descriptive message if some critical error is found.
00109                           */
00110                         void doProcess();
00111 
00112                         /** Turns on the xSens device and configure it for getting orientation data */
00113                         void initialize();
00114 
00115                 }; // end of class
00116 
00117         } // end of namespace
00118 } // end of namespace
00119 
00120 #endif
00121 
00122 



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011