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

**Feature Request**: block arming after sensor calibration, require system reboot (or graceful re-init) prior to flight #9030

Closed
Antiheavy opened this issue Mar 6, 2018 · 16 comments

Comments

@Antiheavy
Copy link
Contributor

Antiheavy commented Mar 6, 2018

I've seen it recommended many times that the system should get a full power-cycle reboot after sensor re-calibration. In out own experience, the step change or dynamic motion after sensor re-calibration (especially Compass Cal) often causes EKF or sensor warnings. We've had flights where the EKF got unhappy after takeoff due to a re-calibration during preflight, ultimately causing failsafe behavior and sometimes vehicle crashes.

We've experimented a lot with soft reset of the EKF and soft reset of the whole firmware, but that often cause various other errors too - certain external sensor may remain powered during a soft reset or state machine things aren't resetting and that may mess with things. The most reliable method of cleanly re-initializing the EKF after calibration is a full system power cycle.

Proposal: after completion of a sensor calibration :

  1. send the message "sensor calibration updated, reboot required before arming",
  2. If arming is attempted, block the arming and send the same message again.
    A system flag may be required for this.

FYI @dagar @priseborough

@Antiheavy Antiheavy changed the title **Feature Request**: block arming after sensor calibration to require system reboot prior to flight **Feature Request**: block arming after sensor calibration, require system reboot prior to flight Mar 6, 2018
@LorenzMeier
Copy link
Member

That makes total sense.

@priseborough
Copy link
Contributor

I support this proposal. The step change in sensor offsets combined with the motion associated with calibration can be outside estimator tuning limits and and number of states/variables external to the estimator that would need to be handled correctly make an enforced reboot the logical choice.

@mhkabir mhkabir added this to the Release v1.8.0 milestone Apr 21, 2018
@dagar dagar self-assigned this Apr 21, 2018
@dagar
Copy link
Member

dagar commented Apr 21, 2018

I would propose trying to directly address these issues rather than a full power cycle.

  1. The state machine shouldn't allow arming with any of these errors. If this isn't already the case in master after commander state machine fix preflight and prearm error #9193 it needs to be fixed.

  2. The system should be aware of calibration status either as a new calibration_status message or possibly as an entirely new arming state.

  3. The EKF should reinitialize after it sees the transition out of ARMING_STATE_CALIBRATION.

  4. If the EKF has any initialization requirements we should monitor, enforce, and report them.

    • no rotation? "Vehicle must be still while EKF is initializing"
    • @priseborough anything else?
    • I don't know that it matters anymore, but we'd also have everything in place to ignore that for ARMING_STATE_IN_AIR_RESTORE

1 & 2 could be done first and used to implement @Antiheavy's proposal immediately while 3 & 4 can come later.

@Antiheavy
Copy link
Contributor Author

no rotation? "Vehicle must be still while EKF is initializing"

the system could check if rotation and acceleration is low before re-initializing. If motion is detected a warning can be set: "Hold vehicle still to re-initialize sensors after calibration". I also think there should be some positive feedback after a calibration that the re-initialization was successful. This could be a text message, but might be better as a "all good" state indicator displayed in QGC. e.g. #8697

@Antiheavy
Copy link
Contributor Author

and number of states/variables external to the estimator that would need to be handled correctly make an enforced reboot the logical choice.

@priseborough makes an important point here as well.

@dagar
Copy link
Member

dagar commented Apr 21, 2018

and number of states/variables external to the estimator that would need to be handled correctly make an enforced reboot the logical choice.

@priseborough makes an important point here as well.

He's not wrong, I just think it's a sign of a deeper problem if we can't find a way to do this cleanly/safely.

@dagar dagar removed this from the Release v1.8.0 milestone May 4, 2018
@Antiheavy Antiheavy changed the title **Feature Request**: block arming after sensor calibration, require system reboot prior to flight **Feature Request**: block arming after sensor calibration, require system reboot (or graceful re-init) prior to flight May 12, 2018
@Antiheavy
Copy link
Contributor Author

Related issue in the QGC repo from another user: mavlink/qgroundcontrol#6768 (comment)

@dagar
Copy link
Member

dagar commented Aug 6, 2018

Perhaps we should finally do something about this. I propose we add a CALIBRATION state to the arming state transition table.

EKF2 already monitors the arming state to know when it's safe to save parameters for things like the learned mag bias. On transition out of CALIBRATION we can have EKF2 reinitialize itself, including asking the user to hold the vehicle still if necessary.

Thoughts?

@stale
Copy link

stale bot commented Jan 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Antiheavy
Copy link
Contributor Author

This issue is still valid. Multiple solutions have been proposed here for consideration if/when someone is able to work on it.

@Antiheavy
Copy link
Contributor Author

still valid. more graceful re-initialization after re-calibration is needed for commercial and consumer grade products.

@stale stale bot removed the Admin: Wont fix label Jun 25, 2019
@PX4 PX4 deleted a comment from stale bot Jun 25, 2019
@dagar dagar added this to the Release v1.10.0 milestone Jun 25, 2019
@stale
Copy link

stale bot commented Sep 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Antiheavy
Copy link
Contributor Author

Still valid issue.

@dagar
Copy link
Member

dagar commented Sep 1, 2020

A different solution - #15655

@dagar
Copy link
Member

dagar commented Jan 9, 2021

I think we can consider this one effectively resolved for a few reasons.

  1. The estimator(s) are now aware of sensor calibration changes (accel/gyro/mag) synchronized with the actual change applied.
  2. We actually reset the estimated mag bias on change.
  3. Sensor calibrations (accel/gyro/mag) no longer involve zeroing out the old calibration first. The calibration procedures are always performed directly on raw data, and on success the calibration is updated from old -> new atomically with a synchronized estimated bias reset.

If there's still concern I'm happy to entertain additional mechanisms for further enforced user behaviour (requiring the user to stop spinning before completing mag cal?), but I'd like to see data first.

@dagar dagar closed this as completed Jan 9, 2021
@Antiheavy
Copy link
Contributor Author

hooray!

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

No branches or pull requests

6 participants