feat(FlyView): add altitude support for Click to ROI - #14879
Conversation
3b9a55c to
aff2b9d
Compare
There was a problem hiding this comment.
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.
| } else { | ||
| vehicle->sendMavCommand( |
| if (!homePosition.isValid() || qIsNaN(homePosition.altitude())) { | ||
| QGC::showAppMessage(tr("Unable to set ROI, home position altitude unknown.")); | ||
| return false; |
aff2b9d to
2298029
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 642 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 2 passed, 75 failed, 7 skipped. Test Resultslinux-coverage-integration: 48 passed, 0 skipped Code CoverageCoverage: 70.0% No baseline available for comparison Artifact Sizes
Updated: 2026-08-16 19:33:10 UTC • Commit: 2298029 • Triggered by: Windows |
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
MAV_FRAME_GLOBAL_RELATIVE_ALT(firmware honors the frame).home.altitude() + relative) and sent inMAV_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.FirmwarePlugin::guidedModeROI(base = ArduPilot/spec path, PX4 override does the AMSL conversion). The old PX4 terrain-query ROI path inTerrainQueryCoordinatoris 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 (roiRelativeAltitudeMetersproperty) so re-positioning the ROI via "Edit ROI Position" preserves it.COMMAND_INTwhen the vehicle advertisesMAV_PROTOCOL_CAPABILITY_COMMAND_INT(full lat/lon precision), falling back toCOMMAND_LONGotherwise.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 receivedMAV_CMD_DO_SET_ROI_LOCATION.MAV_PROTOCOL_CAPABILITY_COMMAND_INT, accepts ROICOMMAND_INT, and skips the home-position delay during unit tests.