Aria  2.8.0
ArInterpolation Class Reference

This class takes care of storing in readings of position vs time, and then interpolating between them to find where the robot was at a particular point in time. More...

#include <ArInterpolation.h>

Public Member Functions

bool addReading (ArTime timeOfReading, ArPose position)
 Adds a new reading.
 
 ArInterpolation (size_t numberOfReadings=100)
 Constructor.
 
int getAllowedMSForPrediction (void)
 Sets the allowed milliseconds for prediction.
 
int getAllowedPercentageForPrediction (void)
 Sets the allowed milliseconds for prediction.
 
bool getLogPrediction (void)
 Gets if we should log events for this interpolation.
 
const char * getName (void)
 Gets the name.
 
size_t getNumberOfReadings (void) const
 Gets the number of readings this instance holds back in time.
 
int getPose (ArTime timeStamp, ArPose *position, ArPoseWithTime *lastData=NULL)
 Finds a position. More...
 
void reset (void)
 Empties the interpolated positions.
 
void setAllowedMSForPrediction (int ms=-1)
 Sets the allowed milliseconds for prediction.
 
void setAllowedPercentageForPrediction (int percentage=5000)
 Sets the allowed percentage for prediction.
 
void setLogPrediction (bool logPrediction=false)
 Sets if we should log events for this interpolation.
 
void setName (const char *name)
 Sets the name.
 
void setNumberOfReadings (size_t numberOfReadings)
 Sets the number of readings this instance holds back in time.
 
virtual ~ArInterpolation ()
 Destructor.
 

Protected Attributes

int myAllowedMSForPrediction
 
int myAllowedPercentageForPrediction
 
ArMutex myDataMutex
 
bool myLogPrediction
 
std::string myName
 
std::list< ArPosemyPoses
 
size_t mySize
 
std::list< ArTimemyTimes
 

Detailed Description

This class takes care of storing in readings of position vs time, and then interpolating between them to find where the robot was at a particular point in time.

It has two lists, one containing the times, and one containing the positions at those same times (per position), they must be walked through jointly to maintain cohesion. The new entries are at the front of the list, while the old ones are at the back. numberOfReadings and the setNumberOfReadings control the number of entries in the list. If a size is set that is smaller than the current size, then the old ones are chopped off.

This class now has a couple of variables for when it allows prediction, they're set with setAllowedMSForPrediction and setAllowedPercentageForPrediction. If either is below 0 than they are ignored (if both are below 0 it means any prediction is allowed, which would be bad). Previous there was no MS limit, and the percentage limit was 50 (and so that is what the default is now).

Member Function Documentation

◆ getPose()

int ArInterpolation::getPose ( ArTime  timeStamp,
ArPose position,
ArPoseWithTime mostRecent = NULL 
)

Finds a position.

Parameters
timeStampthe time we are interested in
positionthe pose to set to the given position
mostRecentthe most recent data in the interpolation relevant to this call... for a return of 1 this is the near side it interpolated between, for a return of 0 or 1 this is the most recent data in the interpolation.... this is only useful if the return is 1, 0, or -1, and is mostly for use with ArRobot::applyEncoderOffset
Returns
1 its good interpolation, 0 its predicting, -1 its too far to predict, -2 its too old, -3 there's not enough data to predict

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