SlewRateLimiter

class wpilib.SlewRateLimiter(self: wpilib.SlewRateLimiter, rateLimit: units_per_second, initialValue: float = 0.0) → None

Bases: pybind11_builtins.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

Creates a new SlewRateLimiter with the given rate limit and initial value.

Parameters
  • rateLimit – The rate-of-change limit.

  • initialValue – The initial value of the input.

calculate(self: wpilib.SlewRateLimiter, 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(self: wpilib.SlewRateLimiter, 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.