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:
69 
70  /** Time of the first data packet, for synchronization purposes. */
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  /** Constructor
91  */
92  CSickLaserUSB();
93 
94  /** Destructor
95  */
96  ~CSickLaserUSB() override;
97 
98  /** Changes the serial number of the device to open (call prior to
99  * 'doProcess')
100  */
101  void setDeviceSerialNumber(const std::string& deviceSerialNumber)
102  {
103  m_serialNumber = deviceSerialNumber;
104  }
105 
106  /** Specific laser scanner "software drivers" must process here new data
107  * from the I/O stream, and, if a whole scan has arrived, return it.
108  * This method will be typically called in a different thread than other
109  * methods, and will be called in a timely fashion.
110  */
111  void doProcessSimple(
112  bool& outThereIsObservation,
113  mrpt::obs::CObservation2DRangeScan& outObservation,
114  bool& hardwareError) override;
115 
116  /** Enables 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 turnOn() override;
120 
121  /** Disables the scanning mode (in this class this has no effect).
122  * \return If everything works "true", or "false" if there is any error.
123  */
124  bool turnOff() override;
125 
126 }; // End of class
127 
128 } // namespace mrpt::hwdrivers
void setDeviceSerialNumber(const std::string &deviceSerialNumber)
Changes the serial number of the device to open (call prior to &#39;doProcess&#39;)
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...
mrpt::comms::CInterfaceFTDI * m_usbConnection
Definition: CSickLaserUSB.h:67
GLsizei const GLchar ** string
Definition: glext.h:4116
#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 definition of a CStream actually representing a USB connection to a FTDI chip.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
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)
unsigned __int32 uint32_t
Definition: rptypes.h:50
~CSickLaserUSB() override
Destructor.
mrpt::system::TTimeStamp m_timeStartTT
Definition: CSickLaserUSB.h:72



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019