Main MRPT website > C++ reference
MRPT logo

mrpt::hwdrivers::CLMS100Eth Class Reference

This "software driver" implements the communication protocol for interfacing a SICK LMS100 laser scanners through an ethernet controller. More...

#include <mrpt/hwdrivers/CLMS100eth.h>

Inheritance diagram for mrpt::hwdrivers::CLMS100Eth:
Inheritance graph
[legend]
Collaboration diagram for mrpt::hwdrivers::CLMS100Eth:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CLMS100Eth (string _ip=string("192.168.0.1"), unsigned int _port=2111)
 Constructor.
virtual ~CLMS100Eth ()
 Destructor.
void doProcessSimple (bool &outThereIsObservation, CObservation2DRangeScan &outObservation, bool &hardwareError)
 This function acquire a laser scan from the device.
bool turnOn ()
 This method must be called before trying to get a laser scan.
bool turnOff ()
 This method could be called manually to stop communication with the device.
void setSensorPose (CPose3D &_pose)
 A method to set the sensor pose on the robot.

Protected Member Functions

void loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 Load sensor pose on the robot, or keep the default sensor pose.

Private Member Functions

void generateCmd (const char *cmd)
bool checkIsConnected ()
bool decodeLogIn (char *msg)
bool decodeScanCfg (istringstream &stream)
bool decodeScanDataCfg (istringstream &stream)
bool decodeScan (char *buf, CObservation2DRangeScan &outObservation)
void sendCommand (const char *cmd)
void roughPrint (char *msg)

Private Attributes

string m_ip
unsigned int m_port
CClientTCPSocket m_client
bool m_turnedOn
string m_cmd
bool m_connected
unsigned int m_scanFrequency
double m_angleResolution
double m_startAngle
double m_stopAngle
CPose3D m_sensorPose
double m_maxRange
double m_beamApperture

Detailed Description

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 :

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]
   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
Note:
This class was contributed by Adrien Barral - Robopec (France)

Definition at line 79 of file CLMS100eth.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::CLMS100Eth::CLMS100Eth ( string  _ip = 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.

virtual mrpt::hwdrivers::CLMS100Eth::~CLMS100Eth (  )  [virtual]

Destructor.

Close communcation with the device, and free memory.


Member Function Documentation

bool mrpt::hwdrivers::CLMS100Eth::checkIsConnected (  )  [private]
bool mrpt::hwdrivers::CLMS100Eth::decodeLogIn ( char *  msg  )  [private]
bool mrpt::hwdrivers::CLMS100Eth::decodeScan ( char *  buf,
CObservation2DRangeScan outObservation 
) [private]
bool mrpt::hwdrivers::CLMS100Eth::decodeScanCfg ( istringstream &  stream  )  [private]
bool mrpt::hwdrivers::CLMS100Eth::decodeScanDataCfg ( istringstream &  stream  )  [private]
void mrpt::hwdrivers::CLMS100Eth::doProcessSimple ( bool &  outThereIsObservation,
CObservation2DRangeScan outObservation,
bool &  hardwareError 
) [virtual]

This function acquire a laser scan from the device.

If an error occured, hardwareError will be set to true. The new laser scan will be stored in the outObservation argument.

Exceptions:
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).

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.

void mrpt::hwdrivers::CLMS100Eth::generateCmd ( const char *  cmd  )  [private]
void mrpt::hwdrivers::CLMS100Eth::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
) [protected, virtual]

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

Implements mrpt::hwdrivers::CGenericSensor.

void mrpt::hwdrivers::CLMS100Eth::roughPrint ( char *  msg  )  [private]
void mrpt::hwdrivers::CLMS100Eth::sendCommand ( const char *  cmd  )  [private]
void mrpt::hwdrivers::CLMS100Eth::setSensorPose ( CPose3D _pose  ) 

A method to set the sensor pose on the robot.

bool mrpt::hwdrivers::CLMS100Eth::turnOff (  )  [virtual]

This method could be called manually to stop communication with the device.

Method is also called by destructor.

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.

bool mrpt::hwdrivers::CLMS100Eth::turnOn (  )  [virtual]

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

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.


Member Data Documentation

Definition at line 118 of file CLMS100eth.h.

Definition at line 123 of file CLMS100eth.h.

Definition at line 113 of file CLMS100eth.h.

Definition at line 115 of file CLMS100eth.h.

Definition at line 116 of file CLMS100eth.h.

Definition at line 111 of file CLMS100eth.h.

Definition at line 122 of file CLMS100eth.h.

unsigned int mrpt::hwdrivers::CLMS100Eth::m_port [private]

Definition at line 112 of file CLMS100eth.h.

Definition at line 117 of file CLMS100eth.h.

Definition at line 121 of file CLMS100eth.h.

Definition at line 119 of file CLMS100eth.h.

Definition at line 120 of file CLMS100eth.h.

Definition at line 114 of file CLMS100eth.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010