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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020