SlewRateLimiter
- class wpimath.filter.SlewRateLimiter(*args, **kwargs)
Bases:
pybind11_object
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.
@see TrapezoidProfile
Overloaded function.
__init__(self: wpimath.filter._filter.SlewRateLimiter, positiveRateLimit: units_per_second, negativeRateLimit: units_per_second, initialValue: float = 0.0) -> None
Creates a new SlewRateLimiter with the given positive and negative rate limits and initial value.
- Parameters:
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.
__init__(self: wpimath.filter._filter.SlewRateLimiter, rateLimit: units_per_second) -> None
Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimit.
- Parameters:
rateLimit – The rate-of-change limit.
__init__(self: wpimath.filter._filter.SlewRateLimiter, rateLimit: units_per_second, initialValue: float) -> None
Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimit and initial value.
- Parameters:
rateLimit – The rate-of-change limit.
initialValue – The initial value of the input.
- calculate(input: float) float
Filters the input to limit its slew rate.
- Parameters:
input – The input value whose slew rate is to be limited.
- Returns:
The filtered value, which will not change faster than the slew rate.
- reset(value: float) None
Resets the slew rate limiter to the specified value; ignores the rate limit when doing so.
- Parameters:
value – The value to reset to.