Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EKF crashing when flying with VL53 sensor only #182

Closed
ataffanel opened this issue Dec 20, 2016 · 4 comments
Closed

EKF crashing when flying with VL53 sensor only #182

ataffanel opened this issue Dec 20, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@ataffanel
Copy link
Member

ataffanel commented Dec 20, 2016

When flying with the VL53 deck and the kalman filter, the EKF is crashing at random interval on a NaN assert:

SYS: The system resumed after watchdog timeout [WARNING]
SYS: Assert failed at src/modules/src/estimator_kalman.c:789

It corresponds to this line:

configASSERT(!isnan(HPHR));

Further investigation seems to indicate that in at least one case PHTd[STATE_X] was NaN.

Tested with the version 72146a6 and the config.mk:

ESTIMATOR=kalman
CFLAGS+=-DUPDATE_KALMAN_WITH_RANGING
@ataffanel
Copy link
Member Author

Found that H of the tof update could contain a NaN:

h[STATE_Z] = 1 / cosf(alpha);

h[STATE_Z] = 1 / cosf(alpha);

This is a good reason for the ekf to crash.

@ataffanel
Copy link
Member Author

The problem comes from R[2][2] > 1.0. Since R is a rotation matrix it is not supposed to be possible.

@ataffanel
Copy link
Member Author

I can confirm that there is rounding errors when calculating the rotation matrix R, I printed R[2][2] when it is > 1 and I get R[2][2] = 1.0. Which means that the value is really close to 1 but just over when compared to 1.

This should be fixable by making sure all element of R are within [-1, 1].

@ataffanel ataffanel self-assigned this Dec 20, 2016
@ataffanel ataffanel added the bug label Dec 20, 2016
@ataffanel ataffanel added this to the Next version milestone Dec 20, 2016
@ataffanel
Copy link
Member Author

Fixed by removing the VL53 aperture angle compensation: the effect was very small (I cannot see any difference) and it removes the acos() that was causing the NaN.

hmllr added a commit to nikhil-sethi/crazyflie-firmware that referenced this issue Mar 27, 2023
it seems as if those lines were not added by accident in 2017 (bitcraze@557dc37).
This is still under test, due to an issue from 2016: bitcraze#182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant