Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArSick Class Reference

The sick driver. More...

#include <ArSick.h>

Inheritance diagram for ArSick:

ArRangeDeviceThreaded ArRangeDevice List of all members.

Public Types

enum  BaudRate { BAUD9600, BAUD19200, BAUD38400 }
enum  Degrees { DEGREES180, DEGREES100 }
enum  Increment { INCREMENT_ONE, INCREMENT_HALF }

Public Member Functions

void addConnectCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a connect callback.
void addDataCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback that is called whenever a laser packet is processed.
void addDisconnectNormallyCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback for when disconnect is called while connected.
void addDisconnectOnErrorCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback for when disconnection happens because of an error.
void addFailedConnectCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a callback for when a connection to the robot is failed.
void addIgnoreReading (double ignoreReading)
 Adds a degree at which to ignore readings (within 1 degree).
virtual void applyTransform (ArTransform trans, bool doCumulative=true)
 Applies a transform to the buffers.
 ArSick (size_t currentBufferSize=361, size_t cumulativeBufferSize=0, const char *name="laser", bool addAriaExitCB=true)
 Constructor.
bool asyncConnect (void)
 Connect to the laser asyncronously.
bool blockingConnect (void)
 Connect to the laser while blocking.
void clearIgnoreReadings (void)
 Clears the degrees we ignore readings at.
void configure (bool useSim=false, bool powerControl=true, bool laserFlipped=false, BaudRate baud=BAUD38400, Degrees deg=DEGREES180, Increment incr=INCREMENT_ONE)
 Configure the laser before connecting to it.
void configureShort (bool useSim=false, BaudRate baud=BAUD38400, Degrees deg=DEGREES180, Increment incr=INCREMENT_ONE)
 Shorter configure for the laser (settings are overridden by the .p file).
bool disconnect (bool doNotLockRobotForSim=false)
 Disconnect from the laser.
void dropConnection (void)
void failedConnect (void)
int getConnectionTimeoutTime (void)
 Gets the time without a response until connection assumed lost.
Degrees getDegrees (void)
 Gets the degrees the laser is scanning.
ArDeviceConnectiongetDeviceConnection (void)
 Gets the device connection.
int getFilterCleanCumulativeInterval (void)
 Cumulative readings are cleaned every this number of milliseconds.
double getFilterCumulativeCleanDist (void)
 Cumulative readings that are this close to current beams are discarded.
double getFilterCumulativeInsertMaxDist (void)
 Cumulative readings must be taken within this distance to the robot to be added.
int getFilterCumulativeMaxAge (void)
double getFilterCumulativeMaxDist (void)
 You should see getMaxDistToKeepCumulative (it replaces this).
double getFilterCumulativeNearDist (void)
 Cumulative readings closer than this are discarded as too close.
double getFilterNearDist (void)
 Current readings closer than this are discarded as too close.
const std::list< double > * getIgnoreReadings (void) const
 Gets the list of readings that we ignore.
Increment getIncrement (void)
 Gets the amount each scan increments.
ArTime getLastReadingTime (void)
 Gets the time data was last receieved.
unsigned int getMinRange (void)
 Gets the minimum range for this device (defaults to 100 mm).
ArPose getSensorPosition ()
 Gets the position of the laser on the robot.
double getSensorPositionTh ()
 Gets the heading of the laser on the robot.
double getSensorPositionX ()
 Gets the X position of the laser on the robot.
double getSensorPositionY ()
 Gets the Y position of the laser on the robot.
int getSickPacCount ()
 Gets the number of laser packets received in the last second.
int internalConnectHandler (void)
 An internal function, single loop event to connect to laser.
bool internalConnectSim (void)
bool isConnected (void)
 Sees if this is connected to the laser.
bool isControllingPower (void)
 Gets whether the computer is controling laser power or not.
bool isLaserFlipped (void)
 Gets whether the laser is flipped over or not.
bool isUsingSim (void)
 Gets whether the laser is simulated or not.
