Robot Core Documentation
Loading...
Searching...
No Matches
edu.wpi.first.math.filter.SlewRateLimiter Class Reference

Public Member Functions

 SlewRateLimiter (double positiveRateLimit, double negativeRateLimit, double initialValue)
 
 SlewRateLimiter (double rateLimit)
 
double calculate (double input)
 
double lastValue ()
 
void reset (double value)
 

Detailed Description

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 edu.wpi.first.math.trajectory.TrapezoidProfile instead.

Constructor & Destructor Documentation

◆ SlewRateLimiter() [1/2]

edu.wpi.first.math.filter.SlewRateLimiter.SlewRateLimiter ( double positiveRateLimit,
double negativeRateLimit,
double initialValue )

Creates a new SlewRateLimiter with the given positive and negative rate limits and initial value.

Parameters
positiveRateLimitThe rate-of-change limit in the positive direction, in units per second. This is expected to be positive.
negativeRateLimitThe rate-of-change limit in the negative direction, in units per second. This is expected to be negative.
initialValueThe initial value of the input.

◆ SlewRateLimiter() [2/2]

edu.wpi.first.math.filter.SlewRateLimiter.SlewRateLimiter ( double rateLimit)

Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimit.

Parameters
rateLimitThe rate-of-change limit, in units per second.

Member Function Documentation

◆ calculate()

double edu.wpi.first.math.filter.SlewRateLimiter.calculate ( double input)

Filters the input to limit its slew rate.

Parameters
inputThe input value whose slew rate is to be limited.
Returns
The filtered value, which will not change faster than the slew rate.

◆ lastValue()

double edu.wpi.first.math.filter.SlewRateLimiter.lastValue ( )

Returns the value last calculated by the SlewRateLimiter.

Returns
The last value.

◆ reset()

void edu.wpi.first.math.filter.SlewRateLimiter.reset ( double value)

Resets the slew rate limiter to the specified value; ignores the rate limit when doing so.

Parameters
valueThe value to reset to.

The documentation for this class was generated from the following file: