Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::algorithms::LinearInterpolationPredictorWrapped Class Reference

#include <linear_interpolation_predictor_wrapped.hpp>

Public Member Functions

 LinearInterpolationPredictorWrapped (float lowerBound, float upperBound)
 
void update (float newValue, uint32_t currTime)
 
float getInterpolatedValue (uint32_t currTime)
 
void reset (float initialValue, uint32_t initialTime)
 

Detailed Description

An object that is similar in every respect to the LinearInterpolationPredictor object except that it uses WrappedFloat's instead.

Constructor & Destructor Documentation

◆ LinearInterpolationPredictorWrapped()

tap::algorithms::LinearInterpolationPredictorWrapped::LinearInterpolationPredictorWrapped ( float  lowerBound,
float  upperBound 
)
Parameters
[in]lowerBoundLower bound for linear interpolation WrappedFloat.
[in]upperBoundUpper bound for linear interpolation WrappedFloat.

Member Function Documentation

◆ getInterpolatedValue()

float tap::algorithms::LinearInterpolationPredictorWrapped::getInterpolatedValue ( uint32_t  currTime)
inline

Returns the current value, that is: $y$ in the equation $y=slope\cdot (currTime - lastUpdateCallTime) + previousValue$ in the units of whatever value you are inputting in the update function.

Note
Slope is defined by the previous two values passed into the update function, a period preceeding lastUpdateCallTime.
Use a millisecond-resolution timer, e.g. tap::arch::clock::getTimeMilliseconds().
Parameters
[in]currTimeThe current clock time, in ms.
Returns
The interpolated value.

◆ reset()

void tap::algorithms::LinearInterpolationPredictorWrapped::reset ( float  initialValue,
uint32_t  initialTime 
)

Resets the predictor. The slope will be reset to 0 and the initial values and time will be used to initialize the predictor.

Note
It is highly recommended that you call this function before calling update to "initialize" the system.
Parameters
[in]initialValueThe value to set the previous value to when resetting.
[in]initialTimeThe value to set the previous time to when resetting.

◆ update()

void tap::algorithms::LinearInterpolationPredictorWrapped::update ( float  newValue,
uint32_t  currTime 
)

Updates the interpolation using the newValue.

Note
Only call this when you receive a new value (use remote rx counter to tell when there is new data from the remote, for example).
This function should be called with increasing values of currTime.
Parameters
[in]newValueThe new data used in the interpolation.
[in]currTimeThe time that this function was called.

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