void madeConnection (void)
void processPacket (ArSickPacket *packet, ArPose pose, ArPose encoderPose, unsigned int counter, bool deinterlace, ArPose deinterlaceDelta)
void remConnectCB (ArFunctor *functor)
 Adds a disconnect callback.
void remDataCB (ArFunctor *functor)
 Removes a callback that is called whenever a laser packet is processed.
void remDisconnectNormallyCB (ArFunctor *functor)
 Removes a callback for when disconnect is called while connected.
void remDisconnectOnErrorCB (ArFunctor *functor)
 Removes a callback for when disconnection happens because of an error.
void remFailedConnectCB (ArFunctor *functor)
 Removes a callback for when a connection to the robot is failed.
void robotConnectCallback (void)
void runOnce (bool lockRobot)
bool runOnRobot (void)
 Runs the laser off of the robot.
virtual void * runThread (void *arg)
void sensorInterpCallback (void)
void setConnectionTimeoutTime (int mSecs)
 Sets the time without a response until connection assumed lost.
void setDeviceConnection (ArDeviceConnection *conn)
 Sets the device connection.
void setFilterCleanCumulativeInterval (int milliSeconds)
 Cumulative readings are cleaned every this number of milliseconds.
void setFilterCumulativeCleanDist (double dist)
 Cumulative readings that are this close to current beams are discarded.
void setFilterCumulativeInsertMaxDist (double dist)
 Cumulative readings must be taken within this distance to the robot to be added.
void setFilterCumulativeMaxAge (int seconds)
void setFilterCumulativeMaxDist (double dist)
 You should see setMaxDistToKeepCumulative (it replaces this).
void setFilterCumulativeNearDist (double dist)
 Cumulative readings closer than this are discarded as too close.
void setFilterNearDist (double dist)
 Current readings closer than this are discarded as too close.
void setIsControllingPower (bool controlPower)
 Sets whether the computer is controling laser power or not.
void setIsLaserFlipped (bool laserFlipped)
 Sets whether the laser is flipped over or not.
void setIsUsingSim (bool usingSim)
 Sets whether the laser is simulated or not.
void setMinRange (unsigned int minRange)
 Sets the maximum range for this device (defaults to 100 mm).
virtual void setRobot (ArRobot *robot)
 Sets the robot this device is attached to.
void setSensorPosition (ArPose pose)
 Sets the position of the laser on the robot.
void setSensorPosition (double x, double y, double th)
 Sets the position of the laser on the robot.
bool simPacketHandler (ArRobotPacket *packet)
bool tryingToConnect (void)
 Sees if this is trying to connect to the laser at the moment.
virtual ~ArSick ()
 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 filterAddAndCleanCumulative (double x, double y, bool clean)
 Internal function for managing the cumulative.
void filterFarAndOldCumulative (void)
 Internal function for managing the cumulative.
void filterReadings ()
 Internal function for filtering the raw readings and updating buffers.
void switchState (State state)
 Internal function for switching states.

Protected Attributes

ArRetFunctor1C< bool, ArSick,
bool > 
myAriaExitCB
std::list< ArSensorReading * > * myAssembleReadings
BaudRate myBaud
ArDeviceConnectionmyConn
std::list< ArFunctor * > myConnectCBList
ArMutex myConnLock
std::list< ArSensorReading * > * myCurrentReadings
std::list< ArFunctor * > myDataCBList
Degrees myDegrees
std::list< ArFunctor * > myDisconnectNormallyCBList
std::list< ArFunctor * > myDisconnectOnErrorCBList
std::list< ArFunctor * > myFailedConnectCBList
int myFilterCleanCumulativeInterval
double myFilterCumulativeCleanDist
double myFilterCumulativeInsertMaxDist
double myFilterCumulativeNearDist
double myFilterNearDist
double myFilterSquaredCumulativeCleanDist
double myFilterSquaredCumulativeInsertMaxDist
double myFilterSquaredCumulativeNearDist
std::list< double > myIgnoreReadings
 Readings we ignore.
Increment myIncrement
double myIncrementAmount
bool myInterpolation
std::list< ArSensorReading
* >::iterator 
myIter
bool myLaserFlipped
ArTime myLastCleanedCumulative
ArTime myLastReading
unsigned int myMinRange
double myOffsetAmount
ArSickPacket myPacket
std::list< ArSickPacket * > myPackets
bool myPowerControl
bool myProcessImmediately
bool myRealConfigured
ArFunctorC< ArSickmyRobotConnectCB
bool myRunInOwnThread
bool myRunningOnRobot
ArFunctorC< ArSickmySensorInterpCB
ArPose mySensorPose
int mySickPacCount
int mySickPacCurrentCount
ArSickPacketReceiver mySickPacketReceiver
unsigned int mySimPacketCounter
ArTransform mySimPacketEncoderTrans
ArRetFunctor1C< bool, ArSick,
ArRobotPacket * > 
mySimPacketHandler
ArPose mySimPacketStart
ArTransform mySimPacketTrans
bool myStartConnect
State myState
ArMutex myStateMutex
ArTime myStateStart
time_t myTimeLastSickPacket
int myTimeoutTime
unsigned int myTotalNumReadings
bool myUseSim
unsigned int myWhichReading

Detailed Description

The sick driver.

Definition at line 39 of file ArSick.h.


Member Enumeration Documentation

enum ArSick::BaudRate
 

Enumeration values:
BAUD9600  9600 Baud
BAUD19200  19200 Baud
BAUD38400  38400 Baud

Definition at line 42 of file ArSick.h.

enum ArSick::Degrees
 

Enumeration values:
DEGREES180  180 Degrees
DEGREES100  100 Degrees

Definition at line 47 of file ArSick.h.

enum ArSick::Increment
 

Enumeration values:
INCREMENT_ONE  One degree increments.
INCREMENT_HALF  Half a degree increments.

Definition at line 51 of file ArSick.h.

enum ArSick::State [protected]
 

Enumeration values:
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.

Definition at line 268 of file ArSick.h.


Member Function Documentation

void ArSick::addConnectCB ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST
 

Adds a connect callback.

Adds a connect callback, which is an ArFunctor, created as an ArFunctorC. The entire list of connect callbacks is called when a connection is made with the laser. If you have some sort of module that adds a callback, that module must remove the callback when the module is removed.

Parameters:
functorfunctor created from ArFunctorC which refers to the function to call.
position whether to place the functor first or last
See also:
remConnectCB

Definition at line 1259 of file ArSick.cpp.

References ArLog::log().

void ArSick::addDataCB ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST
 

Adds a callback that is called whenever a laser packet is processed.

Adds a data callback, which is an ArFunctor, created as an ArFunctorC. Whenever a new reading is processed this callback is called. You can then get the raw readings with getRawReadings.

Parameters:
functorfunctor created from ArFunctorC which refers to the function to call.
position whether to place the functor first or last
See also:
remConnectCB

Definition at line 1396 of file ArSick.cpp.

References ArLog::log().

void ArSick::addDisconnectNormallyCB ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST
 

Adds a callback for when disconnect is called while connected.

Adds a disconnect normally callback,which is an ArFunctor, created as an ArFunctorC. This whole list of disconnect normally callbacks is called when something calls disconnect if the instance isConnected. If there is no connection and disconnect is called nothing is done. If you have some sort of module that adds a callback, that module must remove the callback when the module is removed.

Parameters:
functor functor created from ArFunctorC which refers to the function to call.
position whether to place the functor first or last
See also:
remFailedConnectCB

Definition at line 1328 of file ArSick.cpp.

References ArLog::log().

void ArSick::addDisconnectOnErrorCB ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST
 

Adds a callback for when disconnection happens because of an error.

Adds a disconnect on error callback, which is an ArFunctor, created as an ArFunctorC. This whole list of disconnect on error callbacks is called when ARIA loses connection to a laser because of an error. This can occur if the physical connection (ie serial cable) between the laser and the computer is severed/disconnected, or if the laser is turned off. Note that if the link between the two is lost the ARIA assumes it is temporary until it reaches a timeout value set with setConnectionTimeoutTime. If you have some sort of module that adds a callback, that module must remove the callback when the module removed.

Parameters:
functor functor created from ArFunctorC which refers to the function to call.
position whether to place the functor first or last
See also:
remFailedConnectCB

Definition at line 1365 of file ArSick.cpp.

References ArLog::log().

void ArSick::addFailedConnectCB ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST
 

Adds a callback for when a connection to the robot is failed.

Adds a failed connect callback,which is an ArFunctor, created as an ArFunctorC. This whole list of failed connect callbacks is called when an attempt is made to connect to the laser, but fails. The usual reason for this failure is either that there is no laser/sim where the connection was tried to be made. If you have some sort of module that adds a callback, that module must remove the callback when the module removed.

Parameters:
functor functor created from ArFunctorC which refers to the function to call.
position whether to place the functor first or last
See also:
remFailedConnectCB

Definition at line 1294 of file ArSick.cpp.

References ArLog::log().

void ArSick::applyTransform ArTransform  trans,
bool  doCumulative = true
[virtual]
 

Applies a transform to the buffers.

Applies a transform to the buffers.. this is mostly useful for translating to/from local/global coords, but may have other uses. This is different from the class because it also transforms the raw readings.

Parameters:
trans the transform to apply to the data
doCumulative whether to transform the cumulative buffer or not

Reimplemented from ArRangeDevice.

Definition at line 2129 of file ArSick.cpp.

References ArRangeBuffer::applyTransform().

bool ArSick::asyncConnect void   ) 
 

Connect to the laser asyncronously.

This does not lockDevice the laser, but you should lockDevice the laser before you try to connect. Also note that if you are connecting to the sim the laser MUST be unlocked so that this can lock the laser and send the commands to the sim. To be connected successfully, either the useSim must be set from configure (and the laser must be connected to a simulator, or this will return true but connection will fail), the device must have been run or runasync, or the device must have been runOnLaser.

Returns:
true if a connection will be able to be tried, false otherwise
See also:
configure, ArRangeDeviceThreaded::run, ArRangeDeviceThreaded::runAsync, runOnRobot

Definition at line 1600 of file ArSick.cpp.

References ArRangeDeviceThreaded::getRunning(), ArLog::log(), and STATE_CONNECTED.

bool ArSick::blockingConnect void   ) 
 

Connect to the laser while blocking.

lockDevice s the laser, and then makes a connection. If it is connecting to the simulator (set with the useSim flag in configure) then it will lock the laser and send the commands to the sim. If where you are calling from has the laser locked, make sure you unlock it before calling this function.

Returns:
true if a connection was made, false otherwise

Definition at line 1558 of file ArSick.cpp.

References ArRangeDeviceThreaded::getRunningWithLock(), internalConnectHandler(), internalConnectSim(), ArMutex::lock(), ArRangeDeviceThreaded::lockDevice(), ArUtil::sleep(), STATE_INIT, switchState(), ArMutex::unlock(), and ArRangeDeviceThreaded::unlockDevice().

void ArSick::configure bool  useSim = false,
bool  powerControl = true,
bool  laserFlipped = false,
BaudRate  baud = BAUD38400,
Degrees  deg = DEGREES180,
Increment  incr = INCREMENT_ONE
 

Configure the laser before connecting to it.

You must lockDevice the laser or not have the laser being poked at by multiple threads before you use htis function call

Definition at line 292 of file ArSick.cpp.

References DEGREES100, DEGREES180, INCREMENT_HALF, INCREMENT_ONE, and ArLog::log().

Referenced by ArSick().

void ArSick::configureShort bool  useSim = false,
BaudRate  baud = BAUD38400,
Degrees  deg = DEGREES180,
Increment  incr = INCREMENT_ONE
 

Shorter configure for the laser (settings are overridden by the .p file).

You must lockDevice the laser or not have the laser being poked at by multiple threads before you use htis function call

Definition at line 337 of file ArSick.cpp.

References DEGREES100, DEGREES180, INCREMENT_HALF, INCREMENT_ONE, ArRobot::isConnected(), ArLog::log(), and robotConnectCallback().

bool ArSick::disconnect bool  doNotLockRobotForSim = false  ) 
 

Disconnect from the laser.

