ros2_control - humble
Loading...
Searching...
No Matches
Public Member Functions | List of all members
control_toolbox::RateLimiter< T > Class Template Reference

Public Member 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.
 
limit (T &v, T v0, T v1, T dt)
 Limit the value and first_derivative.
 
limit_value (T &v)
 Limit the value.
 
limit_first_derivative (T &v, T v0, T dt)
 Limit the first_derivative.
 
limit_second_derivative (T &v, T v0, T v1, T dt)
 Limit the second_derivative.
 
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.
 

Constructor & Destructor Documentation

◆ RateLimiter()

template<typename T >
control_toolbox::RateLimiter< T >::RateLimiter ( min_value = std::numeric_limits<T>::quiet_NaN(),
max_value = std::numeric_limits<T>::quiet_NaN(),
min_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(),
max_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(),
min_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(),
max_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(),
min_second_derivative = std::numeric_limits<T>::quiet_NaN(),
max_second_derivative = std::numeric_limits<T>::quiet_NaN() 
)

Constructor.

Parameters
[in]min_valueMinimum value, e.g. [m/s], usually <= 0
[in]max_valueMaximum value, e.g. [m/s], usually >= 0
[in]min_first_derivative_negMinimum first_derivative, negative value, e.g. [m/s^2], usually <= 0
[in]max_first_derivative_posMaximum first_derivative, positive value, e.g. [m/s^2], usually >= 0
[in]min_first_derivative_posAsymmetric Minimum first_derivative, positive value, e.g. [m/s^2], usually <= 0
[in]max_first_derivative_negAsymmetric Maximum first_derivative, negative value, e.g. [m/s^2], usually >= 0
[in]min_second_derivativeMinimum second_derivative, e.g. [m/s^3], usually <= 0
[in]max_second_derivativeMaximum second_derivative, e.g. [m/s^3], usually >= 0
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

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.

Member Function Documentation

◆ limit()

template<typename T >
T control_toolbox::RateLimiter< T >::limit ( T &  v,
v0,
v1,
dt 
)

Limit the value and first_derivative.

Parameters
[in,out]vvalue, e.g. [m/s]
[in]v0Previous value to v , e.g. [m/s]
[in]v1Previous value to v0, e.g. [m/s]
[in]dtTime step [s]
Returns
Limiting factor (1.0 if none)

◆ limit_first_derivative()

template<typename T >
T control_toolbox::RateLimiter< T >::limit_first_derivative ( T &  v,
v0,
dt 
)

Limit the first_derivative.

Parameters
[in,out]vvalue, e.g. [m/s]
[in]v0Previous value, e.g. [m/s]
[in]dtTime step [s]
Returns
Limiting factor (1.0 if none)

◆ limit_second_derivative()

template<typename T >
T control_toolbox::RateLimiter< T >::limit_second_derivative ( T &  v,
v0,
v1,
dt 
)

Limit the second_derivative.

Parameters
[in,out]vvalue, e.g. [m/s]
[in]v0Previous value to v , e.g. [m/s]
[in]v1Previous value to v0, e.g. [m/s]
[in]dtTime step [s]
Returns
Limiting factor (1.0 if none)
See also
http://en.wikipedia.org/wiki/jerk_%28physics%29#Motion_control
Note
The jerk limit is only applied when accelerating or reverse_accelerating (i.e., "sign(jerk * accel) > 0").

◆ limit_value()

template<typename T >
T control_toolbox::RateLimiter< T >::limit_value ( T &  v)

Limit the value.

Parameters
[in,out]vvalue, e.g. [m/s]
Returns
Limiting factor (1.0 if none)

◆ set_params()

template<typename T >
void control_toolbox::RateLimiter< T >::set_params ( min_value = std::numeric_limits<T>::quiet_NaN(),
max_value = std::numeric_limits<T>::quiet_NaN(),
min_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(),
max_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(),
min_first_derivative_pos = std::numeric_limits<T>::quiet_NaN(),
max_first_derivative_neg = std::numeric_limits<T>::quiet_NaN(),
min_second_derivative = std::numeric_limits<T>::quiet_NaN(),
max_second_derivative = std::numeric_limits<T>::quiet_NaN() 
)

Set the parameters.

Parameters
[in]min_valueMinimum value, e.g. [m/s], usually <= 0
[in]max_valueMaximum value, e.g. [m/s], usually >= 0
[in]min_first_derivative_negMinimum first_derivative, negative value, e.g. [m/s^2], usually <= 0
[in]max_first_derivative_posMaximum first_derivative, positive value, e.g. [m/s^2], usually >= 0
[in]min_first_derivative_posAsymmetric Minimum first_derivative, positive value, e.g. [m/s^2], usually <= 0
[in]max_first_derivative_negAsymmetric Maximum first_derivative, negative value, e.g. [m/s^2], usually >= 0
[in]min_second_derivativeMinimum second_derivative, e.g. [m/s^3], usually <= 0
[in]max_second_derivativeMaximum second_derivative, e.g. [m/s^3], usually >= 0
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

The documentation for this class was generated from the following file: