Template Class RateLimiter
Defined in File rate_limiter.hpp
Class Documentation
-
template<typename T>
class RateLimiter Public Functions
-
RateLimiter(T min_value = std::numeric_limits<T>::quiet_NaN(), T max_value = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T min_second_derivative = std::numeric_limits<T>::quiet_NaN(), T max_second_derivative = std::numeric_limits<T>::quiet_NaN())
Constructor.
Disclaimer about the jerk limits: The jerk limit is only applied when accelerating or reverse_accelerating (i.e., “sign(jerk * accel) > 0”). This condition prevents oscillating closed-loop behavior, see discussion details in https://github.com/ros-controls/control_toolbox/issues/240. if you use this feature, you should perform a test to check that the behavior is really as you expect.
Note
If max_* values are NAN, the respective limit is deactivated If min_* values are NAN (unspecified), defaults to -max If min_first_derivative_pos/max_first_derivative_neg values are NAN, symmetric limits are used
- Parameters:
min_value – [in] Minimum value, e.g. [m/s], usually <= 0
max_value – [in] Maximum value, e.g. [m/s], usually >= 0
min_first_derivative_neg – [in] Minimum first_derivative, negative value, e.g. [m/s^2], usually <= 0
max_first_derivative_pos – [in] Maximum first_derivative, positive value, e.g. [m/s^2], usually >= 0
min_first_derivative_pos – [in] Asymmetric Minimum first_derivative, positive value, e.g. [m/s^2], usually <= 0
max_first_derivative_neg – [in] Asymmetric Maximum first_derivative, negative value, e.g. [m/s^2], usually >= 0
min_second_derivative – [in] Minimum second_derivative, e.g. [m/s^3], usually <= 0
max_second_derivative – [in] Maximum second_derivative, e.g. [m/s^3], usually >= 0
-
T limit(T &v, T v0, T v1, T dt)
Limit the value and first_derivative.
- Parameters:
v – [inout] value, e.g. [m/s]
v0 – [in] Previous value to v , e.g. [m/s]
v1 – [in] Previous value to v0, e.g. [m/s]
dt – [in] Time step [s]
- Returns:
Limiting factor (1.0 if none)
-
T limit_value(T &v)
Limit the value.
- Parameters:
v – [inout] value, e.g. [m/s]
- Returns:
Limiting factor (1.0 if none)
-
T limit_first_derivative(T &v, T v0, T dt)
Limit the first_derivative.
- Parameters:
v – [inout] value, e.g. [m/s]
v0 – [in] Previous value, e.g. [m/s]
dt – [in] Time step [s]
- Returns:
Limiting factor (1.0 if none)
-
T limit_second_derivative(T &v, T v0, T v1, T dt)
Limit the second_derivative.
Note
The jerk limit is only applied when accelerating or reverse_accelerating (i.e., “sign(jerk * accel) > 0”).
- Parameters:
v – [inout] value, e.g. [m/s]
v0 – [in] Previous value to v , e.g. [m/s]
v1 – [in] Previous value to v0, e.g. [m/s]
dt – [in] Time step [s]
- Returns:
Limiting factor (1.0 if none)
-
void set_params(T min_value = std::numeric_limits<T>::quiet_NaN(), T max_value = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T min_second_derivative = std::numeric_limits<T>::quiet_NaN(), T max_second_derivative = std::numeric_limits<T>::quiet_NaN())
Set the parameters.
Note
If max_* values are NAN, the respective limit is deactivated If min_* values are NAN (unspecified), defaults to -max If min_first_derivative_pos/max_first_derivative_neg values are NAN, symmetric limits are used
- Parameters:
min_value – [in] Minimum value, e.g. [m/s], usually <= 0
max_value – [in] Maximum value, e.g. [m/s], usually >= 0
min_first_derivative_neg – [in] Minimum first_derivative, negative value, e.g. [m/s^2], usually <= 0
max_first_derivative_pos – [in] Maximum first_derivative, positive value, e.g. [m/s^2], usually >= 0
min_first_derivative_pos – [in] Asymmetric Minimum first_derivative, positive value, e.g. [m/s^2], usually <= 0
max_first_derivative_neg – [in] Asymmetric Maximum first_derivative, negative value, e.g. [m/s^2], usually >= 0
min_second_derivative – [in] Minimum second_derivative, e.g. [m/s^3], usually <= 0
max_second_derivative – [in] Maximum second_derivative, e.g. [m/s^3], usually >= 0
-
RateLimiter(T min_value = std::numeric_limits<T>::quiet_NaN(), T max_value = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T min_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(), T max_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(), T min_second_derivative = std::numeric_limits<T>::quiet_NaN(), T max_second_derivative = std::numeric_limits<T>::quiet_NaN())