| 19 | VelocityTracker::Moment::Moment(const TimePoint& time, Scalar sample) : time(time), sample(sample) {} |
| 20 | |
| 21 | void VelocityTracker::addSample(const TimePoint& time, Scalar sample) { |
| 22 | // First element in the list is the most recent event |
| 23 | _moments.emplace_front(time, sample); |
| 24 | while (_moments.size() > kMomentHistory) { |
| 25 | _moments.pop_back(); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | Scalar VelocityTracker::computeVelocity() const { |
| 30 | return computeImpulseVelocity(); |