-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
sensor priority after failure and EKF2 bias reset #8199
Conversation
Works on the bench, although I'm not quite sure if this is the best way to handle the priorities or per sensor disable (driver level or sensors module) |
if ((sensor_selection_prev.timestamp > 0) && (sensor_selection.timestamp > sensor_selection_prev.timestamp)) { | ||
if (sensor_selection.accel_device_id != sensor_selection_prev.accel_device_id) { | ||
PX4_WARN("accel id changed, resetting IMU bias"); | ||
_ekf.reset_imu_bias(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check if this returns true or false. If false, then the call needs to be repeated until it returns true. It will return false and not perform the reset if called less than 10 seconds since the last reset.
_ekf.reset_imu_bias(); | ||
} | ||
|
||
if (sensor_selection.gyro_device_id != sensor_selection_prev.gyro_device_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic should be reworked so that the accel and gyro checks are combined into a single IMU check and ekf.reset_imu_bias() is only called once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit here: https://github.com/priseborough/Firmware/commits/pr8199
_acc_bias_learn_acc_lim(this, "EKF2_ABL_ACCLIM", false, _params->acc_bias_learn_acc_lim), | ||
_acc_bias_learn_gyr_lim(this, "EKF2_ABL_GYRLIM", false, _params->acc_bias_learn_gyr_lim), | ||
_acc_bias_learn_tc(this, "EKF2_ABL_TAU", false, _params->acc_bias_learn_tc), | ||
_acc_bias_lim(this, "ABL_LIM", true, _params->acc_bias_lim), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing the names of these parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's using the parent prefix (third param = true). It saves a few characters but I'm really not a fan of it, because:
- you cannot grep the source to find where a param is used. This already caught me by surprise.
- it adds confusion and makes the API more complicated than needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it either way as long as it's consistent per module (this wasn't).
This branch should not have been merged before the ecl change was tested and merged. As it is it has a bug and does not reset the bias states for the first failure. I tested this on a pixracer with debug cable connected and disabled IMU0 off by entering mpu6000 stop at the nsh console, however this did not result in the IMU biases being reset because sensor selection messages are only published when the selection changes and the ekf2 starts after the first publication. This is fixed by #8207 |
#8186