Aria: ArLMS2xx Class Reference

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArLMS2xx Class Reference

`#include <ArLMS2xx.h>`

Inheritance diagram for ArLMS2xx:

List of all members.

## Detailed Description

Interface to a SICK LMS-200 laser range device.

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.

Note:
  The "extra int" on the raw readings returned by ArRangeDevice::getRawReadings() is like other laser devices and is the reflectance value, if enabled, ranging between 0 and 255.

## 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

## Member Enumeration Documentation

enum ArLMS2xx::State`[protected]`

Enumerator:

  STATE_NONE | Nothing, haven't tried to connect or anything.
  STATE_INIT | Initializing the laser.
  STATE_WAIT_FOR_POWER_ON | Waiting for power on.
  STATE_CHANGE_BAUD | Change the baud, no confirm here.
  STATE_CONFIGURE | Send the width and increment to the laser.
  STATE_WAIT_FOR_CONFIGURE_ACK | Wait for the configuration Ack.
  STATE_INSTALL_MODE | Switch to install mode.
  STATE_WAIT_FOR_INSTALL_MODE_ACK | Wait until its switched to install mode.
  STATE_SET_MODE | Set the mode (mm/cm) and extra field bits.
  STATE_WAIT_FOR_SET_MODE_ACK | Waiting for set-mode ack.
  STATE_START_READINGS | Switch to monitoring mode.
  STATE_WAIT_FOR_START_ACK | Waiting for the switch-mode ack.
  STATE_CONNECTED | We're connected and getting readings.

## Member Function Documentation

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.

The documentation for this class was generated from the following file:

- ArLMS2xx.h