Repository navigation
Conversation
7eecb20 to
52365b5
Compare
Global Size Summary (Total Flash delta in bytes)Built from 198f6d2 rebased onto 2a54162
|
52365b5 to
a8186c0
Compare
05ccfe7 to
b36a4f8
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
Fixes Copter mission behavior so ARC_WAYPOINT legs are correctly flown as arcs when not preloaded, and mission lookahead behaves correctly after DO_JUMP/DO_JUMP_TAG when the jump target is a DO command.
Changes:
- Update mission lookahead to continue scanning from the returned command index (DO_JUMP-safe), and add deterministic loop bounds.
- Track the last completed “arc-start-capable” command in Copter Auto mode and use it to decide whether an arc can start curved vs. straight.
- Add two Copter autotests covering arc start behavior and DO_JUMP-to-DO-command lookahead.
| File | Description |
|---|---|
| libraries/AP_Mission/AP_Mission.cpp | Makes get_next_nav_cmd() advance from the returned cmd’s index to handle DO_JUMP targets correctly and prevents DO-only infinite lookahead loops. |
| ArduCopter/mode_auto.cpp | Adds arc start tracking and uses it to decide whether ARC_WAYPOINT should apply curvature when not preloaded. |
| ArduCopter/mode.h | Updates wp_start() signature and adds arc-start helper declarations/state. |
| Tools/autotest/arducopter.py | Adds regression tests for arc start waypoint behavior and DO_JUMP-to-DO-command lookahead correctness. |
Review effort: Lite
b36a4f8 to
198f6d2
Compare
Previous review (2026-11-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Reviewed at b36a4f8. The PR has since moved to 198f6d2, which this review does not cover. The arc and jump-lookahead fixes test well in SITL, but the new LOITER_TO_ALT origin has an altitude-frame bug. Blocking
Notes
Copilot's index-0 concern is not a bug, since row 0 is home and is never flown. Not fully reviewed: the new head 198f6d2, the flight response to the altitude step, other-vehicle callers of Head moved during review: observed |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
nav_delay_has_defined_startis a newly added memberboolbut is not initialized here. If it… · Newget_next_nav_cmd(..., followed_jump)now hard-fails if more than 8 unique DO_JUMPs are… · Newget_next_nav_cmd(..., followed_jump)now hard-fails if more than 8 unique DO_JUMPs are… · New_flags.nav_cmd_in_orderis set beforestart_command()succeeds. Ifstart_command()returns… · New
1 resolved since last review
Review effort: Lite
| // Delay the next navigation command | ||
| uint32_t nav_delay_time_max_ms; // used for delaying the navigation commands (eg land,takeoff etc.) | ||
| uint32_t nav_delay_time_start_ms; | ||
| bool nav_delay_has_defined_start; // true if the vehicle started the delay at a fixed point it reached in order |
| uint16_t jumps_followed[8]; | ||
| uint8_t num_jumps_followed = 0; |
| if (num_jumps_followed >= ARRAY_SIZE(jumps_followed)) { | ||
| return false; | ||
| } | ||
| jumps_followed[num_jumps_followed++] = jump_index; |
| _nav_cmd = cmd; | ||
| _flags.nav_cmd_in_order = in_order; | ||
| if (start_command(_nav_cmd)) { | ||
| _flags.nav_cmd_loaded = true; | ||
| if (_jump_tag.age > 0 && _jump_tag.age < UINT16_MAX) { | ||
| // we're tracking a tag so increase it's age on every new NAV item | ||
| _jump_tag.age++; | ||
| } | ||
| } else { | ||
| // the vehicle skipped this command, so the next one does not follow on from the previous one | ||
| in_order = false; |
Previous review (2026-11-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The PR still needs changes: the new jump lookahead can preload the wrong waypoint in some nested DO_JUMP missions. Blocking
Should fix
Notes
Copilot's uninitialised |
|
PR #35049 fixes up some related bugs in AP_Mission |
198f6d2 to
3520b80
Compare
|
Rebased on master and reworked to the agreed rule: if a waypoint is defined as an arc, it is flown as an arc, however the mission reaches it. A jump, mission start, resume, set current, or an arc after LOITER_TURNS now curves from the current location in the same way a normal waypoint starts, instead of being flown straight. The "defined start" logic and the in-order flag in AP_Mission are gone. The AP_Mission lookahead commit is dropped because master now has "AP_Mission: follow jumps when looking ahead for the next nav command", which fixes the same problem, and JumpNextNavCmd covers it. That leaves one Copter commit, plus WPArcFlownAsArc, which replaces WPArcStartWaypoint and DoJumpToDoCommand. |
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No blockers remain: the PR is now a small Copter change that flies every arc waypoint as an arc, and its new test passes in SITL and fails on master. Notes
Not fully reviewed: CI (still pending), the other arc and jump autotests at this head, terrain-frame arcs and arcs over 180 degrees reached without a preload (code reading only). |


Summary
Fixes ARC_WAYPOINTs being flown as straight lines when the previous leg did not preload them.
Classification & Testing (check all that apply and add your own)
WPArcFlownAsArc fails without the Copter commit (8 of its 10 arcs are flown straight) and passes with it. WPArcs, WPArcs2, JumpNextNavCmd, SplineLastWaypoint and SplineNavDelay still pass.
Description
An arc waypoint is now always flown as an arc, the same way a spline waypoint is always flown as a spline. The firmware no longer overrides the waypoint type the user commanded. Previously an arc only curved when the previous leg preloaded it. As a result, arcs after a takeoff, a hold, a delay, a loiter or LOITER_TURNS, or set current, were flown straight to their end.
do_nav_wp() now passes the arc angle to the waypoint controller. The leg starts from the vehicle's current location in the same way as a normal waypoint: from the previous destination if it was reached, otherwise from the stopping point. That covers arcs reached by a DO_JUMP, mission start, resume or set current. The test also checks that an arc reached by a DO_JUMP still curves.