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



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014