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 :
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 wich is the SICK's ip adress (default is 192.168.0.1) TCP_port = 1234 ; an integer value : the tcp ip port on wich 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 recomended to configure the sensor via the the SICK software : SOPAS.
Definition at line 86 of file CLMS100eth.h.
#include <mrpt/hwdrivers/CLMS100eth.h>
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. | |
void | doProcess () |
This method should be called periodically. | |
void | initialize () |
Initialize the sensor according to the parameters previously read in the configuration file. | |
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 |
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.
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::doProcess | ( | ) | [virtual] |
This method should be called periodically.
Period depend on the process_rate in the configuration file.
Reimplemented from mrpt::hwdrivers::C2DRangeFinderAbstract.
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.
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::initialize | ( | ) | [virtual] |
Initialize the sensor according to the parameters previously read in the configuration file.
Reimplemented from mrpt::hwdrivers::CGenericSensor.
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.
double mrpt::hwdrivers::CLMS100Eth::m_angleResolution [private] |
Definition at line 132 of file CLMS100eth.h.
double mrpt::hwdrivers::CLMS100Eth::m_beamApperture [private] |
Definition at line 137 of file CLMS100eth.h.
Definition at line 127 of file CLMS100eth.h.
string mrpt::hwdrivers::CLMS100Eth::m_cmd [private] |
Definition at line 129 of file CLMS100eth.h.
bool mrpt::hwdrivers::CLMS100Eth::m_connected [private] |
Definition at line 130 of file CLMS100eth.h.
string mrpt::hwdrivers::CLMS100Eth::m_ip [private] |
Definition at line 125 of file CLMS100eth.h.
double mrpt::hwdrivers::CLMS100Eth::m_maxRange [private] |
Definition at line 136 of file CLMS100eth.h.
unsigned int mrpt::hwdrivers::CLMS100Eth::m_port [private] |
Definition at line 126 of file CLMS100eth.h.
unsigned int mrpt::hwdrivers::CLMS100Eth::m_scanFrequency [private] |
Definition at line 131 of file CLMS100eth.h.
Definition at line 135 of file CLMS100eth.h.
double mrpt::hwdrivers::CLMS100Eth::m_startAngle [private] |
Definition at line 133 of file CLMS100eth.h.
double mrpt::hwdrivers::CLMS100Eth::m_stopAngle [private] |
Definition at line 134 of file CLMS100eth.h.
bool mrpt::hwdrivers::CLMS100Eth::m_turnedOn [private] |
Definition at line 128 of file CLMS100eth.h.
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |