mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] PIDController: Add IZone (#5315)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
This commit is contained in:
@@ -106,6 +106,18 @@ class ProfiledPIDController
|
||||
*/
|
||||
void SetD(double Kd) { m_controller.SetD(Kd); }
|
||||
|
||||
/**
|
||||
* Sets the IZone range. When the absolute value of the position error is
|
||||
* greater than IZone, the total accumulated error will reset to zero,
|
||||
* disabling integral gain until the absolute value of the position error is
|
||||
* less than IZone. This is used to prevent integral windup. Must be
|
||||
* non-negative. Passing a value of zero will effectively disable integral
|
||||
* gain. Passing a value of infinity disables IZone functionality.
|
||||
*
|
||||
* @param iZone Maximum magnitude of error to allow integral control.
|
||||
*/
|
||||
void SetIZone(double iZone) { m_controller.SetIZone(iZone); }
|
||||
|
||||
/**
|
||||
* Gets the proportional coefficient.
|
||||
*
|
||||
@@ -127,6 +139,13 @@ class ProfiledPIDController
|
||||
*/
|
||||
double GetD() const { return m_controller.GetD(); }
|
||||
|
||||
/**
|
||||
* Get the IZone range.
|
||||
*
|
||||
* @return Maximum magnitude of error to allow integral control.
|
||||
*/
|
||||
double GetIZone() const { return m_controller.GetIZone(); }
|
||||
|
||||
/**
|
||||
* Gets the period of this controller.
|
||||
*
|
||||
@@ -377,6 +396,9 @@ class ProfiledPIDController
|
||||
"i", [this] { return GetI(); }, [this](double value) { SetI(value); });
|
||||
builder.AddDoubleProperty(
|
||||
"d", [this] { return GetD(); }, [this](double value) { SetD(value); });
|
||||
builder.AddDoubleProperty(
|
||||
"izone", [this] { return GetIZone(); },
|
||||
[this](double value) { SetIZone(value); });
|
||||
builder.AddDoubleProperty(
|
||||
"goal", [this] { return GetGoal().position.value(); },
|
||||
[this](double value) { SetGoal(Distance_t{value}); });
|
||||
|
||||
Reference in New Issue
Block a user