MRPT  2.0.1
CRoboPeakLidar.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 #pragma once
10 
13 #include <mrpt/poses/CPose3D.h>
14 
15 namespace mrpt::hwdrivers
16 {
17 /** Interfaces a Robo Peak LIDAR laser scanner.
18  *
19  * See the example "samples/RoboPeakLidar_laser_test" and the application
20  * "rawlog-grabber" for a ready-to-use application to gather data from the
21  * scanner.
22  *
23  * \code
24  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
25  * -------------------------------------------------------
26  * [supplied_section_name]
27  * COM_port_WIN = COM3
28  * COM_port_LIN = ttyS0
29  * pose_x=0 // Laser range scaner 3D position in the robot (meters)
30  * pose_y=0
31  * pose_z=0
32  * pose_yaw=0 // Angles in degrees
33  * pose_pitch=0
34  * pose_roll=0
35  *
36  * //preview = true // Enable GUI visualization of captured data
37  *
38  * // Optional: Exclusion zones to avoid the robot seeing itself:
39  * //exclusionZone1_x = 0.20 0.30 0.30 0.20
40  * //exclusionZone1_y = 0.20 0.30 0.30 0.20
41  *
42  * // Optional: Exclusion zones to avoid the robot seeing itself:
43  * //exclusionAngles1_ini = 20 // Deg
44  * //exclusionAngles1_end = 25 // Deg
45  *
46  * \endcode
47  * \note Class introduced in MRPT 1.2.2
48  * \ingroup mrpt_hwdrivers_grp
49  */
51 {
53  public:
54  /** Constructor */
56  /** Destructor: turns the laser off. */
57  ~CRoboPeakLidar() override;
58 
59  /** Attempts to connect and turns the laser on. Raises an exception on
60  * error. */
61  void initialize() override;
62 
63  // See base class docs
64  void doProcessSimple(
65  bool& outThereIsObservation,
66  mrpt::obs::CObservation2DRangeScan& outObservation,
67  bool& hardwareError) override;
68 
69  /** If set to non-empty, the serial port will be attempted to be opened
70  * automatically when this class is first used to request data from the
71  * laser. */
72  void setSerialPort(const std::string& port_name);
73  /** Returns the currently set serial port \sa setSerialPort */
74  const std::string getSerialPort() { return m_com_port; }
75  /** See base class docs */
76  bool turnOn() override;
77  /** See base class docs */
78  bool turnOff() override;
79 
80  /** Returns true if the device is connected & operative */
81  bool getDeviceHealth() const;
82 
83  /** Closes the comms with the laser. Shouldn't have to be directly needed by
84  * the user */
85  void disconnect();
86 
87  protected:
88  /** The sensor 6D pose: */
90  std::string m_com_port;
91  int m_com_port_baudrate{115200};
92  void* m_rplidar_drv{nullptr}; // Opaque "RPlidarDriver*"
93 
94  /** Returns true if communication has been established with the device. If
95  * it's not,
96  * try to create a comms channel.
97  * \return false on error.
98  */
99  bool checkCOMMs();
100 
101  /** See the class documentation at the top for expected parameters */
103  const mrpt::config::CConfigFileBase& configSource,
104  const std::string& iniSection) override;
105 
106 }; // End of class
107 
108 } // namespace mrpt::hwdrivers
void setSerialPort(const std::string &port_name)
If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...
void disconnect()
Closes the comms with the laser.
Contains classes for various device interfaces.
bool getDeviceHealth() const
Returns true if the device is connected & operative.
void initialize() override
Attempts to connect and turns the laser on.
void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError) override
Specific laser scanner "software drivers" must process here new data from the I/O stream...
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
This class allows loading and storing values and vectors of different types from a configuration text...
Interfaces a Robo Peak LIDAR laser scanner.
const std::string getSerialPort()
Returns the currently set serial port.
bool checkCOMMs()
Returns true if communication has been established with the device.
bool turnOff() override
See base class docs.
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finder...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
poses::CPose3D m_sensorPose
The sensor 6D pose:
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
~CRoboPeakLidar() override
Destructor: turns the laser off.
bool turnOn() override
See base class docs.



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020