46 return std::min(std::max(min, x), max);
53 bool has_velocity_limits,
54 bool has_acceleration_limits,
57 double min_acceleration,
58 double max_acceleration
60 : has_velocity_limits(has_velocity_limits),
61 has_acceleration_limits(has_acceleration_limits),
62 min_velocity(min_velocity),
63 max_velocity(max_velocity),
64 min_acceleration(min_acceleration),
65 max_acceleration(max_acceleration)
92 dv =
clamp(dv, dv_min, dv_max);
void limit(double &v, double v0, double dt)
Limit the velocity and acceleration.
T clamp(T x, T min, T max)
bool has_acceleration_limits
SpeedLimiter(bool has_velocity_limits=false, bool has_acceleration_limits=false, double min_velocity=0.0, double max_velocity=0.0, double min_acceleration=0.0, double max_acceleration=0.0)
Constructor.
void limit_velocity(double &v)
Limit the velocity.
void limit_acceleration(double &v, double v0, double dt)
Limit the acceleration.