#include <ArSick.h>
Inheritance diagram for ArSick::
Public Types | |
enum | BaudRate { BAUD9600, BAUD19200, BAUD38400 } |
enum | Degrees { DEGREES180, DEGREES100 } |
enum | Increment { INCREMENT_ONE, INCREMENT_HALF } |
Public Methods | |
ArSick (size_t currentBufferSize=361, size_t cumulativeBufferSize=1448, const char *name="laser") | |
Constructor. | |
~ArSick (void) | |
Destructor. | |
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. More... | |
void | configureShort (bool useSim=false, BaudRate baud=BAUD38400, Degrees deg=DEGREES180, Increment incr=INCREMENT_ONE) |
Shorter configure for the laser. More... | |
void | setSensorPosition (double x, double y, double th) |
Sets the position of the laser on the robot. | |
void | setSensorPosition (ArPose pose) |
Sets the position of the laser on the robot. | |
ArPose | getSensorPosition () |
Gets the position 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. | |
double | getSensorPositionTh () |
Gets the heading of the laser on the robot. | |
bool | blockingConnect (void) |
Connect to the laser while blocking. More... | |
bool | asyncConnect (void) |
Connect to the laser asyncronously. More... | |
bool | disconnect (bool doNotLockRobotForSim=false) |
Disconnect from the laser. More... | |
void | setDeviceConnection (ArDeviceConnection *conn) |
Sets the device connection. | |
ArDeviceConnection * | getDeviceConnection (void) |
Gets the device connection. | |
bool | isConnected (void) |
Sees if this is connected to the laser. | |
bool | tryingToConnect (void) |
Sees if this is trying to connect to the laser at the moment. | |
bool | runOnRobot (void) |
Runs the laser off of the robot, advised. More... | |
int | getSickPacCount () |
Gets the number of laser packets received in the last second. | |
void | addConnectCB (ArFunctor *functor, ArListPos::Pos position) |
Adds a connect callback. More... | |
void | remConnectCB (ArFunctor *functor) |
Adds a disconnect callback. More... | |
void | addFailedConnectCB (ArFunctor *functor, ArListPos::Pos position) |
Adds a callback for when a connection to the robot is failed. More... | |
void | remFailedConnectCB (ArFunctor *functor) |
Removes a callback for when a connection to the robot is failed. More... | |
void | addDisconnectNormallyCB (ArFunctor *functor, ArListPos::Pos position) |
Adds a callback for when disconnect is called while connected. More... | |
void | remDisconnectNormallyCB (ArFunctor *functor) |
Removes a callback for when disconnect is called while connected. More... | |
void | addDisconnectOnErrorCB (ArFunctor *functor, ArListPos::Pos position) |
Adds a callback for when disconnection happens because of an error. More... | |
void | remDisconnectOnErrorCB (ArFunctor *functor) |
Removes a callback for when disconnection happens because of an error. More... | |
void | setConnectionTimeoutTime (int mSecs) |
Sets the time without a response until connection assumed lost. More... | |
int | getConnectionTimeoutTime (void) |
Gets the time without a response until connection assumed lost. More... | |
ArTime | getLastReadingTime (void) |
Gets the time data was last receieved. | |
void | setFilterNearDist (double dist) |
Sets the distance which two readings must be less than to be ignored. | |
double | getFilterNearDist (void) |
Gets the distance which two readings must be less than to be ignored. | |
bool | isUsingSim (void) |
Gets whether the laser is simulated or not. | |
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. | |
Degrees | getDegrees (void) |
Gets the degrees the laser is scanning. | |
Increment | getIncrement (void) |
Gets the amount each scan increments. | |
bool | simPacketHandler (ArRobotPacket *packet) |
The packet handler for when connected to the simulator. | |
void | sensorInterpCallback (void) |
The function called if the laser isn't running in its own thread and isn't simulated. | |
bool | internalConnectSim (void) |
An internal function. More... | |
int | internalConnectHandler (void) |
An internal function, single loop event to connect to laser. More... | |
virtual void * | runThread (void *arg) |
The internal function used by the ArRangeDeviceThreaded. | |
void | processPacket (ArSickPacket *packet, ArPose pose, ArPose encoderPose, unsigned int counter) |
The internal function which processes the sickPackets. | |
void | runOnce (bool lockRobot) |
The internal function that gets does the work. | |
virtual void | setRobot (ArRobot *robot) |
Sets the robot this device is attached to. | |
void | dropConnection (void) |
Internal function, shouldn't be used, drops the conn because of error. | |
void | failedConnect (void) |
Internal function, shouldn't be used, denotes the conn failed. | |
void | madeConnection (void) |
Internal function, shouldn't be used, does the after conn stuff. | |
void | robotConnectCallback (void) |
Internal function, shouldn't be used, gets params from the robot. | |
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 Methods | |
void | filterReadings () |
Internal function for filtering the raw readings and updating buffers. More... | |
void | switchState (State state) |
Internal function for switching states. |
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 |
|
Shorter configure for the laser. You must lockDevice the laser or not have the laser being poked at by multiple threads before you use htis function call |
|
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.
|
|
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 |
|
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. |
|
An internal function, single loop event to connect to laser.
|
|
An internal function. Sends the commands to the sim to start up the connection
|
|
Adds a disconnect callback.
|
|
Removes a callback for when disconnect is called while connected.
|
|
Removes a callback for when disconnection happens because of an error.
|
|
Removes a callback for when a connection to the robot is failed.
|
|
Runs the laser off of the robot, advised. 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. |
|
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.
|