How to keep RC and sensor calibration parameters during param reset

About

We often end up wanting to reset the parameters in PX4 via QGC, for example when upgrading to new version with breaking changes, or just wanting to re-start on the whole setup again.

However, I have repeatedly noticed that the current “parameter reset” is a bit too crude, and results in undesired behaviors such as wiping out the sensor calibration data, rc calibration, as well as board mounting and orientation data.

So in this post I will break down ways to have a back-up for those parameters, so that you don’t have to re-calibrate over and over again :wink: (thanks to @Jakob_Strebel’s comment, which inspired this post)

Current Mechanism in QGC for parameter reset

In QGC Parameters tab, we currently have the following options related to resetting the parameters:

  • Reset all to firmware’s defaults
  • Reset to vehicle’s configuration defaults
  • Load from file
  • Save to file
  • Clear all RC to Param

So what to all of these mean? I will explain each briefly below.

Reset to Firmware’s defaults

This button sends the “MAV_CMD_PREFLIGHT_STORAGE” MAVLink message with the PARAM_RESET_CONFIG_DEFAULT telling PX4 to:

Reset all user configurable parameters to their default value (including airframe selection, sensor calibration data, safety settings, and so on). Does not reset values that contain operation counters and vehicle computed statistics.

This effectively resets “all” the parameters to their default value (the values are documented in Parameter Reference | PX4 User Guide (main)). And your airframe selection (which vehicle type you are using, etc) will effectively all be lost, and PX4 will return to a state that you would have if you flashed a flight controller with PX4 the first time.

Reset to vehicle’s configuration defaults

This sets the SYS_AUTOCONFIG parameter to non-zero value, which is documented to do:

Set to 1 to reset parameters on next system startup (setting defaults). Platform-specific values are used if available. RC* parameters are preserved.

The implementation can be found in the startup script (rcS) here:

This effectively resets “all but specified (airframe selection, RC calibration, Sensor calibration, etc)” parameters, which is most of the times what we want to do.

Conclusion

So funny enough, I realized during writing that the “Reset to vehicle’s configuration defaults” is the reset button people should be using, to keep the calibration values, so there’s no need to do anything fancy like parameter backup it seems.

:tada: If you want to keep your calibration values, but reset everything else, press “Reset to vehicle’s configuration defaults” in Parameters>Tools of QGC

Other

Note, there’s an ongoing discussion on how to “prevent” people from accidentally resetting all the parameters (even I after using PX4 for 2 years didn’t know what “Reset to vehicle’s configuration defaults” really meant, so it must be very confusing for most users!) by providing a ‘lock’ on those calibration parameters.

1 Like

For the more advanced users, this is one of the use cases I’ve created Parasect for. But I understand this is a bit out of scope for this post.

1 Like

Oh interesting! How would that be possible?

I’ve written an example workflow for Ardupilot, but it would be practically the same for PX4: Usage Example with Ardupilot - Parasect documentation

Essentially:

  1. You’d bring the FC to the state that you consider “default” (that could be right after boot or after you’ve tuned it) and save that parameter list.
  2. You’d write a list with the parameters that you consider “calibration”
  3. You’d write a list with the parameters that you consider “operator/safety”
  4. You’d have Parasect build a new parameter list that is all of #1, but none of #2 nor #3.

Then you can upload this parameter list to your vehicle to reset its configuration but leave calibration and safety parameters intact, as they are in the FC memory.

1 Like