WPILibC++ 2024.3.2
|
A class that limits the rate of change of an input value. More...
#include <frc/filter/SlewRateLimiter.h>
Public Types | |
using | Unit_t = units::unit_t< Unit > |
using | Rate = units::compound_unit< Unit, units::inverse< units::seconds > > |
using | Rate_t = units::unit_t< Rate > |
Public Member Functions | |
SlewRateLimiter (Rate_t positiveRateLimit, Rate_t negativeRateLimit, Unit_t initialValue=Unit_t{0}) | |
Creates a new SlewRateLimiter with the given positive and negative rate limits and initial value. More... | |
SlewRateLimiter (Rate_t rateLimit) | |
Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimit. More... | |
Unit_t | Calculate (Unit_t input) |
Filters the input to limit its slew rate. More... | |
Unit_t | LastValue () const |
Returns the value last calculated by the SlewRateLimiter. More... | |
void | Reset (Unit_t value) |
Resets the slew rate limiter to the specified value; ignores the rate limit when doing so. More... | |
A class that limits the rate of change of an input value.
Useful for implementing voltage, setpoint, and/or output ramps. A slew-rate limit is most appropriate when the quantity being controlled is a velocity or a voltage; when controlling a position, consider using a TrapezoidProfile instead.
using frc::SlewRateLimiter< Unit >::Rate = units::compound_unit<Unit, units::inverse<units::seconds> > |
using frc::SlewRateLimiter< Unit >::Rate_t = units::unit_t<Rate> |
using frc::SlewRateLimiter< Unit >::Unit_t = units::unit_t<Unit> |
|
inline |
Creates a new SlewRateLimiter with the given positive and negative rate limits and initial value.
positiveRateLimit | The rate-of-change limit in the positive direction, in units per second. This is expected to be positive. |
negativeRateLimit | The rate-of-change limit in the negative direction, in units per second. This is expected to be negative. |
initialValue | The initial value of the input. |
|
inlineexplicit |
Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimit.
rateLimit | The rate-of-change limit. |
|
inline |
Filters the input to limit its slew rate.
input | The input value whose slew rate is to be limited. |
|
inline |
Returns the value last calculated by the SlewRateLimiter.
|
inline |
Resets the slew rate limiter to the specified value; ignores the rate limit when doing so.
value | The value to reset to. |