MRPT  2.0.0
CIMUXSens.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/comms/CSerialPort.h>
14 
15 #include <mrpt/poses/CPose3D.h>
16 
17 namespace mrpt::hwdrivers
18 {
19 /** A class for interfacing XSens 3rd generation Inertial Measuring Units
20  *(IMUs), the "XSens MTi" model.
21  * It uses a serial port or USB-to-serial adapter to communicate to the
22  *device, so no special drivers are needed.
23  * For the more recent 4th generation devices, see the class
24  *mrpt::hwdrivers::CIMUXSens_MT4
25  *
26  * See also the application "rawlog-grabber" for a ready-to-use application to
27  *gather data from the scanner.
28  *
29  * \code
30  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
31  * -------------------------------------------------------
32  * [supplied_section_name]
33  * pose_x=0 ; Sensor 3D position relative to the robot (meters)
34  * pose_y=0
35  * pose_z=0
36  * pose_yaw=0 ; Angles in degrees
37  * pose_pitch=0
38  * pose_roll=0
39  * sensorLabel = <label> ; Label of the sensor
40  * COM_port_LIN = /dev/ttyUSB0 ; COM PORT in LINUX (optional. If not
41  *provided, the system will search the connected port)
42  * COM_port_WIN = COM1 ; COM PORT in Windows (optional. If not
43  *provided, the system will search the connected port)
44  * baudRate ; Baudrate for communicating with the
45  *COM port (mandatory for Linux)
46  * (for Windows, if COM_port_WIN is not
47  *provided,
48  *this
49  *value is ignored)
50  * \endcode
51  * \ingroup mrpt_hwdrivers_grp
52  */
54 {
56  protected:
57  /** This serial port will be attempted to be opened automatically when this
58  * class is first used to request data from the device.
59  * \sa comms::CSerialPort
60  */
61  int m_COMbauds{0};
62  std::string m_com_port;
63  uint64_t m_timeStartUI{};
65 
67 
68  /** Search the port where the sensor is located and connect to it
69  */
70  bool searchPortAndConnect();
71 
72  void* /*xsens::Cmt3 */ m_cmt3_ptr{nullptr};
73  void* /*CmtDeviceId */ m_deviceId_ptr{nullptr};
74  /** Timeout counter (for internal use only) */
75  unsigned int m_toutCounter{0};
76 
77  /** See the class documentation at the top for expected parameters */
79  const mrpt::config::CConfigFileBase& configSource,
80  const std::string& iniSection) override;
81 
82  public:
83  /** Constructor
84  */
85  CIMUXSens();
86 
87  /** Destructor
88  */
89  ~CIMUXSens() override;
90 
91  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
92  * \exception This method must throw an exception with a descriptive
93  * message if some critical error is found.
94  */
95  void doProcess() override;
96 
97  /** Turns on the xSens device and configure it for getting orientation data
98  */
99  void initialize() override;
100 
101 }; // end of class
102 
103 } // namespace mrpt::hwdrivers
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
void initialize() override
Turns on the xSens device and configure it for getting orientation data.
Definition: CIMUXSens.cpp:294
~CIMUXSens() override
Destructor.
Definition: CIMUXSens.cpp:72
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
Definition: CIMUXSens.cpp:380
CIMUXSens()
Constructor.
Definition: CIMUXSens.cpp:55
bool searchPortAndConnect()
Search the port where the sensor is located and connect to it.
Definition: CIMUXSens.cpp:211
Contains classes for various device interfaces.
A class for interfacing XSens 3rd generation Inertial Measuring Units (IMUs), the "XSens MTi" model...
Definition: CIMUXSens.h:53
mrpt::system::TTimeStamp m_timeStartTT
Definition: CIMUXSens.h:64
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:40
This class allows loading and storing values and vectors of different types from a configuration text...
void doProcess() override
This method will be invoked at a minimum rate of "process_rate" (Hz)
Definition: CIMUXSens.cpp:87
mrpt::poses::CPose3D m_sensorPose
Definition: CIMUXSens.h:66
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
int m_COMbauds
This serial port will be attempted to be opened automatically when this class is first used to reques...
Definition: CIMUXSens.h:61
unsigned int m_toutCounter
Timeout counter (for internal use only)
Definition: CIMUXSens.h:75
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020