Disconnects from the laser. You should lockDevice the laser before calling this function. Also if you are using the simulator it will lock the robot so it can send the command to the simulator, so you should make sure the robot is unlocked.

Parameters:
doNotLockRobotForSim if this is true, this will not lock the robot if its trying to send a command to the sim... ONLY do this if you are calling this from within the robots sync loop (ie from a sync task, sensor interp task, or user task)
Returns:
true if it could disconnect from the laser cleanly

Definition at line 1472 of file ArSick.cpp.

References ArBasePacket::byteToBuf(), ArDeviceConnection::close(), ArRobot::comInt(), ArBasePacket::empty(), ArSickPacket::finalizePacket(), ArBasePacket::getBuf(), ArBasePacket::getLength(), ArRobot::lock(), ArMutex::lock(), ArRangeDeviceThreaded::lockDevice(), ArLog::log(), ArSickPacketReceiver::receivePacket(), ArRangeBuffer::reset(), ArSerialConnection::setBaud(), ArUtil::sleep(), STATE_CONNECTED, STATE_NONE, ArBasePacket::uByteToBuf(), ArRobot::unlock(), ArMutex::unlock(), ArRangeDeviceThreaded::unlockDevice(), and ArDeviceConnection::write().

Referenced by runThread(), and ~ArSick().

void ArSick::dropConnection void   ) 
 

Internal function, shouldn't be used, drops the conn because of error

Definition at line 1417 of file ArSick.cpp.

References ArDeviceConnection::close(), ArLog::log(), ArRangeBuffer::reset(), STATE_CONNECTED, STATE_NONE, and switchState().

Referenced by runOnce().

void ArSick::failedConnect void   ) 
 

Internal function, shouldn't be used, denotes the conn failed

Definition at line 1437 of file ArSick.cpp.

References ArDeviceConnection::close(), STATE_NONE, and switchState().

Referenced by internalConnectHandler(), and internalConnectSim().

void ArSick::filterReadings  )  [protected]
 

Internal function for filtering the raw readings and updating buffers.

filter readings here, from raw current buffer to filtered current buffer of the range device object, and then to the cumulative buffer

current buffer filtering is to eliminate max (null) readings, and compress close readings

cumulative buffer filtering is to replace readings within the scope of the current sensor set

Definition at line 555 of file ArSick.cpp.

References ArRangeBuffer::beginRedoBuffer(), ArRangeBuffer::endRedoBuffer(), filterAddAndCleanCumulative(), ArRangeBuffer::getBuffer(), ArSensorReading::getEncoderPoseTaken(), ArSensorReading::getIgnoreThisReading(), ArSensorReading::getPoseTaken(), ArSensorReading::getX(), ArSensorReading::getY(), ArTime::mSecSince(), ArRangeBuffer::redoReading(), ArRangeBuffer::setEncoderPoseTaken(), ArRangeBuffer::setPoseTaken(), and ArTime::setToNow().

Referenced by processPacket(), and simPacketHandler().

int ArSick::getConnectionTimeoutTime void   ) 
 

Gets the time without a response until connection assumed lost.

Gets the number of seconds to go without response from the laser until it is assumed tha tthe connection with the laser has been broken and the disconnect on error events will happen.

Definition at line 264 of file ArSick.cpp.

int ArSick::getFilterCleanCumulativeInterval void   ) 
 

Cumulative readings are cleaned every this number of milliseconds.

The cumulative readings are check against the current buffer every this number of milliseconds... if 0 its cleaned every time there are readings.

Definition at line 1995 of file ArSick.cpp.

double ArSick::getFilterCumulativeCleanDist void   ) 
 

Cumulative readings that are this close to current beams are discarded.

When the readings are cleaned the current readings are compared against the cumulative readings... if a beam of a current reading comes within this distance of a cumulative reading that cumulative reading is removed. If this value is 0 then there is no filtering of this kind.

Definition at line 1970 of file ArSick.cpp.

double ArSick::getFilterCumulativeInsertMaxDist void   ) 
 

Cumulative readings must be taken within this distance to the robot to be added.

