mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpimath] Add lastValue() method to filters (#6351)
This commit is contained in:
@@ -371,6 +371,13 @@ class LinearFilter {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last value calculated by the LinearFilter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
T LastValue() const { return m_outputs.front(); }
|
||||
|
||||
private:
|
||||
wpi::circular_buffer<T> m_inputs;
|
||||
wpi::circular_buffer<T> m_outputs;
|
||||
|
||||
@@ -61,6 +61,13 @@ class MedianFilter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last value calculated by the MedianFilter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
T LastValue() const { return m_valueBuffer.front(); }
|
||||
|
||||
/**
|
||||
* Resets the filter, clearing the window of all elements.
|
||||
*/
|
||||
|
||||
@@ -75,6 +75,13 @@ class SlewRateLimiter {
|
||||
return m_prevVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value last calculated by the SlewRateLimiter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
Unit_t LastValue() const { return m_prevVal; }
|
||||
|
||||
/**
|
||||
* Resets the slew rate limiter to the specified value; ignores the rate limit
|
||||
* when doing so.
|
||||
|
||||
Reference in New Issue
Block a user