MRPT  1.9.9
CSickLaserUSB.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-2019, 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 
14 namespace mrpt::hwdrivers
15 {
16 /** This "software driver" implements the communication protocol for interfacing
17  * a SICK LMS2XX laser scanners through a custom USB RS-422 interface board.
18  *
19  * NOTE that this class is for a custom hardware built at our lab (MAPIR,
20  * University of Malaga).
21  * For a generic serial interface, see the class CSickLaserSerial.
22  *
23  * This class does not need to be bind, i.e. you do not need to call
24  * C2DRangeFinderAbstract::bindIO. However, calling it will have not effect.
25  * In this class the "bind" is ignored since it is designed for USB
26  * connections only, thus it internally generate the required object for
27  * simplicity of use.
28  * The serial number of the USB device is used to open it on the first call
29  * to "doProcess", thus you must call "loadConfig" before this, or manually
30  * call "setDeviceSerialNumber". The default serial number is "LASER001"
31  *
32  * Warning: Avoid defining an object of this class in a global scope if you
33  * want to catch all potential
34  * exceptions during the constructors (like USB interface DLL not found,
35  * etc...)
36  *
37  *
38  * \code
39  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
40  * -------------------------------------------------------
41  * [supplied_section_name]
42  * SICKUSB_serialNumber=LASER001
43  * pose_x=0.21 ; Laser range scaner 3D position in the robot (meters)
44  * pose_y=0
45  * pose_z=0.34
46  * pose_yaw=0 ; Angles in degrees
47  * pose_pitch=0
48  * pose_roll=0
49  * //preview = true // Enable GUI visualization of captured data
50  *
51  * // Optional: Exclusion zones to avoid the robot seeing itself:
52  * //exclusionZone1_x = 0.20 0.30 0.30 0.20
53  * //exclusionZone1_y = 0.20 0.30 0.30 0.20
54  *
55  * // Optional: Exclusion zones to avoid the robot seeing itself:
56  * //exclusionAngles1_ini = 20 // Deg
57  * //exclusionAngles1_end = 25 // Deg
58  * \endcode
59  * \ingroup mrpt_hwdrivers_grp
60  *
61  */
63 {
65 
66  private:
67  std::unique_ptr<mrpt::comms::CInterfaceFTDI> m_usbConnection{nullptr};
68  std::string m_serialNumber;
69 
70  /** Time of the first data packet, for synchronization purposes. */
71  uint32_t m_timeStartUI{0};
73 
74  /** The sensor 6D pose:
75  */
77 
80  std::vector<float>& ranges, unsigned char& LMS_status,
81  uint32_t& out_board_timestamp, bool& is_mm_mode);
82 
83  protected:
84  /** See the class documentation at the top for expected parameters */
86  const mrpt::config::CConfigFileBase& configSource,
87  const std::string& iniSection) override;
88 
89  public:
90  CSickLaserUSB();
91  ~CSickLaserUSB() override = default;
92 
93  /** Changes the serial number of the device to open (call prior to
94  * 'doProcess')
95  */
96  void setDeviceSerialNumber(const std::string& deviceSerialNumber)
97  {
98  m_serialNumber = deviceSerialNumber;
99  }
100 
101  /** Specific laser scanner "software drivers" must process here new data
102  * from the I/O stream, and, if a whole scan has arrived, return it.
103  * This method will be typically called in a different thread than other
104  * methods, and will be called in a timely fashion.
105  */
106  void doProcessSimple(
107  bool& outThereIsObservation,
108  mrpt::obs::CObservation2DRangeScan& outObservation,
109  bool& hardwareError) override;
110 
111  /** Enables the scanning mode (in this class this has no effect).
112  * \return If everything works "true", or "false" if there is any error.
113  */
114  bool turnOn() override;
115 
116  /** Disables the scanning mode (in this class this has no effect).
117  * \return If everything works "true", or "false" if there is any error.
118  */
119  bool turnOff() override;
120 
121 }; // End of class
122 
123 } // namespace mrpt::hwdrivers
std::unique_ptr< mrpt::comms::CInterfaceFTDI > m_usbConnection
Definition: CSickLaserUSB.h:67
void setDeviceSerialNumber(const std::string &deviceSerialNumber)
Changes the serial number of the device to open (call prior to &#39;doProcess&#39;)
Definition: CSickLaserUSB.h:96
uint32_t m_timeStartUI
Time of the first data packet, for synchronization purposes.
Definition: CSickLaserUSB.h:71
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
This "software driver" implements the communication protocol for interfacing a SICK LMS2XX laser scan...
Definition: CSickLaserUSB.h:62
Contains classes for various device interfaces.
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...
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:40
This class allows loading and storing values and vectors of different types from a configuration text...
~CSickLaserUSB() override=default
#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...
bool turnOff() override
Disables the scanning mode (in this class this has no effect).
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
bool turnOn() override
Enables the scanning mode (in this class this has no effect).
poses::CPose3D m_sensorPose
The sensor 6D pose:
Definition: CSickLaserUSB.h:76
bool waitContinuousSampleFrame(std::vector< float > &ranges, unsigned char &LMS_status, uint32_t &out_board_timestamp, bool &is_mm_mode)
mrpt::system::TTimeStamp m_timeStartTT
Definition: CSickLaserUSB.h:72



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: d1962bc6a Wed Jan 15 17:38:30 2020 +0100 at miƩ ene 15 17:45:11 CET 2020