mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[wpimath] Fix precondition violation messages in LQR and Kalman filters (#6731)
This commit is contained in:
@@ -55,7 +55,7 @@ class KalmanFilter {
|
||||
* @param stateStdDevs Standard deviations of model states.
|
||||
* @param measurementStdDevs Standard deviations of measurements.
|
||||
* @param dt Nominal discretization timestep.
|
||||
* @throws std::invalid_argument If the system is unobservable.
|
||||
* @throws std::invalid_argument If the system is undetectable.
|
||||
*/
|
||||
KalmanFilter(LinearSystem<States, Inputs, Outputs>& plant,
|
||||
const StateArray& stateStdDevs,
|
||||
|
||||
@@ -41,8 +41,8 @@ KalmanFilter<States, Inputs, Outputs>::KalmanFilter(
|
||||
|
||||
if (!IsDetectable<States, Outputs>(discA, C)) {
|
||||
std::string msg = fmt::format(
|
||||
"The system passed to the Kalman filter is "
|
||||
"unobservable!\n\nA =\n{}\nC =\n{}\n",
|
||||
"The system passed to the Kalman filter is undetectable!\n\n"
|
||||
"A =\n{}\nC =\n{}\n",
|
||||
discA, C);
|
||||
|
||||
wpi::math::MathSharedStore::ReportError(msg);
|
||||
|
||||
@@ -58,7 +58,7 @@ class SteadyStateKalmanFilter {
|
||||
* @param stateStdDevs Standard deviations of model states.
|
||||
* @param measurementStdDevs Standard deviations of measurements.
|
||||
* @param dt Nominal discretization timestep.
|
||||
* @throws std::invalid_argument If the system is unobservable.
|
||||
* @throws std::invalid_argument If the system is undetectable.
|
||||
*/
|
||||
SteadyStateKalmanFilter(LinearSystem<States, Inputs, Outputs>& plant,
|
||||
const StateArray& stateStdDevs,
|
||||
|
||||
@@ -39,8 +39,8 @@ SteadyStateKalmanFilter<States, Inputs, Outputs>::SteadyStateKalmanFilter(
|
||||
|
||||
if (!IsDetectable<States, Outputs>(discA, C)) {
|
||||
std::string msg = fmt::format(
|
||||
"The system passed to the Kalman filter is "
|
||||
"unobservable!\n\nA =\n{}\nC =\n{}\n",
|
||||
"The system passed to the Kalman filter is undetectable!\n\n"
|
||||
"A =\n{}\nC =\n{}\n",
|
||||
discA, C);
|
||||
|
||||
wpi::math::MathSharedStore::ReportError(msg);
|
||||
|
||||
Reference in New Issue
Block a user