MRPT  2.0.3
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
mrpt::hwdrivers::CRoboPeakLidar::turnOff
bool turnOff() override
See base class docs.
Definition: CRoboPeakLidar.cpp:205
mrpt::hwdrivers::CRoboPeakLidar::~CRoboPeakLidar
~CRoboPeakLidar() override
Destructor: turns the laser off.
Definition: CRoboPeakLidar.cpp:38
mrpt::hwdrivers::CRoboPeakLidar::turnOn
bool turnOn() override
See base class docs.
Definition: CRoboPeakLidar.cpp:191
mrpt::obs::CObservation2DRangeScan
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Definition: CObservation2DRangeScan.h:54
mrpt::hwdrivers::CRoboPeakLidar::m_com_port
std::string m_com_port
Definition: CRoboPeakLidar.h:90
mrpt::hwdrivers::CRoboPeakLidar::getDeviceHealth
bool getDeviceHealth() const
Returns true if the device is connected & operative.
Definition: CRoboPeakLidar.cpp:220
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:19
mrpt::hwdrivers::CRoboPeakLidar::getSerialPort
const std::string getSerialPort()
Returns the currently set serial port.
Definition: CRoboPeakLidar.h:74
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:302
mrpt::hwdrivers::CRoboPeakLidar::checkCOMMs
bool checkCOMMs()
Returns true if communication has been established with the device.
Definition: CRoboPeakLidar.cpp:259
mrpt::hwdrivers::CRoboPeakLidar::initialize
void initialize() override
Attempts to connect and turns the laser on.
Definition: CRoboPeakLidar.cpp:338
mrpt::hwdrivers::C2DRangeFinderAbstract
This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finder...
Definition: C2DRangeFinderAbstract.h:40
mrpt::hwdrivers::CRoboPeakLidar::setSerialPort
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 ...
Definition: CRoboPeakLidar.cpp:348
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
circular_buffer.h
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
CPose3D.h
mrpt::hwdrivers::CRoboPeakLidar
Interfaces a Robo Peak LIDAR laser scanner.
Definition: CRoboPeakLidar.h:50
mrpt::hwdrivers::CRoboPeakLidar::m_sensorPose
poses::CPose3D m_sensorPose
The sensor 6D pose:
Definition: CRoboPeakLidar.h:89
mrpt::hwdrivers::CRoboPeakLidar::m_rplidar_drv
void * m_rplidar_drv
Definition: CRoboPeakLidar.h:92
mrpt::hwdrivers::CRoboPeakLidar::disconnect
void disconnect()
Closes the comms with the laser.
Definition: CRoboPeakLidar.cpp:44
mrpt::hwdrivers::CRoboPeakLidar::m_com_port_baudrate
int m_com_port_baudrate
Definition: CRoboPeakLidar.h:91
mrpt::hwdrivers::CRoboPeakLidar::CRoboPeakLidar
CRoboPeakLidar()
Constructor.
Definition: CRoboPeakLidar.cpp:34
mrpt::hwdrivers::CRoboPeakLidar::loadConfig_sensorSpecific
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
Definition: CRoboPeakLidar.cpp:164
C2DRangeFinderAbstract.h
mrpt::hwdrivers::CRoboPeakLidar::doProcessSimple
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,...
Definition: CRoboPeakLidar.cpp:55



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 15:49:54 UTC 2020