Repository navigation
Conversation
Global Size Summary (Total Flash delta in bytes)Built from 35a02bc rebased onto 89d9af5
|
| return false; | ||
| } | ||
|
|
||
| } else if (set_current_cmd(landing_start_index)) { |
There was a problem hiding this comment.
this is a slightly odd restructuring. I think it makes more sense to either:
- move the GCS_SEND_TEXT, "_flags.in_return_path = true" and "return true" lines to where they were (e.g. a couple of lines below the "resume")
OR
- change the line above to look like what's below so that it's an early return
} else if (!set_current_cmd(landing_start_index)) {
return false;
}
There was a problem hiding this comment.
Thanks, done with your option 2. Both paths now return early on failure and share the restart if the mission had stopped.
Previous review (2026-11-09)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The closest-point rejoin works in the PR's own tests, but on a leg into a landing the interpolated rejoin altitude can take a Copter down to near ground level well before the landing point, so this needs a change before merge. Blocking
Should fix
|
|
Blocking, rejoin altitude: Fixed. Legs ending in a landing, or with alt 0 at either end, now rejoin at the end waypoint as before. Rejoin survives mission changes: Fixed. resume() only uses the rejoin point while the stored leg start still matches the one it was calculated from. Edit during the rejoin: Fixed. restart_current_nav_cmd() restarts the rejoin point while the leg start is unchanged. Coincident nav points: Fixed. prev_index is now updated for zero-length legs too. |
|
Randy's Tests: Thanks for testing. The line from 0,0,0 to WP6 is a pymavlink display bug, not something this PR changes: its mission drawing starts a line at DO_RETURN_PATH_START even when the command has no location. |
c7a5deb to
cfd324c
Compare
Previous review (2026-11-14)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The closest-point rejoin is close to ready, with two mission-edit cases left to fix. Since the last review at c7a5deb, the landing/alt-0 altitude blocker is fixed (SITL now holds 50 m). A new upload no longer resumes the old rejoin point, a leg-end edit no longer sends the vehicle back to the leg start, and coincident waypoints no longer cause a backtrack. Should fix
Minor (1)
Not fully reviewed: CI for this head was still queued; Plane and QuadPlane were not flown; the leg-end-only edit and out-of-AUTO edits were checked in harnesses only. |
cfd324c to
56cb662
Compare
|
Addressed the second review. If the mission changes after the rejoin point is calculated, the vehicle now drops the rejoin and continues to the leg end, as master does. This covers edits to either end of the leg, both during the rejoin and while out of AUTO. AutoRTLReturnPathTrack now also tests a duplicate waypoint, a leg start edited during the rejoin, and a leg ending in a landing. |
Previous review (2026-11-16)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The closest-point rejoin looks ready apart from one narrow edge case and a missing test, neither blocking. Since the last review at cfd324c, both mission-edit cases are fixed: an edit to either end of the leg, in or out of AUTO, now continues to the leg end, and this was VERIFIED in SITL. Minor (2)
Not fully reviewed: QuadPlane was not flown, an in-AUTO edit that deletes the leg end was not flown, and one CI build job was still running. |
56cb662 to
d0991fe
Compare
|
AI-Review: |
Previous review (2026-11-16)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The closest-point rejoin is nearly ready, with one narrow, non-blocking mission-edit case left. Since the last review at 56cb662, both minor items are fixed: resume() now restarts the mission when the leg end is gone, and AutoRTLReturnPathTrack now covers that case (VERIFIED in SITL and by mutation). Should fix
Not fully reviewed: Plane and QuadPlane were not flown at this head, and CI was still running. |
| } | ||
| // get_next_cmd returns the target of a DO_JUMP rather than the command at scan_start | ||
| if (temp_cmd.index != scan_start) { | ||
| jumped_since_prev = true; |
There was a problem hiding this comment.
I think this can also happen if there is a do command.
There was a problem hiding this comment.
get_next_cmd returns a DO command at its own index, so it doesn't set this. Only a DO_JUMP does, including one whose repeats are used up, and that just keeps the old rejoin at the leg end. I've reworded the comment to say that.
| if (leg_proportion < 1 && straight_leg && !jumped_since_prev && | ||
| !is_landing_type_cmd(temp_cmd.id) && | ||
| !prev_loc.alt_is_zero() && !temp_cmd.content.location.alt_is_zero() && | ||
| (temp_cmd.content.location.get_alt_frame() == frame) && | ||
| prev_loc.get_alt_cm(frame, start_alt_cm) && | ||
| temp_cmd.content.location.get_alt_cm(frame, end_alt_cm)) { |
There was a problem hiding this comment.
This adds lots of conditions that mean we will no longer re-join where previously we would. I think the existing conditions should remain for setting the rejoin index. Then the new conditions need to only apply to the new rejoin location. Making sure to clear it each time so you can't end up with a rejoin location that does not match the index.
There was a problem hiding this comment.
The rejoin index is still set before these conditions, using the same closest-point distance as before, and rejoin_leg_start_index is cleared on every new closest leg, so the location can't mismatch the index. To make that clearer I've moved the conditions into calc_rejoin_loc(), which only decides whether the part way point can be used.
You were right that the second commit could fail where master succeeded, though. A return path whose only located commands were never flown to, such as a DO_LAND_START with a location, found no track. It now falls back to the closest of those commands as master did, and there's a subtest for it.
d0991fe to
35a02bc
Compare
|
AI-Review: |
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The closest-point rejoin is close to ready, with two narrow, non-blocking cases left. Since the last review at d0991fe, the in-AUTO leg-end deletion is fixed: Copter now stays in AUTO_RTL, and AutoRTLReturnPathTrack covers it (VERIFIED in SITL and by mutation). Should fix
Minor (1)
Not fully reviewed: QuadPlane was not flown at this head, and one CI build job was still running. |


Summary
Auto RTL with DO_RETURN_PATH_START now flies to the closest point on the return path and follows the leg from there, instead of flying straight to the waypoint at the end of the closest leg.
Classification & Testing (check all that apply and add your own)
The new Copter autotest AutoRTLReturnPathTrack starts 200 m to the side of a return path leg and checks the cross track error while the vehicle flies the leg. On master it fails with 145 m of error and with this PR it passes with 0.0 m. Its second stage puts a DO_SET_ROI_LOCATION on the return path and goes from 343 m of error to 0.2 m with the second commit. It also covers a repeated waypoint, a leg start moved during the rejoin, leaving AUTO during the rejoin, a mission without the leg end uploaded during the rejoin both in and out of AUTO, a leg ending in a landing, and a return path whose only located command is a DO_LAND_START. AutoRTL and Plane's MAV_CMD_DO_RETURN_PATH_START also pass.
Description
The rejoin search already found the closest point on each return path leg, but it only kept the index of the waypoint at the end of that leg. The vehicle then flew a straight line from wherever it was to that waypoint, often well off the planned track that DO_RETURN_PATH_START exists to keep it on. The closest point is now flown to as a virtual waypoint, using the same approach as the resume rewind's _resume_cmd. The mission then carries on from the leg's start index, so the rest of the leg runs as normal, including its DO commands, which master skipped. The rejoin index is chosen exactly as before; the new conditions only decide whether the part way point can also be used. Legs that end in a spline, arc or landing, have an altitude of 0 at either end, cross a DO_JUMP, or change altitude frame keep the old behaviour. If the mission is changed during the rejoin, or the vehicle leaves AUTO, it continues to the end of the leg instead, and if the leg end has been removed the mission restarts when AUTO is next entered, as on master. The GCS shows the leg's start waypoint as current until the rejoin point is reached.
The second commit stops located commands that are never flown to, such as DO_SET_ROI_LOCATION, from being treated as corners of the track. If the return path has no located nav commands, it still joins at the closest of those commands, as master does. This also matches the wiki, which already says the vehicle rejoins at the closest point.