Aria  2.8.0
ArBumpers Class Reference

A class that treats the robot's bumpers as a range device. More...

#include <ArBumpers.h>

Inherits ArRangeDevice.

Public Member Functions

void addBumpToBuffer (int bumpValue, int whichBumper)
 
 ArBumpers (size_t currentBufferSize=30, size_t cumulativeBufferSize=30, const char *name="bumpers", int maxSecondsToKeepCurrent=15, double angleRange=135)
 
void processReadings (void)
 This function is called every 100 milliseconds.
 
virtual void setRobot (ArRobot *robot)
 
- 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 ArDrawingDatagetCumulativeDrawingData (void)
 Gets data used for visualizing the cumulative buffer (see ArNetworking)
 
virtual const ArRangeBuffergetCumulativeRangeBuffer (void) const
 Gets the cumulative range buffer. More...
 
virtual ArRangeBuffergetCumulativeRangeBuffer (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 ArDrawingDatagetCurrentDrawingData (void)
 Gets data used for visualizing the current buffer (see ArNetworking)
 
virtual const ArRangeBuffergetCurrentRangeBuffer (void) const
 Gets the current range buffer. More...
 
virtual ArRangeBuffergetCurrentRangeBuffer (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 ArRobotgetRobot (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 myAngleRange
 
int myBumpMask
 
ArFunctorC< ArBumpersmyProcessCB
 
ArRobotmyRobot
 
- Protected Attributes inherited from ArRangeDevice
std::list< ArSensorReading * > * myAdjustedRawReadings
 
std::vector< ArSensorReadingmyAdjustedRawReadingsVector
 
ArRangeBuffer myCumulativeBuffer
 
ArDrawingDatamyCumulativeDrawingData
 
ArRangeBuffer myCurrentBuffer
 
ArDrawingDatamyCurrentDrawingData
 
ArMutex myDeviceMutex
 
ArFunctorC< ArRangeDevicemyFilterCB
 
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< ArSensorReadingmyRawReadingsVector
 
ArRobotmyRobot
 

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

Detailed Description

A class that treats the robot's bumpers as a range device.

The class treats bumpers like a range device. When a bumper is bumped, it reports the approximate position of the bump in a buffer. The positions are kept current for a specified length of time.

Constructor & Destructor Documentation

◆ ArBumpers()

ArBumpers::ArBumpers ( size_t  currentBufferSize = 30,
size_t  cumulativeBufferSize = 30,
const char *  name = "bumpers",
int  maxSecondsToKeepCurrent = 15,
double  angleRange = 135 
)
Parameters
currentBufferSizeThe number of readings to store in the current Buffer
cumulativeBufferSizeThe number of readings in the cumulative buffer (This currently is not being used)
nameThe name of this range device
maxSecondsToKeepCurrentHow long to keep readings in the current buffer
angleRangethe range in front and behind the robot which is divided by the number of bumpers and used to detrmine where the sensor readings will be placed.

Member Function Documentation

◆ addBumpToBuffer()

void ArBumpers::addBumpToBuffer ( int  bumpValue,
int  whichBumper 
)
Parameters
bumpValueThis is the value that tells which individual bumper has been triggered
whichBumperThis value tells if the front or rear has been triggered

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