#include <ArLMS2xx.h>
Inheritance diagram for ArLMS2xx:
This class processes incoming data from a SICK LMS-200 laser rangefinding device in a background thread, and provides it through the standard ArRangeDevice API, to be used via ArRobot (see ArRobot::addRangeDevice()), used by an ArAction, or used directly.
An ArSick instance must be connected to the laser through a serial port (or simulator): the typical procedure is to allow your ArSimpleConnector to configure the laser based on the robot connection type and command line parameters; then initiate the ArSick background thread; and finally connect ArSick to the laser device. For example:
ArRobot robot; ArSick laser; ArSimpleConnector connector(...); ... Setup the simple connector and connect to the robot -- see the example programs. ... connector.setupLaser(&laser); laser.runAsync(); if(!laser.blockingConnect()) { // Error... ... } ...
The most important methods in this class are the constructor, runAsync(), blockingConnect(), getSensorPosition(), isConnected(), addConnectCB(), asyncConnect(), configure(), in addition to the ArRangeDevice interface.
Public Member Functions | |
ArLMS2xx (int laserNumber, const char *name="lms2xx", bool appendLaserNumberToName=true) | |
Constructor. | |
bool | asyncConnect (void) |
Connect to the laser asyncronously. | |
virtual bool | blockingConnect (void) |
Connect to the laser while blocking. | |
virtual bool | disconnect (void) |
Disconnect from the laser. | |
virtual bool | isConnected (void) |
Sees if this is connected to the laser. | |
virtual bool | isTryingToConnect (void) |
virtual void * | runThread (void *arg) |
virtual void | setDeviceConnection (ArDeviceConnection *conn) |
Sets the device connection. | |
virtual void | setRobot (ArRobot *robot) |
virtual | ~ArLMS2xx () |
Destructor. | |
Protected Types | |
enum | State { STATE_NONE, STATE_INIT, STATE_WAIT_FOR_POWER_ON, STATE_CHANGE_BAUD, STATE_CONFIGURE, STATE_WAIT_FOR_CONFIGURE_ACK, STATE_INSTALL_MODE, STATE_WAIT_FOR_INSTALL_MODE_ACK, STATE_SET_MODE, STATE_WAIT_FOR_SET_MODE_ACK, STATE_START_READINGS, STATE_WAIT_FOR_START_ACK, STATE_CONNECTED } |
Protected Member Functions | |
void | dropConnection (void) |
void | failedConnect (void) |
bool | finishParams (void) |
int | internalConnectHandler (void) |
An internal function, single loop event to connect to laser. | |
bool | internalConnectSim (void) |
bool | internalRunOnRobot (void) |
internal function to runOnRobot so that ArSick can do that while this class won't | |
virtual bool | laserCheckParams (void) |
virtual void | laserSetName (const char *name) |
void | madeConnection (void) |
void | processPacket (ArLMS2xxPacket *packet, ArPose pose, ArPose encoderPose, unsigned int counter, bool deinterlace, ArPose deinterlaceDelta) |
void | runOnce (bool lockRobot) |
void | sensorInterpCallback (void) |
bool | sickGetIsUsingSim (void) |
Internal function that gets whether the laser is simulated or not (just for the old ArSick). | |
void | sickSetIsUsingSim (bool usingSim) |
Internal function that sets whether the laser is simulated or not (just for the old ArSick). | |
bool | simPacketHandler (ArRobotPacket *packet) |
void | switchState (State state) |
Internal function for switching states. | |
Protected Attributes | |
ArRetFunctorC< bool, ArLMS2xx > | myAriaExitCB |
std::list< ArSensorReading * > * | myAssembleReadings |
std::list< ArSensorReading * > * | myCurrentReadings |
double | myIncrementAmount |
bool | myInterlaced |
bool | myInterpolation |
std::list< ArSensorReading * >::iterator | myIter |
ArLMS2xxPacketReceiver | myLMS2xxPacketReceiver |
int | myNumReflectorBits |
double | myOffsetAmount |
ArLMS2xxPacket | myPacket |
std::list< ArLMS2xxPacket * > | myPackets |
bool | myProcessImmediately |
ArFunctorC< ArLMS2xx > | myRobotConnectCB |
bool | myRunInOwnThread |
bool | myRunningOnRobot |
ArFunctorC< ArLMS2xx > | mySensorInterpCB |
unsigned int | mySimPacketCounter |
ArTransform | mySimPacketEncoderTrans |
ArRetFunctor1C< bool, ArLMS2xx, ArRobotPacket * > | mySimPacketHandler |
ArPose | mySimPacketStart |
ArTransform | mySimPacketTrans |
bool | myStartConnect |
State | myState |
ArMutex | myStateMutex |
ArTime | myStateStart |
unsigned int | myTotalNumReadings |
bool | myUseSim |
unsigned int | myWhichReading |
enum ArLMS2xx::State [protected] |
bool ArLMS2xx::finishParams | ( | void | ) | [protected] |
Finishes getting the unset parameters from the robot then setting some internal variables that need it
virtual void* ArLMS2xx::runThread | ( | void * | arg | ) | [virtual] |
The internal function used by the ArRangeDeviceThreaded
Implements ArRangeDeviceThreaded.