Skip to content

Bulk Request AVAILABLE_MODES instead of requesting each mode separately#14283

Open
av-remco wants to merge 2 commits intomavlink:masterfrom
av-remco:master
Open

Bulk Request AVAILABLE_MODES instead of requesting each mode separately#14283
av-remco wants to merge 2 commits intomavlink:masterfrom
av-remco:master

Conversation

@av-remco
Copy link
Copy Markdown

Description

Improves what the comment at line 120 of StandardModes.cc suggests

// Request one at a time. This could be improved by requesting all, but we can't use Vehicle::requestMessage for that

I noticed that QGC does not wait for COMMAND_ACKs when sending MAV_CMD_REQUEST_MESSAGE with param1 = 435, i.e. the AVAILABLE_MODES message. These are sent 25 times on startup. PX4 SITL gets flooded by the requests and fails to ack each message due to a buffer overflow, with error

pxh> ERROR [mavlink] vehicle_command_ack lost, generation 5 -> 26

This PR uses a single MAV_CMD_REQUEST_MESSAGE to get all AVAILABLE_MODES. The operation is successful when the last mode is received. It fails when the COMMAND_ACK indicates a failure.

Re-requesting missing modes is out of scope for this PR, but a good future addition. Current implementation also does not cover this.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes
  • Other

Testing

  • Tested locally
  • Added/updated unit tests
  • Tested with simulator (SITL)
    Both PX4 1.16.1 and ArduQuad. Not relevant for Ardu, since the message is not sent. Captured the .tlog from the build and analyzed this.
  • Tested with hardware

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

  • PX4
  • ArduPilot

Screenshots

Custom log monitoring tool
Before:
image

After:
image

Checklist

  • I have read the Contribution Guidelines
  • I have read the Code of Conduct
  • My code follows the project's coding standards
  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally

Related Issues


By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your first pull request! 🎉

A maintainer will review this soon. Please ensure:

  • CI checks pass
  • Code follows coding standards
  • Changes tested on relevant platforms

We appreciate your contribution to QGroundControl!

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 39.68254% with 38 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@9eeee46). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/Vehicle/StandardModes.cc 38.33% 24 Missing and 13 partials ⚠️
src/Vehicle/Vehicle.cc 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #14283   +/-   ##
=========================================
  Coverage          ?   26.06%           
=========================================
  Files             ?      755           
  Lines             ?    68006           
  Branches          ?    31516           
=========================================
  Hits              ?    17727           
  Misses            ?    37502           
  Partials          ?    12777           
Flag Coverage Δ
unittests 26.06% <39.68%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Vehicle/Vehicle.cc 22.91% <66.66%> (ø)
src/Vehicle/StandardModes.cc 47.19% <38.33%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9eeee46...47e2f60. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 4 passed, 36 failed, 7 skipped.

Test Results

linux-coverage: 85 passed, 0 skipped
linux-sanitizers: 85 passed, 0 skipped
Total: 170 passed, 0 skipped

Code Coverage

Coverage: 59.1%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 247.81 MB
QGroundControl-aarch64 177.23 MB
QGroundControl-installer-AMD64 134.83 MB
QGroundControl-installer-AMD64-ARM64 77.46 MB
QGroundControl-installer-ARM64 106.16 MB
QGroundControl-linux 338.35 MB
QGroundControl-mac 188.82 MB
QGroundControl-windows 188.84 MB
QGroundControl-x86_64 172.36 MB
No baseline available for comparison

Updated: 2026-04-17 07:44:54 UTC • Triggered by: Android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant