mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 13:33:34 +08:00
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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user