wpimath.filter.SlewRateLimiter()

I came across the SlewRateLimiter function today while going through some example code and am trying to understand what it does. I understand the principle of using it to limit the rate of change of a value. However, when I put numbers into a test program, I don’t understand the inconsistent outputs I am getting as shown here.

SlewRateLimiter is dependent on time between the calculate calls, so the variation you’re seeing is timing variation. See allwpilib/wpimath/src/main/native/include/frc/filter/SlewRateLimiter.h at main · wpilibsuite/allwpilib · GitHub

In addition to the timing variation, I wanted to make sure we all saw that the first value printed in both runs is in scientific notation.

Thank you for the information, and that does make sense.

That’s simply Python’s standard str() for floating point values–values smaller than a particular threshold get printed in scientific notation (note the other values are all 1e-4 or larger).

1 Like

Totally totally. Just wanted to make sure op noticed that and didn’t think the values were jumping from 1.8 to 0.003 to 0.0019.

1 Like