Add "Restart Mission" checkbox to "Set Current Waypoint" action#14345
Add "Restart Mission" checkbox to "Set Current Waypoint" action#14345jnomikos wants to merge 1 commit intomavlink:mastermavlink/qgroundcontrol:masterfrom jnomikos:dev-restart-missionjnomikos/qgroundcontrol:dev-restart-missionCopy head branch name to clipboard
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new “Restart Mission” guided action to let operators reset mission execution back to the first waypoint while in flight (including when the mission is paused), aligning with the UX needs discussed in #13927/#13934.
Changes:
- Extends
Vehicle::setCurrentMissionSequenceto optionally request a mission restart/reset viaMAV_CMD_DO_SET_MISSION_CURRENTparam2. - Adds a new guided action (
Restart Mission) with confirmation text and wires it into the Fly View “Additional Actions” list. - Registers a new FlyView resource (
restart-mission.svg) for the feature’s UI assets.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Vehicle/Vehicle.h | Updates the invokable API to accept an optional restart/reset flag. |
| src/Vehicle/Vehicle.cc | Sends the restart/reset flag as an extra MAVLink command parameter. |
| src/FlyView/GuidedActionsController.qml | Introduces the new guided action (visibility, confirmation, execution). |
| src/FlyView/FlyViewAdditionalActionsList.qml | Exposes “Restart Mission” in the additional actions panel model. |
| src/FlyView/CMakeLists.txt | Adds an SVG resource entry intended for the new action. |
| property bool showLand: _guidedActionsEnabled && _activeVehicle.supports.guidedMode && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode | ||
| property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying && _canStartMission | ||
| property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < _visualItemsCount - 1) | ||
| property bool showRestartMission: _guidedActionsEnabled && _missionAvailable && _vehicleArmed && _vehicleFlying && !_fixedWingOnApproach |
There was a problem hiding this comment.
@copilot actionRestartMission basically does what actionSetWaypoint does, except it has the restart flag set to true. If we don't block actionSetWaypoint during RTL or Land, I don't see the need to hide actionRestartMission.
496585a to
6af2d53
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (30.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #14345 +/- ##
==========================================
+ Coverage 25.47% 32.42% +6.95%
==========================================
Files 769 781 +12
Lines 65912 67227 +1315
Branches 30495 31147 +652
==========================================
+ Hits 16788 21796 +5008
+ Misses 37285 30732 -6553
- Partials 11839 14699 +2860
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 469 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: 0 passed, 0 failed, 0 skipped. Test Resultslinux-coverage-integration: 35 passed, 0 skipped Code CoverageCoverage: 68.9% No baseline available for comparison Artifact Sizes
Updated: 2026-07-24 21:37:19 UTC • Commit: f2f0630 • Triggered by: Android |
|
I don't see how this works. You set the current sequence number to 1. But what if that is pointing to a takeoff item? To me this just requires manual control from the user. Manually pick the right point they want to restart from by clicking on the item. And start the mission. All this special stuff just seems doomed to failure. |
Good point. My current implementation is too error prone. I'll look into making it more similar to how the "set current waypoint" is done |
06b3084 to
b7b3f53
Compare
|
@DonLakeFlyer I updated the implementation so that the "Restart Mission" is a checkbox option with "Set Current Waypoint" which only shows if the vehicle firmware supports I also updated the PR description above |
|
I continue to not be thrilled with all of this. It all seems like an error prone hack which should be handled by the firmware side. Why isn't this a fix in the firmware so you can move the last waypoint? Isn't this working around a vehicle side problem? |
I initially thought this was a vehicle-side issue as well, which is why my first implementation attempted to work around it. However, I did more research, and now I don't see it as a hack or workaround for a vehicle-side bug. My understanding is that this is the intended use case of MAV_CMD_DO_SET_MISSION_CURRENT. ArduPilot sets the mission state to MISSION_STATE_COMPLETE if you have reached the last waypoint. ArduPilot supports the newer MAV_CMD_DO_SET_MISSION_CURRENT command which explicitly has a "Reset Mission" flag which is intended to be set to true if you wish to go to a previous waypoint but the mission state is complete. PX4 does not currently support MAV_CMD_DO_SET_MISSION_CURRENT and uses MISSION_SET_CURRENT instead which does not have a "Reset Mission" flag and is less explicit about mission resetting. From the QGC perspective, the checkbox is simply exposing an existing capability provided by the firmware and MAVLink protocol rather than implementing custom restart behavior. That said, I am open to other ideas and hearing your thoughts on it. We don't have to expose a checkbox in the UI for this. |
|
Ok, I understand now. I'll think some more about this when I get back in town. I'll be gone till start of July. |
|
@jnomikos Did you test multi-rotor and fixed wing? ardupilot FW differs in a bunch of it's mission code |
|
Also note that even when restart mission is false ardupilot will reset jumps counters if the mission is complete when you set the new waypoint |
|
After staring at this I'm still not super thrilled with the extra UI complexity but there doesn't seem to be any other decent solution. Thanks for this @jnomikos. If you've also tested with FW then I'll merge. |
I have not tested with fixed wing yet. I'll do that |
I'm on the same page, and I agree it makes the UI needlessly complex. The only other solution I can think of is automatically setting "restart mission" when changing current waypoint when you particularly have reached the last waypoint of a mission. But, the drawback of that is it makes the behavior of "set current waypoint" more implicit. I mentioned that idea in the original PR here: #13934 (comment). But, now that you mention that the jump counters are always reset if you are on the last waypoint (I was not aware of that), I think the implicit solution may be more favorable, as it would not affect the user interface at all. @rubenp02 do you have any insights? |
I tried coding that. And ran into the fact that it means that whenever you change the waypoint the mission automatically restarts. Which isn't always expected. I tried a pile of different options and what you have was the worst of multiple evils. |
Oh yeah good point, I forgot about that |
|
Sorry, I may be a bit out of the loop on this. What would be wrong about a simple "Restart Mission" guided action? Given that this isn't strictly related to changing target waypoint. Yes, it's sometimes handy when doing that, but it can always also be done quite quickly right afterwards with an action, no? And if conditional mission logic is a concern, you can perhaps achieve what you want by doing the reset before changing the target waypoint, instead. To me at least, this is enough of an advanced feature that I don't think it warrants any additional UI complexity or compromises in UX: It can afford to be slightly less automatic as long as the functionality itself is accessible. Again, sorry if I'm missing anything obvious, please fill me in if that's the case. |
When vehicle firmware supports restarting mission, set current waypoint action now has a checkbox for "Restart Mission"
b7b3f53 to
f2f0630
Compare
| if (_activeVehicle.supports.restartMission) { | ||
| confirmDialog.optionText = qsTr("Restart Mission") | ||
| confirmDialog.optionChecked = false | ||
| } |
@DonLakeFlyer You're right that fixed wing behaves differently. When texting with fixed wing SITL, the vehicle automatically goes into RTL mode and circles around the home position if you plot a mission without a landing sequence. When in this RTL mode, setting current waypoint with the "restart mission" checkbox does not make the vehicle automatically start flying the mission again. Instead you have to pause the mission first and then continue mission. So, in short, with this current solution, due to differences in behavior on fixed wing, the end result is still pretty confusing. I am considering if there are any UI state updates to the guided actions controller we could make that would solve the issue on the fixed wing side without regressing copter. fixedwingtest_muted.mp4 |
It was an option that was considered, and the initial direction I took this PR before modifying it. Originally, my implementation was a "Restart Mission" guided action. However, we ended up going the direction of manually choosing the point to restart to. One of the main reasons, if I recall correctly, was because the first waypoint of a mission is not always at the same index, depending on firmware. Honestly, I wish I could just go in and change the MAVLink spec on this. 😢 |
|
This is all getting ridiculously complicated. My opinion:
|
At this point, I agree with you and I think closing this PR is probably the best move. I am a bit uncertain on next steps. The problem is that ArduPilot already shipped firmware using the new message with this behavior. I am thinking of adding in issue in MAVLink about this, and discussing ways we can improve it in the future. |

Description
On firmware which supports
MAV_CMD_DO_SET_MISSION_CURRENT(ArduPilot), "Set Current Waypoint" command now has a checkbox to optionally "Restart Mission".To summarize, when "Restart Mission" is checked,
MAV_CMD_DO_SET_MISSION_CURRENTwill be sent with the restart param set to true which will restart the mission and any jump counters. This is useful for two cases:User flew a mission to the end which does not contain a RTL and wants to restart their mission from a previous waypoint.
User has a mission with jump counters and wishes to go to a previous waypoint and reset those counters too.
This solves the issue listed here: #13927 and was discussed in this closed PR here: #13934
Type of Change
Testing
Platforms Tested
Flight Stacks Tested
Screenshots
2026-05-08.14-03-59.mp4
2026-05-24.14-37-28.mp4
Checklist
Related Issues
#13927
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).