mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:53:35 +08:00
ekf2_test: test using positive definite covariance matrix
A covariance matrix needs to be positive definite
This commit is contained in:
committed by
Mathieu Bresciani
parent
10f9ac148f
commit
42f683fa64
@@ -40,6 +40,7 @@ float randf()
|
||||
|
||||
SquareMatrix24f createRandomCovarianceMatrix24f()
|
||||
{
|
||||
// Create a symmetric square matrix
|
||||
SquareMatrix24f P;
|
||||
|
||||
for (int col = 0; col <= 23; col++) {
|
||||
@@ -53,6 +54,9 @@ SquareMatrix24f createRandomCovarianceMatrix24f()
|
||||
}
|
||||
}
|
||||
|
||||
// Make it positive definite
|
||||
P = P.transpose() * P;
|
||||
|
||||
return P;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user