Class CLMS100Eth

Inheritance Relationships

Base Type

Class Documentation

class CLMS100Eth : public mrpt::hwdrivers::C2DRangeFinderAbstract

This “software driver” implements the communication protocol for interfacing a SICK LMS100 laser scanners through an ethernet controller. This class does not need to be bind, i.e. you do not need to call C2DRangeFinderAbstract::bindIO. Connection is established when user call the turnOn() method. You can pass to the class’s constructor the LMS100 ‘s ip address and port. Device will be configured with the following parameters :

  • Start Angle : -45 deg (imposed by hardware)

  • Stop Angle : +225 deg (imposed by hardware)

  • Apperture : 270 deg (imposed by hardware)

  • Angular resolution : 0.25 deg

  • Scan frequency : 25 Hz

  • Max Range : 20m (imposed by hardware).

Important note: SICK LMS 1xx devices have two levels of configuration. In its present implementation, this class only handles one of them, so before using this class, you must “pre-configure” your scanner with the SICK’s software “SOAP” (this software ships with the device), and set the framerate with this software. Of course, you have to pre-configure the device just once, then save that configuration in its flash memory.

To get a laser scan you must proceed like that :

CLMS200Eth laser(string("192.168.0.10"), 1234);
laser.turnOn();
bool isOutObs, hardwareError;
CObservation2DRangeScan outObs;
laser.doProcessSimple(isOutObs, outObs, hardwareError);

The sensor pose on the vehicle could be loaded from an ini configuration file with :

   PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
  -------------------------------------------------------
    [supplied_section_name]
      ip_address = 192.168.0.50 ;a string which is the SICK's ip adress
*(default is 192.168.0.1)
    TCP_port = 1234         ; an integer value : the tcp ip port on which the
*sick is listening (default is 2111).
    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
This class doesn’t configure the SICK LMS sensor, it is recommended to configure the sensor via the the SICK software : SOPAS.

Note

This class was contributed by Adrien Barral - Robopec (France)

Public Functions

CLMS100Eth(std::string _ip = std::string("192.168.0.1"), unsigned int _port = 2111)

Constructor. Note that there is default arguments, here you can customize IP Adress and TCP Port of your device.

~CLMS100Eth() override

Destructor. Close communcation with the device, and free memory.

virtual void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError) override

This function acquire a laser scan from the device. If an error occurred, hardwareError will be set to true. The new laser scan will be stored in the outObservation argument.

Throws:

This – method throw exception if the frame received from the LMS 100 contain the following bad parameters :

  • Status is not OK

  • Data in the scan aren’t DIST1 (may be RSSIx or DIST2).

virtual bool turnOn() override

This method must be called before trying to get a laser scan.

virtual bool turnOff() override

This method could be called manually to stop communication with the device. Method is also called by destructor.

void setSensorPose(const mrpt::poses::CPose3D &_pose)

A method to set the sensor pose on the robot. Equivalent to setting the sensor pose via loading it from a config file.

virtual void doProcess() override

This method should be called periodically. Period depend on the process_rate in the configuration file.

virtual void initialize() override

Initialize the sensor according to the parameters previously read in the configuration file.

Protected Functions

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

Load sensor pose on the robot, or keep the default sensor pose.