EKF: remove Ekf::KHP and move KHP to the methods where it's used

Everywhere where KHP is used, it is first completely reset, thus making
it unnecessary to keep it as a class member.

This saves 2.3KB RAM.

Stack sizes don't need changing, since there is already a function
Ekf::predictCovariance(), which needs around 3KB of stack and is called
close to where the fuse* functions are called.
This commit is contained in:
Beat Küng
2016-11-01 22:49:20 +01:00
committed by Lorenz Meier
parent 227938d263
commit 25cb400da9
5 changed files with 6 additions and 1 deletions
+3
View File
@@ -320,6 +320,7 @@ void Ekf::fuseMag()
}
float KHP[_k_num_states][_k_num_states];
for (unsigned row = 0; row < _k_num_states; row++) {
for (unsigned column = 0; column < _k_num_states; column++) {
float tmp = KH[row][0] * P[0][column];
@@ -643,6 +644,7 @@ void Ekf::fuseHeading()
}
}
float KHP[_k_num_states][_k_num_states];
for (unsigned row = 0; row < _k_num_states; row++) {
for (unsigned column = 0; column < _k_num_states; column++) {
float tmp = KH[row][0] * P[0][column];
@@ -779,6 +781,7 @@ void Ekf::fuseDeclination()
}
}
float KHP[_k_num_states][_k_num_states];
for (unsigned row = 0; row < _k_num_states; row++) {
for (unsigned column = 0; column < _k_num_states; column++) {
float tmp = KH[row][16] * P[16][column];