Custom firmware losing calibration data

Hello All,
I’ve built a quad tiltrotor VTOL firmware. Everything seems to be ok for the control part.

The problem I’m facing is that after calibration when connected to QGC, when pixhawk is powered down I’m losing the custom airframe configuration, all sensors, radios, compass are displayed as not calibrated, in red on QGC.
I want a persistent calibration data once the airframe is selected and applied from QGC.

How can I prevent loss of configuration data?

Thanks,
Kashyap

Do you have a file in ROMFS/px4fmu_common/init.d/airframes that corresponds to your SYS_AUTOSTART parameter setting?

Hello Danduril, Thanks for the response. I have a airframe file in the specific directory starting with a number for VTOL series. Where is SYS_AUTOSTART supposed to be set and how do I set it?

You can set parameters via QGC in the vehicle setup panel. Or, use mavlink console, or the debug console:

pxh> param show SYS_AUTOSTART
Symbols: x = used, + = saved, * = unsaved
x + SYS_AUTOSTART [600,990] : 1044

 618/1216 parameters used.
pxh> param set SYS_AUTOSTART <your airframe id>

QGC Airframe panel should show your custom model if you load the custom firmware via QGC (not using make <your target> upload), shutdown QGC, and start QGC again.

I’m relatively new to the Pixhawk flight stack and firmware in general, but my question relates to this. According to Mixing and Actuators | PX4 User Guide, you can change the mixer via SD card directory. I’m wondering if you can do the same for .toml geometry files to change which motor is controlled by which signal. Furthermore, I’m looking to create a .aux.mix file for coax octo so that the bottom 4 are controlled by aux1-4 instead of main5-8.

More concretely, is it valid to just create a .toml file with a given key and ordering of rotors and use that key for a mixer file? Would the parsers and other machinery work by just doing that? I assume no for the coax octo case; I think you’d need to specify somewhere that the coax octo needs a .aux.mix file in addition to a .main.mix.

This is probably the most obvious question, can you just bypass the SD card stuff by making the edits via Building PX4 Software | PX4 User Guide or would that risk using an unstable build (is there any way to git clone a stable build)?

Update: From what I understand, changing the appropriate file here PX4-Autopilot/ROMFS/px4fmu_common/init.d/airframes at master · PX4/PX4-Autopilot (github.com) to set appropriate MIXER_AUX for bottom octo coax and appropriate PWM_AUX_OUT, in addition to creating a new .toml file for the bottom rotor config and referencing its key in a new appropriately-named .aux.mix file should produce the desired result. Again, not completely sure if all the machinery works in between.

Hello Danduril,
I tried via the QGC. I selected my airframe, applied and restarted pixhawk. This time I did not see the loss of parameters. This is the standard method I use, the behavior is not consistent. This time I did not lose data.

I wonder if there’s something else other than this that I need to set, may be somewhere in shell scripts or airframe file.

Thanks,
Kashyap

I think downgrading a code load can possibly wipe out calibration, but not sure. Perhaps you load the custom code and then revert to some stable load? Seems like I’ve lost cal in that scenario but there are enough variables that it could have been something else, instead.