When readings are put into the cumulative buffer they must be within this distance of the robot. If this value is 0 then there is no filtering of this kind.

Definition at line 1914 of file ArSick.cpp.

int ArSick::getFilterCumulativeMaxAge void   )  [inline]
 

you should use getMaxSecondsToKeepCumulative instead, (replaces this)

Deprecated:

Definition at line 150 of file ArSick.h.

References ArRangeDevice::getMaxSecondsToKeepCumulative().

double ArSick::getFilterCumulativeNearDist void   ) 
 

Cumulative readings closer than this are discarded as too close.

When readings are put into the cumulative buffer they must be this far from all the other cumulative readings or they aren't put in. If this value is 0 then there is no filtering of this kind.

Definition at line 1940 of file ArSick.cpp.

double ArSick::getFilterNearDist void   ) 
 

Current readings closer than this are discarded as too close.

When readings are put into the current buffer they are compared against the last reading and must be at least this distance away from the last reading. If this value is 0 then there is no filtering of this kind.

Definition at line 1887 of file ArSick.cpp.

int ArSick::internalConnectHandler void   ) 
 

An internal function, single loop event to connect to laser.

Returns:
0 if its still trying to connect, 1 if it connected, 2 if it failed

Definition at line 740 of file ArSick.cpp.

References BAUD19200, BAUD38400, BAUD9600, ArBasePacket::bufToByte(), ArBasePacket::byte2ToBuf(), ArBasePacket::byteToBuf(), ArBasePacket::empty(), failedConnect(), ArSickPacket::finalizePacket(), ArBasePacket::getBuf(), ArSickPacket::getID(), ArBasePacket::getLength(), ArDeviceConnection::getStatus(), ArLog::log(), madeConnection(), ArTime::mSecSince(), ArSickPacketReceiver::receivePacket(), ArTime::secSince(), ArSerialConnection::setBaud(), ArUtil::sleep(), STATE_CHANGE_BAUD, STATE_CONFIGURE, STATE_CONNECTED, STATE_INIT, STATE_INSTALL_MODE, STATE_NONE, STATE_SET_MODE, STATE_START_READINGS, STATE_WAIT_FOR_CONFIGURE_ACK, STATE_WAIT_FOR_INSTALL_MODE_ACK, STATE_WAIT_FOR_POWER_ON, STATE_WAIT_FOR_SET_MODE_ACK, STATE_WAIT_FOR_START_ACK, ArBasePacket::strNToBuf(), switchState(), ArBasePacket::uByte2ToBuf(), ArBasePacket::uByteToBuf(), and ArDeviceConnection::write().

Referenced by blockingConnect(), and runThread().

bool ArSick::internalConnectSim void   ) 
 

An internal function

Definition at line 1217 of file ArSick.cpp.

References ArRobot::comInt(), failedConnect(), ArRobot::lock(), ArRangeDeviceThreaded::lockDevice(), ArLog::log(), madeConnection(), STATE_CONNECTED, STATE_NONE, switchState(), ArRobot::unlock(), and ArRangeDeviceThreaded::unlockDevice().

Referenced by blockingConnect(), and runThread().

void ArSick::madeConnection void   ) 
 

Internal function, shouldn't be used, does the after conn stuff

Definition at line 1450 of file ArSick.cpp.

References ArTime::setToNow().

Referenced by internalConnectHandler(), and internalConnectSim().

void ArSick::processPacket ArSickPacket packet,
ArPose  pose,
ArPose  encoderPose,
unsigned int  counter,
bool  deinterlace,
ArPose  deinterlaceDelta
 

The internal function which processes the sickPackets

Definition at line 1639 of file ArSick.cpp.

References ArMath::addAngle(), filterReadings(), ArPose::getTh(), ArPose::getX(), ArPose::getY(), ArLog::log(), myIgnoreReadings, ArSensorReading::newData(), ArSensorReading::resetSensorPosition(), ArMath::roundInt(), ArTime::setToNow(), and ArTransform::setTransform().

Referenced by runOnce(), and sensorInterpCallback().

void ArSick::remConnectCB ArFunctor functor  ) 
 

