Modifying mixer file without reflashing

Hi,

Is it possible to alter the mixer file without recompiling and reflashing Pixhawk?

(It is somewhat troublesome to perform sensor calibration each time Pixhawk is reflashed).

Ziyang

If your system is not set up incorrectly it will not loose parameters on re-flashing.

I am writing a custom airframe and mixer. (see http://discuss.px4.io/t/adding-new-airframe-to-px4-and-qgc/)

When i make changes to the mixer, I perform

make px4fmu_v2-default

and reupload the binary in QGC using custom firmware option. I find that I always need to rerun the entire sensor calibration process (even though the hardware didnt change). After calibration, QGC allows me to arm and fly.

I can see the mixer files in Pixhawk (via onboard files dialog in QGC), Can I edit them directly?

Ziyang

Are you reselecting the airframe in QGC?

In any case you should be able to save and load your entire parameter set, which also saves your calibration settings. Go to QGroundControl and then in the upper right corner, I think it’s “Tools” there you can save and also load your parameter sets.

1 Like

The process I follow to avoid recompiling is loading the mixer files that I’m tinkering to the compact flash card, I have not been able to download them to pixhawk from QGC directly.

This gives more details on the process:
http://dev.px4.io/advanced-system-startup.html

I have also experienced the problem of having to recalibrate when I flash a new version of the firmware, but I do as Camperinho suggests and save the calibration parameters to a file from QGC and then reload again.

If QGC protests and doesn’t accept the new calibration parameters I open an nsh console to PX4
https://dev.px4.io/advanced-system-console.html
and copy paste the calibration parameters that I’ve previously save to a file directly.

That is I have created a text file with all the necessary calibration parameters such as:
param set CAL_ACC0_XOFF 0.035128116607666016
param set CAL_ACC0_XSCALE 0.994855701923370361
param set CAL_ACC0_YOFF -0.135325431823730469
param set CAL_ACC0_YSCALE 1.000098228454589844
param set CAL_ACC0_ZOFF -0.081358894705772400
param set CAL_ACC0_ZSCALE 0.986901938915252686
param set CAL_ACC1_XOFF 0.995876312255859375

And then select them and right click ( on my mac ) to paste directly on the console.
This works for me although I’m sure there must be a more elegant way to do it.
Eduardo

1 Like

Thanks @ealdaz and @Camperinho, saving/loading the param set is what i am using.

Apparently, from https://dev.px4.io/advanced-system-startup.html#starting-a-custom-mixer, one can customize a mixer without flashing the firmware. From the document

By default the system loads the mixer from /etc/mixers. If a file with the same name exists in /fs/microsd/etc/mixers this file will be loaded instead. This allows to customize the mixer file without the need to recompile the Firmware.

I’m also having trouble with this process. When I add /etc/mixers/MIXER_FILE (or /mixers/MIXER_FILE) to the SD card, the console shows the following at boot:

INFO  [init] Mixer: /etc/mixers/X5.main.mix on /dev/pwm_output0
INFO  [init] Mixer: /etc/mixers/pass.aux.mix on /dev/pwm_output1

I also took care to use UNIX line endings and I don’t think I’m seeing the boot sequence grab the new mixer file.

One thought would be to double check the folder structure in the SD card, the mixer files you want to use need to be in a folder /etc/mixers in the sd card.

that is the SD card needs to have this structure
/etc/mixers/your_mixer_here.main.mix

this will be reported by the init script as:
INFO [init] Mixer: /fs/microsd/etc/mixers/your_mixer_here.main.mix on /dev/pwm_output0

at least this is the case in a nuttx based system