|
gramods
|
This is an end-fitting first-order adaptive window estimator of velocity from samples allowing jittering. More...
#include <EFFOAW.hh>
Classes | |
| struct | Impl |
Public Member Functions | |
| EFFOAW () | |
| Creates a new end-fitting first-order adaptive window estimator using the default parameters. | |
| void | setHistoryLength (size_t N) |
| Set how many samples should be saved to be used when estimating the velocity. | |
| size_t | getHistoryLength () const |
| Get the number of samples that are saved to be used when estimating the velocity. | |
| void | setHistoryDuration (double t) |
| Set how old samples should be saved to be used when estimating the velocity. | |
| double | getHistoryDuration () const |
| Get how old samples are saved to be used when estimating the velocity. | |
| double | getLastSampleTime (size_t id, size_t N=0) |
| Returns the time associated with the last sample associated with the specified id, or -1 if there is no last sample available. | |
| void | addSample (size_t id, Eigen::Vector3d position, double time) |
| Add a position sample. | |
| void | removeLastSample (size_t id) |
| Remove the last sample for the specified id. | |
| Eigen::Vector3d | estimateVelocity (size_t id, double error, size_t *samples=nullptr) const |
| Estimate and return the velocity using samples associated to id. | |
| Eigen::Vector3d | estimatePosition (size_t id, double error, double time, size_t *samples=nullptr) const |
| Estimate and return the position using samples associated to id. | |
| void | cleanup (double time=-1) |
| Clean-up old samples and unused ids. | |
This is an end-fitting first-order adaptive window estimator of velocity from samples allowing jittering.
Units of both length and time can be arbitrarily chosen and the velocity will be estimated as distance over time in the same units.
The class uses std::valarray<double> to represent both position and velocity.
| gramods::gmMisc::EFFOAW::EFFOAW | ( | ) |
Creates a new end-fitting first-order adaptive window estimator using the default parameters.
| void gramods::gmMisc::EFFOAW::addSample | ( | size_t | id, |
| Eigen::Vector3d | position, | ||
| double | time | ||
| ) |
Add a position sample.
Each sample is associated to an id and a time. If a new sample is provided with the same id and time as a previously added sample, this new sample will replace the old.
| [in] | id | The id to add position sample to. |
| [in] | position | The position value to use as sample. |
| [in] | time | The time at which the sample was taken. |
| void gramods::gmMisc::EFFOAW::cleanup | ( | double | time = -1 | ) |
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.
| time | The current time, to use when estimating if samples are too old, or -1 to use the samples' time. |
| Eigen::Vector3d gramods::gmMisc::EFFOAW::estimatePosition | ( | size_t | id, |
| double | error, | ||
| double | time, | ||
| size_t * | samples = nullptr |
||
| ) | const |
Estimate and return the position using samples associated to id.
This is not really a functionality of EFFOAW, but uses the EFFOAW estimated velocity as a means to estimate a position in the immediate future. It is assumed that the specified time occurs after or at the time of the last sample.
| [in] | id | The id to estimate position for. |
| [in] | error | An estimate of the position tracking error, used to determine how many samples to include in the averaging. |
| [in] | time | The time to estimate the position for. |
| [out] | samples | The number of history samples used in the estimation. |
| Eigen::Vector3d gramods::gmMisc::EFFOAW::estimateVelocity | ( | size_t | id, |
| double | error, | ||
| size_t * | samples = nullptr |
||
| ) | const |
Estimate and return the velocity using samples associated to id.
The velocity will be expressed in chosen units per second.
| [in] | id | The id to estimate velocity for. |
| [in] | error | An estimate of the position tracking error, used to determine how many samples to include in the averaging. |
| [out] | samples | The number of history samples used in the estimation. |
| double gramods::gmMisc::EFFOAW::getHistoryDuration | ( | ) | const |
Get how old samples are saved to be used when estimating the velocity.
| size_t gramods::gmMisc::EFFOAW::getHistoryLength | ( | ) | const |
Get the number of samples that are saved to be used when estimating the velocity.
| double gramods::gmMisc::EFFOAW::getLastSampleTime | ( | size_t | id, |
| size_t | N = 0 |
||
| ) |
Returns the time associated with the last sample associated with the specified id, or -1 if there is no last sample available.
| [in] | id | The id to read off the last sample for. |
| [in] | N | Read off the Nth last sample, 0 (default) being the last sample. |
| void gramods::gmMisc::EFFOAW::removeLastSample | ( | size_t | id | ) |
Remove the last sample for the specified id.
This will remove the last sample what was actually added to the id; it will not restore a sample that was overwritten by another with the same time.
| [in] | id | The id to remove the last sample for. |
| void gramods::gmMisc::EFFOAW::setHistoryDuration | ( | double | t | ) |
Set how old samples should be saved to be used when estimating the velocity.
| void gramods::gmMisc::EFFOAW::setHistoryLength | ( | size_t | N | ) |
Set how many samples should be saved to be used when estimating the velocity.