Aria
2.8.0
|
A class for connecting to a PB-9 and managing the resulting data. More...
#include <ArIrrfDevice.h>
Inherits ArRangeDevice.
Public Member Functions | |
ArIrrfDevice (size_t currentBufferSize=91, size_t cumulativeBufferSize=273, const char *name="irrf") | |
Constructor. | |
bool | packetHandler (ArRobotPacket *packet) |
The packet handler for use when connecting to an H8 micro-controller. More... | |
void | setCumulativeMaxRange (double r) |
Maximum range for a reading to be added to the cumulative buffer (mm) | |
virtual void | setRobot (ArRobot *) |
virtual | ~ArIrrfDevice () |
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 Member Functions | |
void | processReadings (void) |
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... | |
Protected Attributes | |
double | myCumulativeMaxRange |
double | myFilterFarDist |
double | myFilterNearDist |
std::map< int, ArSensorReading * > | myIrrfReadings |
ArTime | myLastReading |
ArRetFunctor1C< bool, ArIrrfDevice, ArRobotPacket * > | myPacketHandler |
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 |
A class for connecting to a PB-9 and managing the resulting data.
This class is for use with a PB9 IR rangefinder. It has the packethandler necessary to process the packets, and will put the data into ArRangeBuffers for use with obstacle avoidance, etc.
The PB9 is still under development, and only works on an H8 controller running AROS.
bool ArIrrfDevice::packetHandler | ( | ArRobotPacket * | packet | ) |
The packet handler for use when connecting to an H8 micro-controller.
This is the packet handler for the PB9 data, which is sent via the micro controller, to the client.
This will read the data from the packets, and then call processReadings to filter add the data to the current and cumulative buffers.