mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Add lastValue() method to filters (#6351)
This commit is contained in:
@@ -313,6 +313,15 @@ public class LinearFilter {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last value calculated by the LinearFilter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
public double lastValue() {
|
||||
return m_outputs.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* Factorial of n.
|
||||
*
|
||||
|
||||
@@ -72,6 +72,15 @@ public class MedianFilter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last value calculated by the MedianFilter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
public double lastValue() {
|
||||
return m_valueBuffer.getFirst();
|
||||
}
|
||||
|
||||
/** Resets the filter, clearing the window of all elements. */
|
||||
public void reset() {
|
||||
m_orderedValues.clear();
|
||||
|
||||
@@ -64,6 +64,15 @@ public class SlewRateLimiter {
|
||||
return m_prevVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value last calculated by the SlewRateLimiter.
|
||||
*
|
||||
* @return The last value.
|
||||
*/
|
||||
public double lastValue() {
|
||||
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