Class CSickLaserUSB

Inheritance Relationships

Base Type

Class Documentation

class CSickLaserUSB : public mrpt::hwdrivers::C2DRangeFinderAbstract

This “software driver” implements the communication protocol for interfacing a SICK LMS2XX laser scanners through a custom USB RS-422 interface board.

NOTE that this class is for a custom hardware built at our lab (MAPIR, University of Malaga). For a generic serial interface, see the class CSickLaserSerial.

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. 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. 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 call “setDeviceSerialNumber”. The default serial number is “LASER001”

Warning: Avoid defining an object of this class in a global scope if you want to catch all potential exceptions during the constructors (like USB interface DLL not found, etc…)

 PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
  [supplied_section_name]
  SICKUSB_serialNumber=LASER001
  pose_x=0.21   ; Laser range scaner 3D position in the robot (meters)
  pose_y=0
  pose_z=0.34
  pose_yaw=0    ; Angles in degrees
  pose_pitch=0
  pose_roll=0
   //preview = true // Enable GUI visualization of captured data

   // Optional: Exclusion zones to avoid the robot seeing itself:
   //exclusionZone1_x = 0.20 0.30 0.30 0.20
   //exclusionZone1_y = 0.20 0.30 0.30 0.20

   // Optional: Exclusion zones to avoid the robot seeing itself:
   //exclusionAngles1_ini = 20  // Deg
   //exclusionAngles1_end = 25  // Deg

Public Functions

CSickLaserUSB()
~CSickLaserUSB() override = default
inline void setDeviceSerialNumber(const std::string &deviceSerialNumber)

Changes the serial number of the device to open (call prior to ‘doProcess’)

virtual 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, and, if a whole scan has arrived, return it. This method will be typically called in a different thread than other methods, and will be called in a timely fashion.

virtual bool turnOn() override

Enables the scanning mode (in this class this has no effect).

Returns:

If everything works “true”, or “false” if there is any error.

virtual bool turnOff() override

Disables the scanning mode (in this class this has no effect).

Returns:

If everything works “true”, or “false” if there is any error.

Protected Functions

virtual void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override

See the class documentation at the top for expected parameters