Class OneDVelocityIterator

Class Documentation

class OneDVelocityIterator

An iterator for generating a number of samples in a range.

In its simplest usage, this gives us N (num_samples) different velocities that are reachable given our current velocity. However, there is some fancy logic around zero velocities and the min/max velocities

If the current velocity is 2 m/s, and the acceleration limit is 1 m/ss and the acc_time is 1 s, this class would provide velocities between 1 m/s and 3 m/s.

Public Functions

inline OneDVelocityIterator(double current, double min, double max, double acc_limit, double decel_limit, double acc_time, int num_samples)

Constructor for the velocity iterator.

Parameters:
  • current – Current velocity

  • min – Minimum velocity allowable

  • max – Maximum velocity allowable

  • acc_limit – Acceleration Limit

  • decel_limit – Deceleration Limit

  • num_samples – The number of samples to return

inline double getVelocity() const

Get the next velocity available.

inline OneDVelocityIterator &operator++()

Increment the iterator.

inline void reset()

Reset back to the first velocity.

inline bool isFinished() const

If we have returned all the velocities for this iteration