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

sensor priority after failure and EKF2 bias reset #8199

Merged
merged 5 commits into from
Oct 29, 2017

Conversation

dagar
Copy link
Member

@dagar dagar commented Oct 26, 2017

  • if the primary sensor switches due to voting drop the priority to the minimum
  • EKF2 reset IMU bias when the sensor changes
  • add a boolean parameter to each sensor
    • CAL_ACCX_EN
    • CAL_GYROX_EN
    • CAL_MAGX_EN

#8186

@dagar dagar added the bug label Oct 26, 2017
@dagar dagar added this to the Release v1.7.0 milestone Oct 26, 2017
@dagar dagar changed the title [WIP] sensor priority after failure and EKF2 bias reset sensor priority after failure and EKF2 bias reset Oct 27, 2017
@dagar
Copy link
Member Author

dagar commented Oct 27, 2017

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();
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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),
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Member Author

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).

@LorenzMeier LorenzMeier merged commit 9fde192 into PX4:master Oct 29, 2017
@priseborough
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants