Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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:
64 
65  uint32_t m_timeStartUI; //!< Time of the first data packet, for synchronization purposes.
67 
68  /** The sensor 6D pose:
69  */
71 
72  bool checkControllerIsConnected();
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 */
77  void loadConfig_sensorSpecific(
78  const mrpt::utils::CConfigFileBase &configSource,
79  const std::string &iniSection );
80 
81  public:
82  /** Constructor
83  */
84  CSickLaserUSB();
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  */
100  void doProcessSimple(
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
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
void setDeviceSerialNumber(const std::string &deviceSerialNumber)
Changes the serial number of the device to open (call prior to &#39;doProcess&#39;)
Definition: CSickLaserUSB.h:92
uint32_t m_timeStartUI
Time of the first data packet, for synchronization purposes.
Definition: CSickLaserUSB.h:65
This "software driver" implements the communication protocol for interfacing a SICK LMS2XX laser scan...
Definition: CSickLaserUSB.h:57
This class allows loading and storing values and vectors of different types from a configuration text...
GLsizei const GLchar ** string
Definition: glext.h:3919
CInterfaceFTDI * m_usbConnection
Definition: CSickLaserUSB.h:62
#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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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:72
poses::CPose3D m_sensorPose
The sensor 6D pose:
Definition: CSickLaserUSB.h:70
unsigned __int32 uint32_t
Definition: rptypes.h:49
A definition of a CStream actually representing a USB connection to a FTDI chip.
mrpt::system::TTimeStamp m_timeStartTT
Definition: CSickLaserUSB.h:66



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019