Adds a disconnect callback.

Parameters:
functor the functor to remove from the list of connect callbacks
See also:
addConnectCB

Definition at line 1275 of file ArSick.cpp.

void ArSick::remDataCB ArFunctor functor  ) 
 

Removes a callback that is called whenever a laser packet is processed.

Parameters:
functor the functor to remove from the list of data callbacks
See also:
addDataCB

Definition at line 1412 of file ArSick.cpp.

void ArSick::remDisconnectNormallyCB ArFunctor functor  ) 
 

Removes a callback for when disconnect is called while connected.

Parameters:
functor the functor to remove from the list of connect callbacks
See also:
addDisconnectNormallyCB

Definition at line 1344 of file ArSick.cpp.

void ArSick::remDisconnectOnErrorCB ArFunctor functor  ) 
 

Removes a callback for when disconnection happens because of an error.

Parameters:
functor the functor to remove from the list of connect callbacks
See also:
addDisconnectOnErrorCB

Definition at line 1381 of file ArSick.cpp.

void ArSick::remFailedConnectCB ArFunctor functor  ) 
 

Removes a callback for when a connection to the robot is failed.

Parameters:
functor the functor to remove from the list of connect callbacks
See also:
addFailedConnectCB

Definition at line 1310 of file ArSick.cpp.

void ArSick::robotConnectCallback void   ) 
 

Internal function, shouldn't be used, gets params from the robot

Definition at line 105 of file ArSick.cpp.

References ArArgumentBuilder::add(), addIgnoreReading(), clearIgnoreReadings(), DEGREES100, DEGREES180, ArArgumentBuilder::getArgc(), ArArgumentBuilder::getArgDouble(), ArRobotParams::getLaserFlipped(), ArRobotParams::getLaserIgnore(), ArRobotParams::getLaserPowerControlled(), ArRobotParams::getLaserTh(), ArRobotParams::getLaserX(), ArRobotParams::getLaserY(), ArRobot::getRobotParams(), INCREMENT_HALF, INCREMENT_ONE, ArArgumentBuilder::isArgDouble(), ArRobot::isConnected(), ArLog::log(), and setSensorPosition().

Referenced by configureShort(), and setRobot().

void ArSick::runOnce bool  lockRobot  ) 
 

The internal function that gets does the work

Definition at line 1780 of file ArSick.cpp.

References ArTransform::doInvTransform(), dropConnection(), ArRobot::getCounter(), ArRobot::getEncoderPoseInterpPosition(), ArRobot::getEncoderTransform(), ArRobot::getPose(), ArRobot::getPoseInterpPosition(), ArSickPacket::getTimeReceived(), ArMutex::lock(), ArRobot::lock(), ArRangeDeviceThreaded::lockDevice(), ArTime::mSecSince(), processPacket(), ArSickPacketReceiver::receivePacket(), STATE_CONNECTED, ArMutex::unlock(), ArRobot::unlock(), and ArRangeDeviceThreaded::unlockDevice().

Referenced by runThread(), and sensorInterpCallback().

bool ArSick::runOnRobot void   ) 
 

Runs the laser off of the robot.

This sets up a sensor interp task on the robot, which is where the robot will be driven from. Note that the device must have been added to the robot already so that the device has a pointer to the robot. You should lock the robot and lockDevice the laser before doing this if other things are running already.

Definition at line 1626 of file ArSick.cpp.

References ArRangeDeviceThreaded::getRunning(), and ArRangeDeviceThreaded::stopRunning().

void * ArSick::runThread void *  arg  )  [virtual]
 

The internal function used by the ArRangeDeviceThreaded

Implements ArRangeDeviceThreaded.

Definition at line 2075 of file ArSick.cpp.

References disconnect(), ArRangeDeviceThreaded::getRunningWithLock(), internalConnectHandler(), internalConnectSim(), isConnected(), ArMutex::lock(), ArRangeDeviceThreaded::lockDevice(), runOnce(), ArUtil::sleep(), STATE_INIT, switchState(), ArMutex::unlock(), and ArRangeDeviceThreaded::unlockDevice().

void ArSick::sensorInterpCallback void   ) 
 

The function called if the laser isn't running in its own thread and isn't simulated

Definition at line 2002 of file ArSick.cpp.

References ArTime::addMSec(), ArTransform::doInvTransform(), ArRobot::getCounter(), ArRobot::getEncoderPoseInterpPosition(), ArRobot::getPoseInterpPosition(), ArSickPacket::getTimeReceived(), INCREMENT_HALF, ArRobot::isConnected(), ArRangeDeviceThreaded::lockDevice(), ArLog::log(), processPacket(), runOnce(), ArTransform::setTransform(), and ArRangeDeviceThreaded::unlockDevice().

void ArSick::setConnectionTimeoutTime int  mSecs  ) 
 

Sets the time without a response until connection assumed lost.

Sets the number of seconds to go without a response from the laser until it is assumed that the connection with the laser has been broken and the disconnect on error events will happen.

Parameters:
seconds if seconds is 0 then the connection timeout feature will be disabled, otherwise disconnect on error will be triggered after this number of seconds...

Definition at line 251 of file ArSick.cpp.

void ArSick::setFilterCleanCumulativeInterval int  milliSeconds  ) 
 

Cumulative readings are cleaned every this number of milliseconds.

The cumulative readings are check against the current buffer every this number of milliseconds... if 0 its cleaned every time there are readings.

Definition at line 1980 of file ArSick.cpp.

References ArLog::log().

Referenced by ArSick().

void ArSick::setFilterCumulativeCleanDist double  dist  ) 
 

Cumulative readings that are this close to current beams are discarded.

When the readings are cleaned the current readings are compared against the cumulative readings... if a beam of a current reading comes within this distance of a cumulative reading that cumulative reading is removed. If this value is 0 then there is no filtering of this kind.

Definition at line 1952 of file ArSick.cpp.

References ArLog::log().

Referenced by ArSick().

void ArSick::setFilterCumulativeInsertMaxDist double  dist  ) 
 

Cumulative readings must be taken within this distance to the robot to be added.

When readings are put into the cumulative buffer they must be within this distance of the robot. If this value is 0 then there is no filtering of this kind.

Definition at line 1898 of file ArSick.cpp.

References ArLog::log().

Referenced by ArSick().

void ArSick::setFilterCumulativeMaxAge int  seconds  )  [inline]
 

you should use setMaxSecondsToKeepCumulative instead, (replaces this)

Deprecated:

Definition at line 145 of file ArSick.h.

References ArRangeDevice::setMaxSecondsToKeepCumulative().

Referenced by ArSick().

void ArSick::setFilterCumulativeNearDist double  dist  ) 
 

Cumulative readings closer than this are discarded as too close.

When readings are put into the cumulative buffer they must be this far from all the other cumulative readings or they aren't put in. If this value is 0 then there is no filtering of this kind.

Definition at line 1924 of file ArSick.cpp.

References ArLog::log().

Referenced by ArSick().

void ArSick::setFilterNearDist double  dist  ) 
 

Current readings closer than this are discarded as too close.

When readings are put into the current buffer they are compared against the last reading and must be at least this distance away from the last reading. If this value is 0 then there is no filtering of this kind.

Definition at line 1872 of file ArSick.cpp.

References ArLog::log().

Referenced by ArSick().

bool ArSick::simPacketHandler ArRobotPacket packet  ) 
 

The packet handler for when connected to the simulator

Definition at line 379 of file ArSick.cpp.

References ArTransform::doInvTransform(), filterReadings(), ArRobot::getCounter(), ArRobot::getEncoderTransform(), ArRobot::getPose(), ArPose::getTh(), ArRobot::getToGlobalTransform(), ArPose::getX(), ArPose::getY(), ArRangeDeviceThreaded::lockDevice(), ArLog::log(), myIgnoreReadings, ArSensorReading::newData(), ArSensorReading::resetSensorPosition(), ArMath::roundInt(), ArTime::setToNow(), and ArRangeDeviceThreaded::unlockDevice().


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:54 2005 for Aria by  doxygen 1.4.0