Class to limit velocity, acceleration and jerk. More...
#include <SpeedLimiter.hh>
Public Member Functions | |
SpeedLimiter () | |
Constructor. There are no limits by default. More... | |
~SpeedLimiter () | |
Destructor. More... | |
double | Limit (double &_vel, double _prevVel, double _prevPrevVel, std::chrono::steady_clock::duration _dt) const |
Limit velocity, acceleration and jerk. More... | |
double | LimitAcceleration (double &_vel, double _prevVel, std::chrono::steady_clock::duration _dt) const |
Limit the acceleration using a first-order backward difference method. More... | |
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. More... | |
double | LimitVelocity (double &_vel) const |
Limit the velocity. More... | |
double | MaxAcceleration () const |
Get maximum acceleration limit, defaults to positive infinity. More... | |
double | MaxJerk () const |
Get maximum jerk limit, defaults to positive infinity. More... | |
double | MaxVelocity () const |
Get maximum velocity limit, defaults to positive infinity. More... | |
double | MinAcceleration () const |
Get minimum acceleration limit, defaults to negative infinity. More... | |
double | MinJerk () const |
Get minimum jerk limit, defaults to negative infinity. More... | |
double | MinVelocity () const |
Get minimum velocity limit, defaults to negative infinity. More... | |
void | SetMaxAcceleration (double _lim) |
Set maximum acceleration limit in m/s^2, usually >= 0. More... | |
void | SetMaxJerk (double _lim) |
Set maximum jerk limit in m/s^3, usually >= 0. More... | |
void | SetMaxVelocity (double _lim) |
Set maximum velocity limit in m/s, usually >= 0. More... | |
void | SetMinAcceleration (double _lim) |
Set minimum acceleration limit in m/s^2, usually <= 0. More... | |
void | SetMinJerk (double _lim) |
Set minimum jerk limit in m/s^3, usually <= 0. More... | |
void | SetMinVelocity (double _lim) |
Set minimum velocity limit in m/s, usually <= 0. More... | |
Detailed Description
Class to limit velocity, acceleration and jerk.
Constructor & Destructor Documentation
◆ SpeedLimiter()
SpeedLimiter | ( | ) |
Constructor. There are no limits by default.
◆ ~SpeedLimiter()
~SpeedLimiter | ( | ) |
Destructor.
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()
double LimitVelocity | ( | double & | _vel | ) | const |
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()
void SetMaxAcceleration | ( | double | _lim | ) |
Set maximum acceleration limit in m/s^2, usually >= 0.
- Parameters
-
[in] _lim Maximum acceleration.
◆ SetMaxJerk()
void SetMaxJerk | ( | double | _lim | ) |
Set maximum jerk limit in m/s^3, usually >= 0.
- Parameters
-
[in] _lim Maximum jerk.
◆ SetMaxVelocity()
void SetMaxVelocity | ( | double | _lim | ) |
Set maximum velocity limit in m/s, usually >= 0.
- Parameters
-
[in] _lim Maximum velocity.
◆ SetMinAcceleration()
void SetMinAcceleration | ( | double | _lim | ) |
Set minimum acceleration limit in m/s^2, usually <= 0.
- Parameters
-
[in] _lim Minimum acceleration.
◆ SetMinJerk()
void SetMinJerk | ( | double | _lim | ) |
Set minimum jerk limit in m/s^3, usually <= 0.
- Parameters
-
[in] _lim Minimum jerk.
◆ SetMinVelocity()
void SetMinVelocity | ( | double | _lim | ) |
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: