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



Page generated by Doxygen 1.9.1 for MRPT 1.4.0 SVN: at Mon Apr 18 03:37:47 UTC 2022