Skip to content

feat(FlyView): add altitude support for Click to ROI - #14879

Merged
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:roi-click-altitude
Aug 16, 2026
Merged

feat(FlyView): add altitude support for Click to ROI#14879
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:roi-click-altitude

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Fixes #14394

Replaces #14438 (credit to the original author for the initial approach).

Summary

Adds altitude support to Click to ROI in Fly View. Choosing "ROI at location" from the map click drop panel now shows the guided value slider so the user can set the ROI altitude (meters above home, defaulting to 0 = ground level) before slide-to-confirm.

Details

  • Slider semantics: the value is meters above home for both firmwares.
    • ArduPilot: sent unconverted in MAV_FRAME_GLOBAL_RELATIVE_ALT (firmware honors the frame).
    • PX4: converted to AMSL (home.altitude() + relative) and sent in MAV_FRAME_GLOBAL, since PX4 treats the ROI altitude as AMSL regardless of frame (PX4-Autopilot#28257). Fails with a user message if home altitude is unknown.
  • Firmware-specific behavior moved to FirmwarePlugin::guidedModeROI (base = ArduPilot/spec path, PX4 override does the AMSL conversion). The old PX4 terrain-query ROI path in TerrainQueryCoordinator is removed — no terrain query needed since the user now explicitly sets the altitude.
  • Vehicle::guidedModeROI(coord, relativeAltitudeMeters) returns bool, sanitizes non-finite altitudes from the QML boundary, and remembers the last commanded altitude (roiRelativeAltitudeMeters property) so re-positioning the ROI via "Edit ROI Position" preserves it.
  • ROI command is sent via COMMAND_INT when the vehicle advertises MAV_PROTOCOL_CAPABILITY_COMMAND_INT (full lat/lon precision), falling back to COMMAND_LONG otherwise.

Tests

  • GuidedModeROITest / GuidedModeROIAPMTest: unit tests verifying frame + altitude conversion per firmware and last-altitude tracking.
  • FlyViewROIUITest / FlyViewROIAPMUITest: end-to-end UI tests booting the full app with MockLink — map click, ROI drop panel, slider default/adjust, slide-to-confirm, and verification of the received MAV_CMD_DO_SET_ROI_LOCATION.
  • MockLink: advertises MAV_PROTOCOL_CAPABILITY_COMMAND_INT, accepts ROI COMMAND_INT, and skips the home-position delay during unit tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds user-selectable relative altitude to Fly View’s Click-to-ROI workflow, with firmware-specific MAVLink handling.

Changes:

  • Adds the ROI altitude slider and preserves altitude during repositioning.
  • Moves ROI command construction into firmware plugins.
  • Adds MockLink support and PX4/ArduPilot integration tests.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/Vehicle/GuidedModeROITest.h Declares ROI firmware tests.
test/Vehicle/GuidedModeROITest.cc Tests ROI altitude encoding.
test/Vehicle/CMakeLists.txt Registers vehicle tests.
test/QmlUITests/FlyViewROIUITest.h Declares ROI UI tests.
test/QmlUITests/FlyViewROIUITest.cc Exercises Click-to-ROI UI.
test/QmlUITests/CMakeLists.txt Registers ROI UI tests.
src/Vehicle/Vehicle.h Exposes ROI altitude state and API.
src/Vehicle/Vehicle.cc Validates, dispatches, and tracks ROI altitude.
src/Vehicle/TerrainQueryCoordinator.h Removes terrain-based ROI API.
src/Vehicle/TerrainQueryCoordinator.cc Removes terrain ROI implementation.
src/Toolbar/GimbalIndicator.qml Supplies altitude when pointing home.
src/FlyView/GuidedActionsController.qml Adds ROI altitude confirmation flow.
src/FlyView/GuidedActionConfirm.qml Exposes confirmation control to tests.
src/FlyView/FlyViewMap.qml Routes ROI creation through confirmation.
src/FlyView/FlyView.qml Exposes map and slider to tests.
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h Declares PX4 ROI override.
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc Converts PX4 ROI altitude to AMSL.
src/FirmwarePlugin/FirmwarePlugin.h Defines firmware-level ROI API.
src/FirmwarePlugin/FirmwarePlugin.cc Sends ROI via COMMAND_INT or fallback.
src/Comms/MockLink/MockLink.cc Simulates COMMAND_INT ROI support.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +204 to +205
} else {
vehicle->sendMavCommand(
Comment on lines +561 to +563
if (!homePosition.isValid() || qIsNaN(homePosition.altitude())) {
QGC::showAppMessage(tr("Unable to set ROI, home position altitude unknown."));
return false;
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.08333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.15%. Comparing base (f29efd3) to head (2298029).
⚠️ Report is 290 commits behind head on master.

Files with missing lines Patch % Lines
src/FirmwarePlugin/FirmwarePlugin.cc 50.00% 8 Missing and 2 partials ⚠️
src/Vehicle/Vehicle.cc 36.36% 4 Missing and 3 partials ⚠️
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc 37.50% 2 Missing and 3 partials ⚠️
src/Comms/MockLink/MockLink.cc 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14879      +/-   ##
==========================================
+ Coverage   25.47%   34.15%   +8.68%     
==========================================
  Files         769      940     +171     
  Lines       65912    85182   +19270     
  Branches    30495    39322    +8827     
==========================================
+ Hits        16788    29094   +12306     
+ Misses      37285    36692     -593     
- Partials    11839    19396    +7557     
Flag Coverage Δ
unittests 34.15% <52.08%> (+8.68%) ⬆️

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

Files with missing lines Coverage Δ
src/FirmwarePlugin/FirmwarePlugin.h 51.42% <ø> (+10.00%) ⬆️
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h 72.72% <ø> (+27.27%) ⬆️
src/Vehicle/TerrainQueryCoordinator.cc 20.28% <ø> (+11.44%) ⬆️
src/Vehicle/TerrainQueryCoordinator.h 0.00% <ø> (ø)
src/Vehicle/Vehicle.h 71.13% <100.00%> (+30.50%) ⬆️
src/Comms/MockLink/MockLink.cc 56.95% <87.50%> (+6.07%) ⬆️
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc 30.92% <37.50%> (-0.88%) ⬇️
src/Vehicle/Vehicle.cc 30.63% <36.36%> (+9.23%) ⬆️
src/FirmwarePlugin/FirmwarePlugin.cc 20.90% <50.00%> (+4.58%) ⬆️

... and 642 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

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: 2 passed, 75 failed, 7 skipped.

Test Results

linux-coverage-integration: 48 passed, 0 skipped
linux-coverage-unit: 136 passed, 0 skipped
linux-sanitizers-integration: 28 passed, 0 skipped
linux-sanitizers-unit: 136 passed, 0 skipped
Total: 348 passed, 0 skipped

Code Coverage

Coverage: 70.0%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 252.75 MB
QGroundControl-aarch64 176.60 MB
QGroundControl-installer-AMD64 137.96 MB
QGroundControl-installer-AMD64-ARM64 80.46 MB
QGroundControl-installer-ARM64 109.22 MB
QGroundControl-linux 84.58 MB
QGroundControl-mac 84.57 MB
QGroundControl-x86_64 188.82 MB
No baseline available for comparison

Updated: 2026-08-16 19:33:10 UTC • Commit: 2298029 • Triggered by: Windows

@DonLakeFlyer
DonLakeFlyer merged commit 80c91d9 into mavlink:master Aug 16, 2026
48 of 49 checks passed
@DonLakeFlyer
DonLakeFlyer deleted the roi-click-altitude branch August 16, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fly View: Click to ROI should support altitude

2 participants