mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 12:47:36 +08:00
ekf: fix variable length array error
Even if the non_zeros() function is static constexpr, gcc (10.2) does not like it. Using sizeof...(Idxs) fixes the error.
This commit is contained in:
@@ -671,7 +671,8 @@ private:
|
|||||||
template <size_t ...Idxs>
|
template <size_t ...Idxs>
|
||||||
SquareMatrix24f computeKHP(const Vector24f& K, const SparseVector24f<Idxs...>& H) const {
|
SquareMatrix24f computeKHP(const Vector24f& K, const SparseVector24f<Idxs...>& H) const {
|
||||||
SquareMatrix24f KHP;
|
SquareMatrix24f KHP;
|
||||||
float KH[H.non_zeros()];
|
constexpr size_t non_zeros = sizeof...(Idxs);
|
||||||
|
float KH[non_zeros];
|
||||||
for (unsigned row = 0; row < _k_num_states; row++) {
|
for (unsigned row = 0; row < _k_num_states; row++) {
|
||||||
for(unsigned i = 0; i < H.non_zeros(); i++) {
|
for(unsigned i = 0; i < H.non_zeros(); i++) {
|
||||||
KH[i] = K(row) * H.atCompressedIndex(i);
|
KH[i] = K(row) * H.atCompressedIndex(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user