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 
20 namespace 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  */
77  void getObservation(
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:
89  bool OnConnectionEstablished();
90 
92 
94 
95  std::string m_customInit;
96 
97  /** The minimum range in meters (10cm).
98  */
99  float m_minRange;
100 
101  /** The maximum range in meters (80cm).
102  */
103  float m_maxRange;
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 */
111  void loadConfig_sensorSpecific(
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  */
122  bool tryToOpenTheCOM();
123 
124  }; // end class
125 
126  } // end namespace
127 } // end namespace
128 
129 #endif
mrpt::utils::CDebugOutputCapable
This base class provides a common printf-like method to send debug information to std::cout,...
Definition: CDebugOutputCapable.h:31
CDebugOutputCapable.h
mrpt::hwdrivers::CBoardIR::m_IRPoses
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
CSerialPort.h
mrpt::hwdrivers::CBoardIR::m_COM
CSerialPort m_COM
Definition: CBoardIR.h:91
mrpt::hwdrivers::CBoardIR::m_sensorPose
poses::CPoint3D m_sensorPose
Definition: CBoardIR.h:93
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::hwdrivers::CBoardIR::m_COMbauds
int m_COMbauds
Definition: CBoardIR.h:117
DEFINE_GENERIC_SENSOR
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
Definition: CGenericSensor.h:251
mrpt::hwdrivers::CBoardIR
A parser of NMEA commands, for connecting to a GPS by a serial port.
Definition: CBoardIR.h:58
mrpt::hwdrivers::CBoardIR::m_maxRange
float m_maxRange
The maximum range in meters (80cm).
Definition: CBoardIR.h:103
mrpt::utils::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: CConfigFileBase.h:30
CGenericSensor.h
obs_frwds.h
mrpt::hwdrivers::CSerialPort
A communications serial port built as an implementation of a utils::CStream.
Definition: CSerialPort.h:43
mrpt::hwdrivers::CGenericSensor
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
Definition: CGenericSensor.h:63
CObservationRange.h
CPoint3D.h
mrpt::obs::CObservationRange
Declares a class derived from "CObservation" that encapsules a single range measurement,...
Definition: obs/CObservationRange.h:30
mrpt::hwdrivers::CBoardIR::m_minRange
float m_minRange
The minimum range in meters (10cm).
Definition: CBoardIR.h:99
mrpt::hwdrivers::CBoardIR::m_customInit
std::string m_customInit
Definition: CBoardIR.h:95
mrpt::hwdrivers::CBoardIR::m_COMname
std::string m_COMname
Definition: CBoardIR.h:116
mrpt::poses::CPoint3D
A class used to store a 3D point.
Definition: CPoint3D.h:32
HWDRIVERS_IMPEXP
#define HWDRIVERS_IMPEXP
Definition: hwdrivers_impexp.h:82



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:08:25 UTC 2019