Methods of Setting Default Parameters

Hello PX4 friends,

I’ve come across different ways of altering default parameters of PX4 Firmware, and I am trying to understand each methods’ pros and cons, and when should each method be utilized. Some of these might not be a “method” or a suggested way of changing parameters but I’m still including them in this post.

1. Using QGC UI to change the parameters.
I suppose that this method is for changing the parameters after everything’s been built and flashed into the FCU.

2. Adding a new airframe configuration or modifying an existing one to ROMFS/px4fmu_common/init.d
As described in this devguide topic, it is possible to change default parameters by choosing an airframe of interest, whether it is completely new or modified. According to what I have read in some previous posts where people asked questions regarding this method of setting parameters, the new or modified airframe configuration is added to airframes.xml when the firmware is built. This method is basically using the param set command which is provided in nsh.

3. Overwriting a default parameter in the cmake file
Although I have never used this method myself, I see that it is also possible to override default parameters at build time, by adding something like
set(PARAM_DEFAULT_OVERRIDES "{\\\"SYS_MC_EST_GROUP\\\": 1}") to cmake as done here to change the default parameter. Is this only the case for SYS_MC_EST_GROUP parameter or can it be done for any parameter of choice?

What are the advantages and disadvantages of using these 3 methods? Is PX4 utilized the same way in the first two methods? How does the third method differ than the others? What is the suggested way of using the third method if there is any? (Even after build time, changing some parameters such as SYS_AUTOSTART or SYS_MC_EST_GROUP breaks the firmware and standard PX4 should be flashed for the fcu to boot properly again.)

Thank you,

The default parameters are defined in the *_params.c files. For example Firmware/src/modules/commander/commander_params.c. There is no need to modify cmake files.

If the default is not good for your specific airframe, you can change it in the airframe file. Then the final option is to change it from QGC, which is useful if you want to change parameters after flashing. For example if you want to tune your controller gains.

  1. Using QGC UI to change the parameters.

This is the easiest way of modifying parameters on the go

Depending on SYS_AUTOCONFIG, values might not be saved between boots. As far as I know, no easy way to ensure consistency across multiple pixhawk across boots.

Also I believe not all parameters can be updated this way.

  1. Adding a new airframe configuration or modifying an existing one to ROMFS/px4fmu_common/init.d

Values can be set explicitly for each airframe. Combine with git (or any vcs) you can ensure consistent settings are loaded.

You must already know all the values, not possible if you’re flying and tuning a new aircraft.

  1. Overwriting a default parameter in the cmake file

Not used this personally. Can’t comment. Sounds like there are easier ways to do it. See 2,4,5

  1. Changing default values in *_param.c

All default values are set in various param.c files. You can modify them accordingly.

Seems overkill to alter default param for ALL airframes.
Git will record commits to any changes in *_param.c (good and bad)

  1. Customizing System boot (see

Modifying the following 3 files in the SD card also allows values to be modified.


Allow customization without altering source code.
Ensure all values are loaded consistently.

Need remember to load files into SD card

I personally use methods 2, 4 & 5. Also, before flight, I verify the loaded params in QGC

1 Like

Thank you for your detailed and precise reply! I have tried the 5th method that you have mentioned, for example my config file is as follows:

param set MC_ROLLRATE_P 0.062
param set MC_ROLLRATE_I 0.035
param set MC_ROLLRATE_D 0.0019
param set MC_PITCH_P 6.0
param set MC_PITCHRATE_P 0.06
param set MC_PITCHRATE_I 0.034
param set MC_PITCHRATE_D 0.0019
param set MC_YAWRATE_P 0.23
param set MC_YAWRATE_I 0.12
param set MC_YAWRATE_D 0.0

and I saved it under /microsd/etc/ as config.txt . I only see these parameters and other Multicopter Attitude Control parameters are gone. What could be the cause of this? Thank you .

I believe the syntax should be

set MC_* value

I don’t have access to a pixhawk to test for you right now.

Hmmm… I think this is the difference between parameter and variable in PX4. Thanks anyway, I solved the problem by flashing Ardupilot then reflashing PX4. Almost always solves the problem :slight_smile: