From fdfb85f69536c8c1aa9975746d63ed17dcdb0285 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sat, 17 Sep 2022 00:18:08 -0700 Subject: [PATCH] [wpimath] Remove Java LQR constructor that takes a controller gain matrix (#4419) The controller gain matrix K should be computed from the solution to the DARE, but this constructor does not do that. It effectively violates a postcondition enforced by the other constructors by letting the user throw in a controller gain matrix that didn't come from an LQR. Removing this constructor is a breaking change, but it never should have been included in the class in the first place. There's also no valid reason to use it. I assume it was originally added for debugging the class internals. This constructor does not exist in C++. --- .../controller/LinearQuadraticRegulator.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java index 7f16576bcf..190cd2a678 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java @@ -7,7 +7,6 @@ package edu.wpi.first.math.controller; import edu.wpi.first.math.Drake; import edu.wpi.first.math.MathSharedStore; import edu.wpi.first.math.Matrix; -import edu.wpi.first.math.Nat; import edu.wpi.first.math.Num; import edu.wpi.first.math.StateSpaceUtil; import edu.wpi.first.math.Vector; @@ -175,24 +174,6 @@ public class LinearQuadraticRegulator states, Nat inputs, Matrix k) { - m_K = k; - - m_r = new Matrix<>(states, Nat.N1()); - m_u = new Matrix<>(inputs, Nat.N1()); - - reset(); - } - /** * Returns the control input vector u. *