[wpimath] Fix precondition violation messages in LQR and Kalman filters (#6731)

This commit is contained in:
Tyler Veness
2024-06-21 20:55:01 -07:00
committed by GitHub
parent d2b1aa1869
commit b8c2571638
9 changed files with 20 additions and 21 deletions

View File

@@ -45,7 +45,7 @@ class LinearQuadraticRegulator {
* @param Qelems The maximum desired error tolerance for each state.
* @param Relems The maximum desired control effort for each input.
* @param dt Discretization timestep.
* @throws std::invalid_argument If the system is uncontrollable.
* @throws std::invalid_argument If the system is unstabilizable.
*/
template <int Outputs>
LinearQuadraticRegulator(const LinearSystem<States, Inputs, Outputs>& plant,
@@ -64,7 +64,7 @@ class LinearQuadraticRegulator {
* @param Qelems The maximum desired error tolerance for each state.
* @param Relems The maximum desired control effort for each input.
* @param dt Discretization timestep.
* @throws std::invalid_argument If the system is uncontrollable.
* @throws std::invalid_argument If the system is unstabilizable.
*/
LinearQuadraticRegulator(const Matrixd<States, States>& A,
const Matrixd<States, Inputs>& B,
@@ -79,7 +79,7 @@ class LinearQuadraticRegulator {
* @param Q The state cost matrix.
* @param R The input cost matrix.
* @param dt Discretization timestep.
* @throws std::invalid_argument If the system is uncontrollable.
* @throws std::invalid_argument If the system is unstabilizable.
*/
LinearQuadraticRegulator(const Matrixd<States, States>& A,
const Matrixd<States, Inputs>& B,
@@ -96,7 +96,7 @@ class LinearQuadraticRegulator {
* @param R The input cost matrix.
* @param N The state-input cross-term cost matrix.
* @param dt Discretization timestep.
* @throws std::invalid_argument If the system is uncontrollable.
* @throws std::invalid_argument If the system is unstabilizable.
*/
LinearQuadraticRegulator(const Matrixd<States, States>& A,
const Matrixd<States, Inputs>& B,

View File

@@ -44,8 +44,7 @@ LinearQuadraticRegulator<States, Inputs>::LinearQuadraticRegulator(
if (!IsStabilizable<States, Inputs>(discA, discB)) {
std::string msg = fmt::format(
"The system passed to the LQR is uncontrollable!\n\nA =\n{}\nB "
"=\n{}\n",
"The system passed to the LQR is unstabilizable!\n\nA =\n{}\nB =\n{}\n",
discA, discB);
wpi::math::MathSharedStore::ReportError(msg);