Candy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
Candy::Utils::EFFOAW< VEC > Class Template Reference

This is an end-fitting first-order adaptive window estimator of velocity from samples allowing jittering. More...

Inheritance diagram for Candy::Utils::EFFOAW< VEC >:
Inheritance graph
[legend]

Public Member Functions

 EFFOAW ()
 Creates a new end-fitting first-order adaptive window estimator using the default parameters. More...
 
void setHistoryLength (size_t N)
 Set how many samples should be saved to be used when estimating the velocity. More...
 
size_t getHistoryLength () const
 Get the number of samples that are saved to be used when estimating the velocity. More...
 
void setHistoryDuration (double t)
 Set how old samples should be saved to be used when estimating the velocity. More...
 
double getHistoryDuration () const
 Get how old samples are saved to be used when estimating the velocity. More...
 
void addSample (size_t id, VEC position, double time)
 Add a position sample. More...
 
template<class TYPE >
VEC estimateVelocity (size_t id, TYPE error) const
 Estimate and return the velocity using samples associated to id. More...
 
void cleanup (double time)
 Clean-up old samples and unused ids. More...
 

Detailed Description

template<class VEC>
class Candy::Utils::EFFOAW< VEC >

This is an end-fitting first-order adaptive window estimator of velocity from samples allowing jittering.

Constructor & Destructor Documentation

template<class VEC >
Candy::Utils::EFFOAW< VEC >::EFFOAW ( )

Creates a new end-fitting first-order adaptive window estimator using the default parameters.

Member Function Documentation

template<class VEC>
void Candy::Utils::EFFOAW< VEC >::addSample ( size_t  id,
VEC  position,
double  time 
)

Add a position sample.

Each sample is associated to an id and a time.

Parameters
idThe id to add position sample to.
positionThe position value to use as sample.
timeThe time at which the sample was taken.
template<class VEC >
void Candy::Utils::EFFOAW< VEC >::cleanup ( double  time)

Clean-up old samples and unused ids.

This function should be called from time to time, for example after calling addSample, to avoid too much unnecessary memory usage.

Parameters
timeThe current time, to use when estimating if samples are too old.
template<class VEC >
template<class TYPE >
VEC Candy::Utils::EFFOAW< VEC >::estimateVelocity ( size_t  id,
TYPE  error 
) const

Estimate and return the velocity using samples associated to id.

Parameters
idThe id to estimate velocity for.
errorAn estimate of the position tracking error, used to determine how many samples to include in the averaging.
template<class VEC>
double Candy::Utils::EFFOAW< VEC >::getHistoryDuration ( ) const
inline

Get how old samples are saved to be used when estimating the velocity.

template<class VEC>
size_t Candy::Utils::EFFOAW< VEC >::getHistoryLength ( ) const
inline

Get the number of samples that are saved to be used when estimating the velocity.

template<class VEC>
void Candy::Utils::EFFOAW< VEC >::setHistoryDuration ( double  t)
inline

Set how old samples should be saved to be used when estimating the velocity.

template<class VEC>
void Candy::Utils::EFFOAW< VEC >::setHistoryLength ( size_t  N)
inline

Set how many samples should be saved to be used when estimating the velocity.