From 5c690f4e2f0cceda9052823c4c50c0357bc632b2 Mon Sep 17 00:00:00 2001 From: Carl Hauser Date: Fri, 29 Mar 2024 15:01:13 -0700 Subject: [PATCH 1/3] Correct the documentation of PIDController.setIntegratorRange; Java and C++ --- .../edu/wpi/first/math/controller/PIDController.java | 10 +++++----- .../main/native/include/frc/controller/PIDController.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/PIDController.java b/wpimath/src/main/java/edu/wpi/first/math/controller/PIDController.java index f7246848c2a..ce44152065e 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/PIDController.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/PIDController.java @@ -313,13 +313,13 @@ public boolean isContinuousInputEnabled() { } /** - * Sets the minimum and maximum values for the integrator. + * Sets the minimum and maximum contributions of the integral term. * - *

When the cap is reached, the integrator value is added to the controller output rather than - * the integrator value times the integral gain. + *

The internal integrator is clamped so that the integral term's contribution to the output + * stays between minimumIntegral and maximumIntegral. This prevents integral windup. * - * @param minimumIntegral The minimum value of the integrator. - * @param maximumIntegral The maximum value of the integrator. + * @param minimumIntegral The minimum contribution of the integral term. + * @param maximumIntegral The maximum contribution of the integral term. */ public void setIntegratorRange(double minimumIntegral, double maximumIntegral) { m_minimumIntegral = minimumIntegral; diff --git a/wpimath/src/main/native/include/frc/controller/PIDController.h b/wpimath/src/main/native/include/frc/controller/PIDController.h index 30ab8f07a99..4f094b7f6bd 100644 --- a/wpimath/src/main/native/include/frc/controller/PIDController.h +++ b/wpimath/src/main/native/include/frc/controller/PIDController.h @@ -179,13 +179,13 @@ class WPILIB_DLLEXPORT PIDController bool IsContinuousInputEnabled() const; /** - * Sets the minimum and maximum values for the integrator. + * Sets the minimum and maximum contributions of the integral term. * - * When the cap is reached, the integrator value is added to the controller - * output rather than the integrator value times the integral gain. + * The internal integrator is clamped so that the integral term's contribution to the output + * stays between minimumIntegral and maximumIntegral. This prevents integral windup. * - * @param minimumIntegral The minimum value of the integrator. - * @param maximumIntegral The maximum value of the integrator. + * @param minimumIntegral The minimum contribution of the integral term. + * @param maximumIntegral The maximum contribution of the integral term. */ void SetIntegratorRange(double minimumIntegral, double maximumIntegral); From 521f4f0d425ccc4c6d200ed648470320fee2ca5f Mon Sep 17 00:00:00 2001 From: Carl Hauser Date: Fri, 29 Mar 2024 15:11:00 -0700 Subject: [PATCH 2/3] format and run tests --- .../src/main/native/include/frc/controller/PIDController.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wpimath/src/main/native/include/frc/controller/PIDController.h b/wpimath/src/main/native/include/frc/controller/PIDController.h index 4f094b7f6bd..e8d923ad70f 100644 --- a/wpimath/src/main/native/include/frc/controller/PIDController.h +++ b/wpimath/src/main/native/include/frc/controller/PIDController.h @@ -181,8 +181,9 @@ class WPILIB_DLLEXPORT PIDController /** * Sets the minimum and maximum contributions of the integral term. * - * The internal integrator is clamped so that the integral term's contribution to the output - * stays between minimumIntegral and maximumIntegral. This prevents integral windup. + * The internal integrator is clamped so that the integral term's contribution + * to the output stays between minimumIntegral and maximumIntegral. This + * prevents integral windup. * * @param minimumIntegral The minimum contribution of the integral term. * @param maximumIntegral The maximum contribution of the integral term. From 1793f4008f0bc87136779648a7e423d57861dc2c Mon Sep 17 00:00:00 2001 From: Carl Hauser Date: Sat, 30 Mar 2024 16:08:40 -0700 Subject: [PATCH 3/3] Same changes made to ProfiledPIDController --- .../first/math/controller/ProfiledPIDController.java | 10 +++++----- .../include/frc/controller/ProfiledPIDController.h | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ProfiledPIDController.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ProfiledPIDController.java index e69c73f12c5..a40e7474387 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ProfiledPIDController.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ProfiledPIDController.java @@ -284,13 +284,13 @@ public void disableContinuousInput() { } /** - * Sets the minimum and maximum values for the integrator. + * Sets the minimum and maximum contributions of the integral term. * - *

When the cap is reached, the integrator value is added to the controller output rather than - * the integrator value times the integral gain. + *

The internal integrator is clamped so that the integral term's contribution to the output + * stays between minimumIntegral and maximumIntegral. This prevents integral windup. * - * @param minimumIntegral The minimum value of the integrator. - * @param maximumIntegral The maximum value of the integrator. + * @param minimumIntegral The minimum contribution of the integral term. + * @param maximumIntegral The maximum contribution of the integral term. */ public void setIntegratorRange(double minimumIntegral, double maximumIntegral) { m_controller.setIntegratorRange(minimumIntegral, maximumIntegral); diff --git a/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h b/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h index 72278affca8..7f29ebfbcea 100644 --- a/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h +++ b/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h @@ -257,13 +257,14 @@ class ProfiledPIDController void DisableContinuousInput() { m_controller.DisableContinuousInput(); } /** - * Sets the minimum and maximum values for the integrator. + * Sets the minimum and maximum contributions of the integral term. * - * When the cap is reached, the integrator value is added to the controller - * output rather than the integrator value times the integral gain. + * The internal integrator is clamped so that the integral term's contribution + * to the output stays between minimumIntegral and maximumIntegral. This + * prevents integral windup. * - * @param minimumIntegral The minimum value of the integrator. - * @param maximumIntegral The maximum value of the integrator. + * @param minimumIntegral The minimum contribution of the integral term. + * @param maximumIntegral The maximum contribution of the integral term. */ void SetIntegratorRange(double minimumIntegral, double maximumIntegral) { m_controller.SetIntegratorRange(minimumIntegral, maximumIntegral);