Main MRPT website > C++ reference
MRPT logo
CIMUXSens.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef CIMUXSens_H
30 #define CIMUXSens_H
31 
32 
35 
36 #include <mrpt/poses/CPose3D.h>
37 
38 namespace mrpt
39 {
40  namespace hwdrivers
41  {
42 
43  /** A class for interfacing Inertial Measuring Units (IMUs) of the type "XSens MTi"
44  * It uses a serial port connection to the device. The class implements the generic
45  * See also the application "rawlog-grabber" for a ready-to-use application to gather data from the scanner.
46  *
47  * \code
48  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
49  * -------------------------------------------------------
50  * [supplied_section_name]
51  * pose_x=0 ; Sensor 3D position relative to the robot (meters)
52  * pose_y=0
53  * pose_z=0
54  * pose_yaw=0 ; Angles in degrees
55  * pose_pitch=0
56  * pose_roll=0
57  * sensorLabel = <label> ; Label of the sensor
58  * COM_port_LIN = /dev/ttyUSB0 ; COM PORT in LINUX (optional. If not provided, the system will search the connected port)
59  * COM_port_WIN = COM1 ; COM PORT in Windows (optional. If not provided, the system will search the connected port)
60  * baudRate ; Baudrate for communicating with the COM port (mandatory for Linux)
61  * (for Windows, if COM_port_WIN is not provided, this value is ignored)
62  * \endcode
63  * \ingroup mrpt_hwdrivers_grp
64  */
66  {
68  protected:
69 
70  /** This serial port will be attempted to be opened automatically when this class is first used to request data from the device.
71  * \sa hwdrivers::CSerialPort
72  */
74  std::string m_com_port;
75  uint64_t m_timeStartUI;
77 
79 
80  /** Search the port where the sensor is located and connect to it
81  */
82  bool searchPortAndConnect();
83 
84  //CSerialPort m_serial_port; //!< The serial port connection
85 
86  void * /*xsens::Cmt3 */ m_cmt3_ptr;
87  void * /*CmtDeviceId */ m_deviceId_ptr;
88  unsigned int m_toutCounter; //!< Timeout counter (for internal use only)
89 
90  /** 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)
91  * See hwdrivers::CIMUXSens for the possible parameters
92  */
93  void loadConfig_sensorSpecific(
94  const mrpt::utils::CConfigFileBase &configSource,
95  const std::string &iniSection );
96 
97  public:
98  /** Constructor
99  */
100  CIMUXSens( );
101 
102  /** Destructor
103  */
104  virtual ~CIMUXSens();
105 
106 
107  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
108  * \exception This method must throw an exception with a descriptive message if some critical error is found.
109  */
110  void doProcess();
111 
112  /** Turns on the xSens device and configure it for getting orientation data */
113  void initialize();
114 
115  }; // end of class
116 
117  } // end of namespace
118 } // end of namespace
119 
120 #endif
121 
122 



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013