From d6bd72d7382b53bbcf706f1c035a9698f52d6864 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Mon, 19 Jun 2023 20:11:20 -0400 Subject: [PATCH] [wpimath] ProfiledPIDController: Add getConstraints (#5399) --- .../wpi/first/math/controller/ProfiledPIDController.java | 9 +++++++++ .../include/frc/controller/ProfiledPIDController.h | 6 ++++++ 2 files changed, 15 insertions(+) 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 02cc17d720..a832472d3f 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 @@ -199,6 +199,15 @@ public class ProfiledPIDController implements Sendable { m_constraints = constraints; } + /** + * Get the velocity and acceleration constraints for this controller. + * + * @return Velocity and acceleration constraints. + */ + public TrapezoidProfile.Constraints getConstraints() { + return m_constraints; + } + /** * Returns the current setpoint of the ProfiledPIDController. * diff --git a/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h b/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h index 8491118083..4e32c13c6d 100644 --- a/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h +++ b/wpimath/src/main/native/include/frc/controller/ProfiledPIDController.h @@ -185,6 +185,12 @@ class ProfiledPIDController */ void SetConstraints(Constraints constraints) { m_constraints = constraints; } + /** + * Get the velocity and acceleration constraints for this controller. + * @return Velocity and acceleration constraints. + */ + Constraints GetConstraints() { return m_constraints; } + /** * Returns the current setpoint of the ProfiledPIDController. *