#include <ArRangeDevice.h>
Inheritance diagram for ArRangeDevice:
Public Member Functions | |
virtual void | addReading (double x, double y) |
Adds a reading to the buffer. | |
virtual void | applyTransform (ArTransform trans, bool doCumulative=true) |
Applies a transform to the buffers. | |
ArRangeDevice (size_t currentBufferSize, size_t cumulativeBufferSize, const char *name, unsigned int maxRange, int maxSecondsToKeepCurrent=0, int maxSecondsToKeepCumulative=0, double maxDistToKeepCumulative=0) | |
Constructor. | |
virtual void | clearCumulativeOlderThan (int milliSeconds) |
Clears all the cumulative readings older than this number of milliseconds. | |
virtual void | clearCumulativeOlderThanSeconds (int seconds) |
Clears all the cumulative readings older than this number of seconds. | |
virtual void | clearCumulativeReadings (void) |
Clears all the cumulative readings. | |
virtual void | clearCurrentReadings (void) |
Clears all the current readings. | |
virtual double | cumulativeReadingBox (double x1, double y1, double x2, double y2, ArPose *readingPos=NULL) const |
Gets the closest current reading from the given box region. | |
virtual double | cumulativeReadingPolar (double startAngle, double endAngle, double *angle=NULL) const |
Gets the closest cumulative reading in the given polar region. | |
virtual double | currentReadingBox (double x1, double y1, double x2, double y2, ArPose *readingPos=NULL) const |
Gets the closest current reading from the given box region. | |
virtual double | currentReadingPolar (double startAngle, double endAngle, double *angle=NULL) const |
Gets the closest current reading in the given polar region. | |
virtual std::list< ArPoseWithTime * > * | getCumulativeBuffer (void) |
Gets the current buffer of readings. | |
virtual const std::list< ArPoseWithTime * > * | getCumulativeBuffer (void) const |
Gets the current buffer of readings. | |
virtual std::vector< ArPoseWithTime > * | getCumulativeBufferAsVector (void) |
Gets the cumulative buffer of readings as a vector (for SWIG (python/java)). | |
virtual ArDrawingData * | getCumulativeDrawingData (void) |
Gets the data for drawing the cumulative buffer. | |
virtual ArRangeBuffer * | getCumulativeRangeBuffer (void) |
Gets the cumulative range buffer. | |
virtual const ArRangeBuffer * | getCumulativeRangeBuffer (void) const |
Gets the cumulative range buffer. | |
virtual std::list< ArPoseWithTime * > * | getCurrentBuffer (void) |
Gets the current buffer of readings. | |
virtual const std::list< ArPoseWithTime * > * | getCurrentBuffer (void) const |
Gets the current buffer of readings. | |
virtual std::vector< ArPoseWithTime > * | getCurrentBufferAsVector (void) |
Gets the current buffer of readings as a vector (for SWIG (python/java)). | |
virtual ArDrawingData * | getCurrentDrawingData (void) |
Gets the data for drawing the current buffer. | |
virtual ArRangeBuffer * | getCurrentRangeBuffer (void) |
Gets the current range buffer. | |
virtual const ArRangeBuffer * | getCurrentRangeBuffer (void) const |
Gets the current range buffer. | |
double | getMaxDistToKeepCumulative (void) |
sets the maximum distance cumulative readings can be from current pose | |
virtual unsigned int | getMaxRange (void) |
Gets the maximum range for this device. | |
int | getMaxSecondsToKeepCumulative (void) |
gets the maximum seconds to keep current readings around | |
int | getMaxSecondsToKeepCurrent (void) |
gets the maximum seconds to keep current readings around | |
virtual const char * | getName (void) const |
Gets the name of the device. | |
virtual const std::list< ArSensorReading * > * | getRawReadings (void) const |
Gets the raw unfiltered readings from the device. | |
virtual std::vector< ArSensorReading > * | getRawReadingsAsVector (void) |
Gets the raw unfiltered readings from the device into a vector for SWIG (python and java). | |
virtual ArRobot * | getRobot (void) |
Gets the robot this device is attached to. | |
virtual int | lockDevice () |
Lock this device. | |
virtual void | setCumulativeBufferSize (size_t size) |
Sets the size of the buffer for cumulative readings. | |
virtual void | setCumulativeDrawingData (ArDrawingData *data, bool takeOwnershipOfData) |
Sets the data for drawing the cumulative buffer (and if we own it). | |
virtual void | setCurrentBufferSize (size_t size) |
Sets the size of the buffer for current readings. | |
virtual void | setCurrentDrawingData (ArDrawingData *data, bool takeOwnershipOfData) |
Sets the data for drawing the current buffer (and if we own it). | |
void | setMaxDistToKeepCumulative (double maxDistToKeepCumulative) |
sets the maximum distance cumulative readings can be from current pose | |
virtual void | setMaxRange (unsigned int maxRange) |
Sets the maximum range for this device. | |
void | setMaxSecondsToKeepCumulative (int maxSecondsToKeepCumulative) |
gets the maximum seconds to keep cumulative readings around | |
void | setMaxSecondsToKeepCurrent (int maxSecondsToKeepCurrent) |
gets the maximum seconds to keep current readings around | |
virtual void | setRobot (ArRobot *robot) |
Sets the robot this device is attached to. | |
virtual int | tryLockDevice () |
Try to lock this device. | |
virtual int | unlockDevice () |
Unlock this device. | |
virtual | ~ArRangeDevice () |
Destructor. | |
Protected Member Functions | |
void | filterCallback (void) |
Protected Attributes | |
ArRangeBuffer | myCumulativeBuffer |
ArDrawingData * | myCumulativeDrawingData |
ArRangeBuffer | myCurrentBuffer |
ArDrawingData * | myCurrentDrawingData |
ArMutex | myDeviceMutex |
ArFunctorC< ArRangeDevice > | myFilterCB |
double | myMaxDistToKeepCumulative |
unsigned int | myMaxRange |
int | myMaxSecondsToKeepCumulative |
int | myMaxSecondsToKeepCurrent |
std::string | myName |
bool | myOwnCumulativeDrawingData |
bool | myOwnCurrentDrawingData |
std::list< ArSensorReading * > * | myRawReadings |
std::vector< ArSensorReading > | myRawReadingsVector |
ArRobot * | myRobot |
This class has two buffers, a current buffer for storing just recent (relevant) readings, and a cumulative buffer for a longer history... the sizes of both can be set in the constructor.
This class should be used for all sensors like lasers and sonar, also note that it has the locking functions for such a time when there is a device like a laser that runs in its own thread, so that every device can be locked and unlocked and the users don't have to worry about the detail, because of functions on the ArRobot structure which check all of the ArRangeDevice s attached to a robot.
Definition at line 52 of file ArRangeDevice.h.
|
Constructor.
Definition at line 55 of file ArRangeDevice.cpp. References setMaxDistToKeepCumulative(), setMaxSecondsToKeepCumulative(), and setMaxSecondsToKeepCurrent(). |
|
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
Reimplemented in ArSick. Definition at line 348 of file ArRangeDevice.cpp. References ArRangeBuffer::applyTransform(). |
|
Gets the closest current reading from the given box region. Gets the closest reading in a region defined by two points (opposeite points of a rectangle) out of the cumulative buffer.
Definition at line 325 of file ArRangeDevice.cpp. References ArRangeBuffer::getClosestBox(), getName(), ArRobot::getPose(), ArLog::log(), and ArPose::setPose(). Referenced by ArRobot::checkRangeDevicesCumulativeBox(). |
|
Gets the closest cumulative reading in the given polar region. Gets the closest reading in a region defined by startAngle going to endAngle... going counterclockwise (neg degrees to poseitive... with how the robot is set up, thats counterclockwise)... from -180 to 180... this means if you want the slice between 0 and 10 degrees, you must enter it as 0, 10, if you do 10, 0 you'll get the 350 degrees between 10 and 0... be especially careful with negative... for example -30 to -60 is everything from -30, around through 0, 90, and 180 back to -60... since -60 is actually to clockwise of -30
Definition at line 265 of file ArRangeDevice.cpp. References ArRangeBuffer::getClosestPolar(), getName(), ArRobot::getPose(), ArLog::log(), and ArPose::setPose(). Referenced by ArRobot::checkRangeDevicesCumulativePolar(). |
|
Gets the closest current reading from the given box region. Gets the closest reading in a region defined by two points (opposeite points of a rectangle) out of the current buffer.
Definition at line 296 of file ArRangeDevice.cpp. References ArRangeBuffer::getClosestBox(), getName(), ArRobot::getPose(), ArLog::log(), and ArPose::setPose(). Referenced by ArRobot::checkRangeDevicesCurrentBox(), and ArActionTriangleDriveTo::findTriangle(). |
|
Gets the closest current reading in the given polar region. Gets the closest reading in a region defined by startAngle going to endAngle... going counterclockwise (neg degrees to poseitive... with how the robot is set up, thats counterclockwise)... from -180 to 180... this means if you want the slice between 0 and 10 degrees, you must enter it as 0, 10, if you do 10, 0 you'll get the 350 degrees between 10 and 0... be especially careful with negative... for example -30 to -60 is everything from -30, around through 0, 90, and 180 back to -60... since -60 is actually to clockwise of -30
Definition at line 230 of file ArRangeDevice.cpp. References ArRangeBuffer::getClosestPolar(), getName(), ArRobot::getPose(), ArLog::log(), and ArPose::setPose(). Referenced by ArRobot::checkRangeDevicesCurrentPolar(). |
|
sets the maximum distance cumulative readings can be from current pose
Definition at line 198 of file ArRangeDevice.h. Referenced by ArSick::getFilterCumulativeMaxDist(). |
|
gets the maximum seconds to keep current readings around
Definition at line 180 of file ArRangeDevice.h. Referenced by ArSick::getFilterCumulativeMaxAge(). |
|
gets the maximum seconds to keep current readings around
Definition at line 163 of file ArRangeDevice.h. |
|
Gets the raw unfiltered readings from the device. The raw readings are the full set of unfiltered readings from the device, they are the latest reading, you should manipulate the list you get from this function, the only manipulation of this list should be done by the range device itself. Its only pointers for speed. NOTE that only the lasers have this implemented at the moment (ie ArSick) this was added to the base class for future lasers and that things like the sonar and bumpers don't have this implemented. At some later date this may be implemented for the sonar but is really meant for lasers (since a laser is more straight forward should be interchangeable between lasers and all the readings come in at once as opposed to a sonar where they come in a few at a time and code that works with a laser (for line finding and what not) won't work at all with the sonar) Definition at line 142 of file ArRangeDevice.h. |
|
Lock this device. If you are also inheriting an ASyncTask you MUST override this to use the lock from the ArASyncTask Reimplemented in ArRangeDeviceThreaded. Definition at line 242 of file ArRangeDevice.h. References ArMutex::lock(). Referenced by ArRobot::checkRangeDevicesCumulativeBox(), ArRobot::checkRangeDevicesCumulativePolar(), ArRobot::checkRangeDevicesCurrentBox(), ArRobot::checkRangeDevicesCurrentPolar(), ArSonarDevice::processReadings(), and ArForbiddenRangeDevice::processReadings(). |
|
Sets the size of the buffer for cumulative readings. If the new size is smaller than the current buffer it chops off the readings that are excess from the oldest readings... if the new size is larger then it just leaves room for the buffer to grow
Definition at line 202 of file ArRangeDevice.cpp. References ArRangeBuffer::setSize(). |
|
Sets the size of the buffer for current readings. If the new size is smaller than the current buffer it chops off the readings that are excess from the oldest readings... if the new size is larger then it just leaves room for the buffer to grow
Definition at line 191 of file ArRangeDevice.cpp. References ArRangeBuffer::setSize(). |
|
sets the maximum distance cumulative readings can be from current pose
Definition at line 189 of file ArRangeDevice.h. Referenced by ArRangeDevice(), ArSonarDevice::ArSonarDevice(), ArSonarDevice::setCumulativeMaxRange(), and ArSick::setFilterCumulativeMaxDist(). |
|
gets the maximum seconds to keep cumulative readings around
Definition at line 172 of file ArRangeDevice.h. Referenced by ArRangeDevice(), ArSonarDevice::ArSonarDevice(), and ArSick::setFilterCumulativeMaxAge(). |
|
gets the maximum seconds to keep current readings around
Definition at line 154 of file ArRangeDevice.h. Referenced by ArRangeDevice(), and ArSonarDevice::ArSonarDevice(). |
|
Try to lock this device. If you are also inheriting an ASyncTask you MUST override this to use the lock from the ArASyncTask Reimplemented in ArRangeDeviceThreaded. Definition at line 248 of file ArRangeDevice.h. References ArMutex::tryLock(). |
|
Unlock this device. If you are also inheriting an ASyncTask you MUST override this to use the lock from the ArASyncTask Reimplemented in ArRangeDeviceThreaded. Definition at line 254 of file ArRangeDevice.h. References ArMutex::unlock(). Referenced by ArRobot::checkRangeDevicesCumulativeBox(), ArRobot::checkRangeDevicesCumulativePolar(), ArRobot::checkRangeDevicesCurrentBox(), ArRobot::checkRangeDevicesCurrentPolar(), ArSonarDevice::processReadings(), and ArForbiddenRangeDevice::processReadings(). |