v6.1.1 (2024-12-13)
PID systems refactoring and improvements.
Breaking changes
ProfiledPIDController
now extendsPIDController
, delegating a lot of its methods over to thePIDFController
- Renamed
getPositionError()
togetError()
onPIDFController
- Renamed
getVelocityError()
togetErrorDerivative()
onPIDFController
- For consistency, the
setSetPoint
andgetSetPoint
methods that spannedProfiledPIDController
andPIDFController
are now simplysetSetpoint
andgetSetpoint
- To differentiate the
double
setpoint from the TrapezoidalProfile setpoint, thegetSetPoint
method still exists onProfiledPIDController
- To differentiate the
Additions
PIDFController
new methods and functionalitysetClearIntegralOnNewSetpoint
, which will erase the integration accumulation whenever the setpoint is changedsetIntegrationZone
, also known as the IZone from WPILib, which sets a region around the error such that integration is enabledenableContinuousInput
, also from WPILib, which allows wrapping of PID outputs for continuous systems like angles- See the BunyipsLib wiki (IO section) for more information
PIDFController
now uses a low-pass filter to smooth derivative readings- Comes with the
setDerivativeSmoothingGain
method, allowing you to set a low-pass gain (0<g<1
) - Designed to reduce noise and oscillation caused by too noisy of data to get a derivative that can be used effectively
- Default value of 0.8 in place for all
PIDFController
instances - set toDouble.MIN_VALUE
to disable or access/set theDEFAULT_DERIVATIVE_LP_GAIN
field
- Comes with the
- New
PIDFController
getTotalError()
method to accompanygetError()
andgetErrorDerivative()
Non-breaking changes
- New unit tests for the new refactored PID and features
- These tests are ported from WPILib
- Some tests, like ones that test derivatives have not been integrated as the controllers do not have constant period
- Various docs improvements and corrections
PIDFController
now exposes the fields:clearIOnNewSetpoint
minIClamp
maxIClamp
iZone
lowerClamp
- and
upperClamp
- Various internal restructurings of
PIDFController
reset()
ofPIDFController
resets all errors now- The
Filter.LowPass
now exposes as apublic final
field the gain in use - Implementations of
Filter.LowPass
now have checks to stop reassignment on continuous set calls