Go to the documentation of this file.
52 template<
typename Value,
typename InterpolationFunction = LinearInterpolation<Value>>
129 if(currTime >=
values_.back().first) {
return values_.back().second; }
130 else if(currTime <=
values_.front().first) {
return values_.front().second; }
140 auto updateIndex = [
this, currTime]()
152 auto nextIt = std::lower_bound(std::begin(
values_), std::end(
values_), currTime,
153 [](
const TimedValue & lhs,
const double & rhs) {
return lhs.first < rhs; });
size_t prevIndex_
Cache the previous index to optimize lookup when used sequentially.
Definition: SequenceInterpolator.h:169
SequenceInterpolator() noexcept
Creates an empty interpolator.
Definition: SequenceInterpolator.h:63
Interpolate values in a timed sequence.
Definition: SequenceInterpolator.h:53
typename std::pair< double, Eigen::Vector6d > TimedValue
Definition: SequenceInterpolator.h:55
Value compute(double currTime)
Definition: SequenceInterpolator.h:124
size_t nextIndex_
Cache the next index.
Definition: SequenceInterpolator.h:170
double intervalDuration_
Cache the duration of the current interval.
Definition: SequenceInterpolator.h:171
InterpolationFunction interpolator_
Functor for computing the interpolated values.
Definition: SequenceInterpolator.h:167
void error_and_throw(Args &&... args)
Definition: logging.h:47
const TimedValueVector & values() const noexcept
Definition: SequenceInterpolator.h:100
void values(const TimedValueVector &values)
Set interpolator values.
Definition: SequenceInterpolator.h:82
std::vector< TimedValue > TimedValueVector
Definition: SequenceInterpolator.h:56
TimedValueVector values_
Interpolation values.
Definition: SequenceInterpolator.h:168
void clear()
Definition: SequenceInterpolator.h:109
SequenceInterpolator(const TimedValueVector &values)
Creates an interpolator with values.
Definition: SequenceInterpolator.h:72
bool hasValues() const noexcept
Definition: SequenceInterpolator.h:106