mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpimath] Fix computation of C for DARE (A, C) detectability check (#5609)
If Q has off-diagonal entries, C and Cᵀ are different.
This commit is contained in:
@@ -73,10 +73,13 @@ void CheckDARE_ABQ(const Eigen::Matrix<double, States, States>& A,
|
||||
}
|
||||
|
||||
// Require (A, C) pair be detectable where Q = CᵀC
|
||||
//
|
||||
// Q = CᵀC = LDLᵀ
|
||||
// C = √(D)Lᵀ
|
||||
{
|
||||
Eigen::Matrix<double, States, States> C =
|
||||
Eigen::Matrix<double, States, States>{Q_ldlt.matrixL()} *
|
||||
Q_ldlt.vectorD().cwiseSqrt().asDiagonal();
|
||||
Q_ldlt.vectorD().cwiseSqrt().asDiagonal() *
|
||||
Eigen::Matrix<double, States, States>{Q_ldlt.matrixL().transpose()};
|
||||
|
||||
if (!IsDetectable<States, States>(A, C)) {
|
||||
std::string msg = fmt::format(
|
||||
|
||||
Reference in New Issue
Block a user