Main MRPT website > C++ reference for MRPT 1.4.0
CBoardIR.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9
10#ifndef CBoardIR_H
11#define CBoardIR_H
12
14#include <mrpt/poses/CPoint3D.h>
18#include <mrpt/obs/obs_frwds.h>
19
20namespace mrpt
21{
22 namespace hwdrivers
23 {
24 /** A parser of NMEA commands, for connecting to a GPS by a serial port.
25 * This class also supports more advanced GPS equipped with RTK corrections. See the JAVAD/TopCon extra initialization parameters.
26 *
27 * \code
28 * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
29 * -------------------------------------------------------
30 * [supplied_section_name]
31 * COM_port_WIN = COM3
32 * COM_port_LIN = ttyS0
33 * baudRate = 4800 // The baudrate of the communications (typ. 4800 bauds)
34 * pose_x = 0 // 3D position of the sensed point relative to the robot (meters)
35 * pose_y = 0
36 * pose_z = 0
37 * customInit = // See below for possible values
38 *
39 * // The next parameters are optional and will be used only
40 * // if customInit=="JAVAD" to enable/configure the usage of RTK corrections:
41 * //JAVAD_rtk_src_port=/dev/ser/b
42 * //JAVAD_rtk_src_baud=9600
43 * //JAVAD_rtk_format=cmr
44 *
45 * \endcode
46 *
47 * - customInit: Custom commands to send, depending on the sensor. Valid values are:
48 * - "": Empty string
49 * - "JAVAD": JAVAD or TopCon devices. Extra initialization commands will be sent.
50 * - "TopCon": A synonymous with "JAVAD".
51 *
52 * VERSIONS HISTORY:
53 * -9/JUN/2006: First version (JLBC)
54 * -4/JUN/2008: Added virtual methods for device-specific initialization commands.
55 * -10/JUN/2008: Converted into CGenericSensor class (there are no inhirited classes anymore).
56 * \ingroup mrpt_hwdrivers_grp
57 */
59 {
61
62 public:
63 /** Constructor
64 * \param BUFFER_LENGTH The size of the communications buffer (default value should be fine always)
65 */
66 CBoardIR( int BUFFER_LENGTH = 13 );
67
68 /** Destructor
69 */
70 virtual ~CBoardIR();
71
72 /** This method tries to get a set of range measurements from the IR sensors.
73 * \param outObservation The output observation
74 * \param outThereIsObservation Will be true if an observation was sucessfully received.
75 * \param hardwareError Will be true if there's some important error, e.g. serial port can't be open.
76 */
78 bool &outThereIsObservation,
79 mrpt::obs::CObservationRange &outObservation,
80 bool &hardwareError );
81
82 // See docs in parent class
83 void doProcess();
84
85 void setSerialPortName(const std::string &COM_port); //!< Set the serial port to use (COM1, ttyUSB0, etc).
86 std::string getSerialPortName() const; //!< Get the serial port to use (COM1, ttyUSB0, etc).
87
88 protected:
90
92
94
95 std::string m_customInit;
96
97 /** The minimum range in meters (10cm).
98 */
100
101 /** The maximum range in meters (80cm).
102 */
104
105 /** The poses of the IR: x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg]
106 * Up to 6 devices, but you can put any number of devices (from 1 to 6).
107 */
108 std::map<uint16_t,mrpt::math::TPose3D> m_IRPoses;
109
110 /** See the class documentation at the top for expected parameters */
112 const mrpt::utils::CConfigFileBase &configSource,
113 const std::string &iniSection );
114
115 private:
116 std::string m_COMname;
118
119 /** Returns true if the COM port is already open, or try to open it in other case.
120 * \return true if everything goes OK, or false if there are problems opening the port.
121 */
123
124 }; // end class
125
126 } // end namespace
127} // end namespace
128
129#endif
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
A parser of NMEA commands, for connecting to a GPS by a serial port.
Definition: CBoardIR.h:59
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
std::string m_customInit
Definition: CBoardIR.h:95
poses::CPoint3D m_sensorPose
Definition: CBoardIR.h:93
void setSerialPortName(const std::string &COM_port)
Set the serial port to use (COM1, ttyUSB0, etc).
CBoardIR(int BUFFER_LENGTH=13)
Constructor.
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
std::map< uint16_t, mrpt::math::TPose3D > m_IRPoses
The poses of the IR: x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg] Up to 6 devices,...
Definition: CBoardIR.h:108
bool tryToOpenTheCOM()
Returns true if the COM port is already open, or try to open it in other case.
std::string getSerialPortName() const
Get the serial port to use (COM1, ttyUSB0, etc).
float m_minRange
The minimum range in meters (10cm).
Definition: CBoardIR.h:99
float m_maxRange
The maximum range in meters (80cm).
Definition: CBoardIR.h:103
void getObservation(bool &outThereIsObservation, mrpt::obs::CObservationRange &outObservation, bool &hardwareError)
This method tries to get a set of range measurements from the IR sensors.
virtual ~CBoardIR()
Destructor.
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:44
Declares a class derived from "CObservation" that encapsules a single range measurement,...
A class used to store a 3D point.
Definition: CPoint3D.h:33
This class allows loading and storing values and vectors of different types from a configuration text...
This base class provides a common printf-like method to send debug information to std::cout,...
#define HWDRIVERS_IMPEXP
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.4 for MRPT 1.4.0 SVN: at Sun Aug 14 11:28:23 UTC 2022