mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Fix precondition violation messages in LQR and Kalman filters (#6731)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user