46 : m_positiveRateLimit{positiveRateLimit},
47 m_negativeRateLimit{negativeRateLimit},
48 m_prevVal{initialValue},
70 units::second_t elapsedTime = currentTime - m_prevTime;
72 std::clamp(input - m_prevVal, m_negativeRateLimit * elapsedTime,
73 m_positiveRateLimit * elapsedTime);
74 m_prevTime = currentTime;
97 Rate_t m_positiveRateLimit;
98 Rate_t m_negativeRateLimit;
100 units::second_t m_prevTime;
A class that limits the rate of change of an input value.
Definition: SlewRateLimiter.h:26
SlewRateLimiter(Rate_t rateLimit)
Creates a new SlewRateLimiter with the given positive rate limit and negative rate limit of -rateLimi...
Definition: SlewRateLimiter.h:58
units::unit_t< Rate > Rate_t
Definition: SlewRateLimiter.h:30
Unit_t LastValue() const
Returns the value last calculated by the SlewRateLimiter.
Definition: SlewRateLimiter.h:83
Unit_t Calculate(Unit_t input)
Filters the input to limit its slew rate.
Definition: SlewRateLimiter.h:68
units::unit_t< Unit > Unit_t
Definition: SlewRateLimiter.h:28
SlewRateLimiter(Rate_t positiveRateLimit, Rate_t negativeRateLimit, Unit_t initialValue=Unit_t{0})
Creates a new SlewRateLimiter with the given positive and negative rate limits and initial value.
Definition: SlewRateLimiter.h:44
units::compound_unit< Unit, units::inverse< units::seconds > > Rate
Definition: SlewRateLimiter.h:29
void Reset(Unit_t value)
Resets the slew rate limiter to the specified value; ignores the rate limit when doing so.
Definition: SlewRateLimiter.h:91
static units::second_t GetTimestamp()
Definition: MathShared.h:77
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1434
Definition: AprilTagPoseEstimator.h:15