Class to limit velocity, acceleration and jerk. More...
#include <SpeedLimiter.hh>
Public Member Functions | |
SpeedLimiter () | |
Constructor. There are no limits by default. | |
double | Limit (double &_vel, double _prevVel, double _prevPrevVel, std::chrono::steady_clock::duration _dt) const |
Limit velocity, acceleration and jerk. | |
double | LimitAcceleration (double &_vel, double _prevVel, std::chrono::steady_clock::duration _dt) const |
Limit the acceleration using a first-order backward difference method. | |
double | LimitJerk (double &_vel, double _prevVel, double _prevPrevVel, std::chrono::steady_clock::duration _dt) const |
Limit the jerk using a second-order backward difference method. | |
double | LimitVelocity (double &_vel) const |
Limit the velocity. | |
double | MaxAcceleration () const |
Get maximum acceleration limit, defaults to positive infinity. | |
double | MaxJerk () const |
Get maximum jerk limit, defaults to positive infinity. | |
double | MaxVelocity () const |
Get maximum velocity limit, defaults to positive infinity. | |
double | MinAcceleration () const |
Get minimum acceleration limit, defaults to negative infinity. | |
double | MinJerk () const |
Get minimum jerk limit, defaults to negative infinity. | |
double | MinVelocity () const |
Get minimum velocity limit, defaults to negative infinity. | |
void | SetMaxAcceleration (double _lim) |
Set maximum acceleration limit in m/s^2, usually >= 0. | |
void | SetMaxJerk (double _lim) |
Set maximum jerk limit in m/s^3, usually >= 0. | |
void | SetMaxVelocity (double _lim) |
Set maximum velocity limit in m/s, usually >= 0. | |
void | SetMinAcceleration (double _lim) |
Set minimum acceleration limit in m/s^2, usually <= 0. | |
void | SetMinJerk (double _lim) |
Set minimum jerk limit in m/s^3, usually <= 0. | |
void | SetMinVelocity (double _lim) |
Set minimum velocity limit in m/s, usually <= 0. | |
Detailed Description
Class to limit velocity, acceleration and jerk.
Constructor & Destructor Documentation
◆ SpeedLimiter()
SpeedLimiter | ( | ) |
Constructor. There are no limits by default.
Member Function Documentation
◆ Limit()
double Limit | ( | double & | _vel, |
double | _prevVel, | ||
double | _prevPrevVel, | ||
std::chrono::steady_clock::duration | _dt | ||
) | const |
Limit velocity, acceleration and jerk.
- Parameters
-
[in,out] _vel Velocity to limit [m/s]. [in] _prevVel Previous velocity to _vel [m/s]. [in] _prevPrevVel Previous velocity to _prevVel [m/s]. [in] _dt Time step.
- Returns
- Limiting difference, which is (out _vel - in _vel).
◆ LimitAcceleration()
double LimitAcceleration | ( | double & | _vel, |
double | _prevVel, | ||
std::chrono::steady_clock::duration | _dt | ||
) | const |
Limit the acceleration using a first-order backward difference method.
- Parameters
-
[in,out] _vel Velocity [m/s]. [in] _prevVel Previous velocity [m/s]. [in] _dt Time step.
- Returns
- Limiting difference, which is (out _vel - in _vel).
◆ LimitJerk()
double LimitJerk | ( | double & | _vel, |
double | _prevVel, | ||
double | _prevPrevVel, | ||
std::chrono::steady_clock::duration | _dt | ||
) | const |
Limit the jerk using a second-order backward difference method.
- Parameters
-
[in,out] _vel Velocity to limit [m/s]. [in] _prevVel Previous velocity to v [m/s]. [in] _prevPrevVel Previous velocity to prevVel [m/s]. [in] _dt Time step.
- Returns
- Limiting difference, which is (out _vel - in _vel).
◆ LimitVelocity()
Limit the velocity.
- Parameters
-
[in,out] _vel Velocity to limit [m/s].
- Returns
- Limiting difference, which is (out _vel - in _vel).
◆ MaxAcceleration()
double MaxAcceleration | ( | ) | const |
Get maximum acceleration limit, defaults to positive infinity.
- Returns
- Maximum acceleration.
◆ MaxJerk()
double MaxJerk | ( | ) | const |
Get maximum jerk limit, defaults to positive infinity.
- Returns
- Maximum jerk.
◆ MaxVelocity()
double MaxVelocity | ( | ) | const |
Get maximum velocity limit, defaults to positive infinity.
- Returns
- Maximum velocity.
◆ MinAcceleration()
double MinAcceleration | ( | ) | const |
Get minimum acceleration limit, defaults to negative infinity.
- Returns
- Minimum acceleration.
◆ MinJerk()
double MinJerk | ( | ) | const |
Get minimum jerk limit, defaults to negative infinity.
- Returns
- Minimum jerk.
◆ MinVelocity()
double MinVelocity | ( | ) | const |
Get minimum velocity limit, defaults to negative infinity.
- Returns
- Minimum velocity.
◆ SetMaxAcceleration()
Set maximum acceleration limit in m/s^2, usually >= 0.
- Parameters
-
[in] _lim Maximum acceleration.
◆ SetMaxJerk()
Set maximum jerk limit in m/s^3, usually >= 0.
- Parameters
-
[in] _lim Maximum jerk.
◆ SetMaxVelocity()
Set maximum velocity limit in m/s, usually >= 0.
- Parameters
-
[in] _lim Maximum velocity.
◆ SetMinAcceleration()
Set minimum acceleration limit in m/s^2, usually <= 0.
- Parameters
-
[in] _lim Minimum acceleration.
◆ SetMinJerk()
Set minimum jerk limit in m/s^3, usually <= 0.
- Parameters
-
[in] _lim Minimum jerk.
◆ SetMinVelocity()
Set minimum velocity limit in m/s, usually <= 0.
- Parameters
-
[in] _lim Minimum velocity.
The documentation for this class was generated from the following file: