How does Airframe configuration work?

Hi, I am still trying to understand how airframe works and how QGroundControl communicates with firmware. Can someone let me know if my following understanding is correct and answer the questions?

Per PX4 Development Guide, Airframe Configuration files in ROMFS/px4fmu_common/init.d have following blocks:

  • Airframe Documentation
  • Vehicle-specific settings, including tuning gains
  • The controllers/apps it should start
  • The physical configuration of the system: mixer.

Questions:

  1. My understanding is Airframe Configuration files themselves will not be built into the firmware. Instead, the block of Airframe Documentation is used to generate airframes.xml during build time. This xml file is built into the firmware. QGroundControl gets airframes.xml from the drone and displays all available airframes for the user to select. Is this correct?
  2. The data in other 3 blocks (vehicle-specific settings, starting controllers/apps, mixer to be used) is built into the firmware. And it is built for all airframes, not just the airframe we are using. If this is correct, where are these data items kept in the firmware?
  3. During Drone configuration, user needs to select an airframe in QGroundControl. QGroundControl must pass the user’s selection to the drone. What data is passed to the drone? Is it airframe id in airframes.xml? How is it passed?
  4. After the airframe that the user selects is passed to drone, what happens next? What firmware code and how does the code start to set the corresponding parameters and mixer?

Thanks a lot!

I believe my understanding on item 1 is correct. I saw following code in px_mkfw.py:

if args.airframe_xml != None:
f = open(args.airframe_xml, “rb”)
bytes = f.read()
desc[‘airframe_xml_size’] = len(bytes)
desc[‘airframe_xml’] = base64.b64encode(zlib.compress(bytes,9)).decode(‘utf-8’)

Can someone answer my other questions? Especially question 4.

Thanks.