Aria
2.8.0
|
Keep track of recent sonar readings from a robot as an ArRangeDevice. More...
#include <ArSonarDevice.h>
Inherits ArRangeDevice.
Public Member Functions | |
virtual void | addReading (double x, double y) |
Adds sonar readings to the current and cumulative buffers Overrides the ArRangeDevice default action. More... | |
ArSonarDevice (size_t currentBufferSize=24, size_t cumulativeBufferSize=64, const char *name="sonar") | |
Constructor. | |
ArRetFunctor1< bool, ArPose > * | getIgnoreReadingCB (void) |
Gets the callback which if it returns true will ignore the reading. | |
void | processReadings (void) |
Grabs the new readings from the robot and adds them to the buffers (Primarily for internal use.) | |
void | setCumulativeMaxRange (double range) |
void | setIgnoreReadingCB (ArRetFunctor1< bool, ArPose > *ignoreReadingCB) |
Sets a callback which if it returns true will ignore the reading. | |
virtual void | setRobot (ArRobot *robot) |
Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task. More... | |
virtual | ~ArSonarDevice () |
Destructor. | |
Public Member Functions inherited from ArRangeDevice | |
virtual void | addReading (double x, double y, bool *wasAdded=NULL) |
Adds a reading to the buffer. | |
virtual void | applyTransform (ArTransform trans, bool doCumulative=true) |
Applies a transform to the buffers. More... | |
ArRangeDevice (size_t currentBufferSize, size_t cumulativeBufferSize, const char *name, unsigned int maxRange, int maxSecondsToKeepCurrent=0, int maxSecondsToKeepCumulative=0, double maxDistToKeepCumulative=0, bool locationDependent=false) | |
Constructor. More... | |
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. More... | |
virtual double | cumulativeReadingPolar (double startAngle, double endAngle, double *angle=NULL) const |
Gets the closest cumulative reading in the given polar region. More... | |
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. More... | |
virtual double | currentReadingPolar (double startAngle, double endAngle, double *angle=NULL) const |
Gets the closest current reading in the given polar region. More... | |
void | filterCallback (void) |
Internal function to filter the readings based on age and distance. | |
virtual const std::list< ArSensorReading * > * | getAdjustedRawReadings (void) const |
Gets the raw unfiltered readings from the device (but pose takens are corrected) More... | |
virtual std::vector< ArSensorReading > * | getAdjustedRawReadingsAsVector (void) |
Gets the raw adjusted readings from the device into a vector. More... | |
virtual const std::list< ArPoseWithTime * > * | getCumulativeBuffer (void) const |
Gets the current buffer of readings. More... | |
virtual std::list< ArPoseWithTime * > * | getCumulativeBuffer (void) |
Gets the current buffer of readings. | |
virtual std::vector< ArPoseWithTime > * | getCumulativeBufferAsVector (void) |
Gets the cumulative buffer of readings as a vector. More... | |
virtual size_t | getCumulativeBufferSize (void) const |
Sets the maximum size of the buffer for cumulative readings. | |
virtual ArDrawingData * | getCumulativeDrawingData (void) |
Gets data used for visualizing the cumulative buffer (see ArNetworking) | |
virtual const ArRangeBuffer * | getCumulativeRangeBuffer (void) const |
Gets the cumulative range buffer. More... | |
virtual ArRangeBuffer * | getCumulativeRangeBuffer (void) |
Gets the cumulative range buffer. | |
virtual const std::list< ArPoseWithTime * > * | getCurrentBuffer (void) const |
Gets the current buffer of readings. More... | |
virtual std::list< ArPoseWithTime * > * | getCurrentBuffer (void) |
Gets the current buffer of readings. | |
virtual std::vector< ArPoseWithTime > * | getCurrentBufferAsVector (void) |
Gets the current buffer of readings as a vector. More... | |
virtual size_t | getCurrentBufferSize (void) const |
Gets the maximum size of the buffer for current readings. | |
virtual ArDrawingData * | getCurrentDrawingData (void) |
Gets data used for visualizing the current buffer (see ArNetworking) | |
virtual const ArRangeBuffer * | getCurrentRangeBuffer (void) const |
Gets the current range buffer. More... | |
virtual ArRangeBuffer * | getCurrentRangeBuffer (void) |
Gets the current range buffer. | |
double | getMaxDistToKeepCumulative (void) |
sets the maximum distance cumulative readings can be from current pose More... | |
double | getMaxInsertDistCumulative (void) |
Gets the maximum distance a cumulative reading can be from the robot and still be inserted. More... | |
virtual unsigned int | getMaxRange (void) const |
Gets the maximum range for this device. | |
int | getMaxSecondsToKeepCumulative (void) |
gets the maximum seconds to keep current readings around More... | |
int | getMaxSecondsToKeepCurrent (void) |
gets the maximum seconds to keep current readings around More... | |
double | getMinDistBetweenCumulative (void) |
Gets the minimum distance between cumulative readings. More... | |
double | getMinDistBetweenCurrent (void) |
Gets the minimum distance between current readings. More... | |
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. More... | |
virtual std::vector< ArSensorReading > * | getRawReadingsAsVector (void) |
Gets the raw unfiltered readings from the device into a vector. More... | |
virtual ArRobot * | getRobot (void) |
Gets the robot this device is attached to. | |
bool | isLocationDependent (void) |
Gets if this device is location dependent or not. | |
virtual int | lockDevice () |
Lock this device. | |
virtual void | setCumulativeBufferSize (size_t size) |
Sets the maximum size of the buffer for cumulative readings. More... | |
virtual void | setCumulativeDrawingData (ArDrawingData *data, bool takeOwnershipOfData) |
Sets data for visualizing the cumulative buffer (and if we own it) | |
virtual void | setCurrentBufferSize (size_t size) |
Sets the maximum size of the buffer for current readings. More... | |
virtual void | setCurrentDrawingData (ArDrawingData *data, bool takeOwnershipOfData) |
Sets data for visualizing the current buffer (and if we own it) | |
void | setMaxDistToKeepCumulative (double maxDistToKeepCumulative) |
sets the maximum distance cumulative readings can be from current pose More... | |
void | setMaxInsertDistCumulative (double maxInsertDistCumulative) |
Sets the maximum distance a cumulative reading can be from the robot and still be inserted. More... | |
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 More... | |
void | setMaxSecondsToKeepCurrent (int maxSecondsToKeepCurrent) |
Sets the maximum seconds to keep current readings around. More... | |
void | setMinDistBetweenCumulative (double minDistBetweenCumulative) |
Sets the minimum distance between cumulative readings. More... | |
void | setMinDistBetweenCurrent (double minDistBetweenCurrent) |
Sets the minimum distance between current readings. More... | |
virtual int | tryLockDevice () |
Try to lock this device. | |
virtual int | unlockDevice () |
Unlock this device. | |
virtual | ~ArRangeDevice () |
Destructor. | |
Protected Attributes | |
double | myFilterFarDist |
double | myFilterNearDist |
ArRetFunctor1< bool, ArPose > * | myIgnoreReadingCB |
ArFunctorC< ArSonarDevice > | myProcessCB |
Protected Attributes inherited from ArRangeDevice | |
std::list< ArSensorReading * > * | myAdjustedRawReadings |
std::vector< ArSensorReading > | myAdjustedRawReadingsVector |
ArRangeBuffer | myCumulativeBuffer |
ArDrawingData * | myCumulativeDrawingData |
ArRangeBuffer | myCurrentBuffer |
ArDrawingData * | myCurrentDrawingData |
ArMutex | myDeviceMutex |
ArFunctorC< ArRangeDevice > | myFilterCB |
bool | myIsLocationDependent |
double | myMaxDistToKeepCumulative |
double | myMaxDistToKeepCumulativeSquared |
double | myMaxInsertDistCumulative |
ArPose | myMaxInsertDistCumulativePose |
double | myMaxInsertDistCumulativeSquared |
unsigned int | myMaxRange |
int | myMaxSecondsToKeepCumulative |
int | myMaxSecondsToKeepCurrent |
double | myMinDistBetweenCumulative |
double | myMinDistBetweenCumulativeSquared |
double | myMinDistBetweenCurrent |
double | myMinDistBetweenCurrentSquared |
std::string | myName |
bool | myOwnCumulativeDrawingData |
bool | myOwnCurrentDrawingData |
std::list< ArSensorReading * > * | myRawReadings |
std::vector< ArSensorReading > | myRawReadingsVector |
ArRobot * | myRobot |
Additional Inherited Members | |
Protected Member Functions inherited from ArRangeDevice | |
void | adjustRawReadings (bool interlaced) |
This call should be called by the range device every robot cycle before the range device makes new readings (and even if it isn't adding any that cycle)... More... | |
Keep track of recent sonar readings from a robot as an ArRangeDevice.
This class is for keeping a sonar history, which you may use for obstacle avoidance, display, etc. Simply use ArRobot::addRangeDevice() (or ArSonarDevice::setRobot()) to attach an ArSonarDevice object to an ArRobot robot object; ArSonarDevice will add a Sensor Interpretation task to the ArRobot which will read new sonar readings each robot cycle and add them to its sonar history.
(Note that sonar range readings are from the surface of the sonar transducer disc, not from the center of the robot.)
|
virtual |
Adds sonar readings to the current and cumulative buffers Overrides the ArRangeDevice default action.
Adds a sonar reading with the global coordinates x,y.
(This method is primarily for internal use.)
Makes sure the reading is within the proper distance to the robot, for both current and cumulative buffers. Filters buffer points Note: please lock the device using lockDevice() / unlockDevice() if calling this from outside process().
x | the global x coordinate of the reading |
y | the global y coordinate of the reading |
|
inline |
|
virtual |
Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task.
Reimplemented from ArRangeDevice.