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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST