MAVLink Customisation
QGC communicates with flight stacks using MAVLink, a very lightweight messaging protocol that has been designed for the drone ecosystem.
QGC includes the all.xml dialect by default. The all.xml includes all other dialects in the mavlink/mavlink repository, and allows it to communicate with both PX4 and Ardupilot. Previous versions of QGC (v4.2.8 and earlier), used the ArduPilotMega.xml dialect.
In order to add support for a new set of messages you should add them to development.xml, ArduPilotMega.xml, or common.xml (for PX4), or fork QGroundControl and include your own dialect.
To modify the version of MAVLink used by QGC:
Update the CMake MAVLink Options in /qgroundcontrol/cmake/CustomOptions.cmake or when using the built-in custom build support you can override these options in /qgroundcontrol/custom/cmake/CustomOverrides.cmake.
QGC_MAVLINK_GIT_REPO - This is a link to the git repo to use, by default this is a link to https://github.com/mavlink/mavlink. You can also build your own libraries using the MAVLink toolchain and upload to your own git repo.
QGC_MAVLINK_GIT_TAG - This points to the git tag you would like to use in the chosen repo. This should likely be updated on occasion to use the latest version of MAVLink.
You can also set the mavlink directory to a local path by using the CMake variable CPM_mavlink_SOURCE. Just add to /qgroundcontrol/cmake/CustomOptions.cmake:
cmakeset(CPM_mavlink_SOURCE "/path/to/your/custom/mavlink")
32-bit system IDs
QGC supports the MAVLink 2 extensions for 32-bit system IDs and explicit header system targets provided by the upstream pymavlink generator. Vehicle and GCS system IDs use the unsigned range 1–4294967295. Set the GCS ID in MAVLink settings or with --system-id. Ordinary 8-bit IDs continue to use standard MAVLink headers; peers need extension support to communicate with larger IDs.
Custom MAVLink sources must include pymavlink's 32-bit system ID support and provide compatible generated headers. See the CMake MAVLink options for the current default repository and revision.
Message payload structs keep their existing wire layout. Use generated pack functions with full-width target IDs, and mavlink_msg_get_target_sysid when receiving messages. A decoded payload's 8-bit target field cannot represent a wide header target. Other system references embedded in payloads, such as gimbal control ownership fields, retain their protocol-defined width. For this reason QGC refuses gimbal control, and tells the user why, when its GCS system ID is above 255.