Repository navigation
Rover: add support for MAV_CMD_NAV_ARC_WAYPOINT - #35099
robot-to-society wants to merge 10 commits into
Conversation
Global Size Summary (Total Flash delta in bytes)Built from ef9687b rebased onto 89d9af5
|
Previous review (2026-11-11)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head This adds Rover arc waypoints with good test coverage, but a resumed arc can drive an unplanned tight loop, and the new WPArcsMission test fails in CI. Blocking
Should fix
Minor (1)
|
1091326 to
749fdd1
Compare
Document the arc waypoint mission command on the shared mission command page: a new MAV_CMD_NAV_ARC_WAYPOINT section (Copter and Rover) with the parameter table, Rover notes on the arc radius, TURN_RADIUS arming check and obstacle avoidance, and entries in the Copter and Rover supported-command lists. Rover support for this command is added by ArduPilot/ardupilot#35099. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Document the arc waypoint mission command on the shared mission command page: a new MAV_CMD_NAV_ARC_WAYPOINT section (Copter and Rover) with the parameter table, Rover notes on the arc radius, TURN_RADIUS arming check and obstacle avoidance, and entries in the Copter and Rover supported-command lists. Rover support for this command is added by ArduPilot/ardupilot#35099. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Previous review (2026-11-15)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Since the last review the pre-arm arc scan follows execution order and an interrupted arc resumes with its remaining angle, but the new scan breaks H7 builds and the PR's own WPArcsMission test still fails. Reviewed at 1091326. The live head 749fdd1 is the same commits rebased onto master, with only a guard rename. Blocking
Should fix
Minor (3)
Head moved during review: observed |
The crosstrack error produced by calc_crosstrack_error() is positive when the vehicle is on the path's left side, but three comments said the opposite. Fix the comments to match the calculation; no functional change. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Pass the lateral acceleration limit (derived from ATC_TURN_MAX_G) to SCurve::calculate_track() as the corner acceleration, instead of the longitudinal (forward-back) acceleration limit. SCurve consumes this limit only for arc segments, as the centripetal limit that caps the arc speed at sqrt(lat_accel * radius), so straight legs are unaffected. Arc segments need it so their speed is governed by the lateral acceleration the vehicle can sustain rather than by the longitudinal limit. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Rover's SCurve trajectory generator already supports arc segments, but AR_WPNav always passed it an arc angle of zero, so Rover could not execute MAV_CMD_NAV_ARC_WAYPOINT. Thread the mission arc angle through set_desired_location() to both calculate_track() calls, make the crosstrack error relative to the arc path (as requested on ArduPilot#32295), and use the arc's entry and exit tangents for pivot-turn decisions. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Handle the command in start_command() and verify_command() via the existing waypoint path, passing the item's signed arc angle (and the next item's, if it is also an arc) down to AR_WPNav. For this command p1 holds the arc angle in degrees, not a loiter time, so the loiter is forced off; Rover reads the angle at item start, so a preceding WP-delay or NAV_DELAY item cannot lose it. Co-Authored-By: Muse Spark <noreply@anthropic.com>
A ground-steering vehicle cannot track an arc whose radius is smaller than TURN_RADIUS, so fail pre-arm if the stored mission contains such an arc. Each arc's radius is computed from the chord to the previous destination item, found by a linear scan of the stored mission. Skid-steering vehicles are exempt, as TURN_RADIUS does not apply to them. The check runs under the MISSION arming-check category, so ARMING_SKIPCHK can disable it like other mission checks, and the failure message names the offending mission item. The scan stops at the first DO_JUMP or DO_JUMP_TAG: a jump changes the execution order, so an arc stored after a jump cannot be measured reliably from the item stored before it, and such arcs are not checked. Following the full execution order (mirroring AP_Mission's jump handling) was considered but rejected: it needs far more code and stack than a pre-arm check can justify on ChibiOS boards. Co-Authored-By: Muse Spark <noreply@anthropic.com>
WPArcs covers the core geometry: 90 degree CW/CCW arcs, a 180 degree headland turn and a 270 degree arc, each checked for radial deviation from the theoretical circle and for the angle actually swept around its centre in the commanded direction. It also checks the arc-relative crosstrack error sign for both turn directions, and the ATC_TURN_MAX_G speed limit on a tight arc with parameters chosen so that a longitudinal-acceleration limit would exceed the bound. WPArcsMission covers arcs after WP-delay and NAV_DELAY items (including an assertion that the arc item completes promptly, guarding against the arc angle being misread as a loiter time), chained and directly consecutive arcs, a reverse arc (asserting the vehicle really travels backwards), resume-after-HOLD re-planning, and DO_JUMP both back into an arc and landing directly on an arc item. WPArcsPreArm covers the TURN_RADIUS pre-arm check, and WPArcsSkid covers skid steering: the lateral speed limit, no pivot on a tangent-aligned entry (including the transition into the item), and a required pivot onto a misaligned entry tangent. Co-Authored-By: Muse Spark <noreply@anthropic.com>
… arc Add get_origin() and get_remaining_arc_angle_rad(), which returns the part of an arc from origin to dest that remains to be driven from the vehicle's stopping point, measured about the arc's centre. The full angle is returned when the remaining angle cannot be determined: the arc spans more than a whole turn, its geometry is invalid, no stopping point is available, or the stopping point is more than 2 m off the arc's circle (the vehicle is no longer on the interrupted arc). Zero is returned when the stopping point is past the destination along the arc. A stopping point in the sector of the circle the arc does not cover is attributed to the closer of the origin and the destination. Co-Authored-By: Muse Spark <noreply@anthropic.com>
An arc waypoint command that is started again after an interruption (e.g. leaving and re-entering AUTO mid-arc) was re-planned with its full angle from the vehicle's position, which produced a much smaller circle and a large excursion from the original path. ModeAuto now remembers an arc execution that has started but not completed (command index, origin, destination and angle). When the same command is started again, AR_WPNav's get_remaining_arc_angle_rad() supplies the angle remaining from the stopping point, so the vehicle rejoins the original circle. A fresh start (signalled by the helper returning the full angle) replaces the record. The record is cleared when the arc completes, when a different navigation command starts (do and condition commands run alongside the navigation command and leave it untouched), and on entering AUTO unless the mission resumes with the arc still current. Note that explicitly re-selecting the arc (MISSION_SET_CURRENT, stopped or running, including after a mission reset) is indistinguishable from a resume and also applies the remaining angle; it flies the original circle to the same destination. Co-Authored-By: Muse Spark <noreply@anthropic.com>
WPArcsMission gains subtests for interrupting an arc and resuming it: mid-arc, near the exit and at the start, with a do command and with a condition command active at the interruption, after a MIS_RESTART (which must fly the full angle), and re-selecting a completed arc (which must start fresh, checked from a point on the original circle). Resumed arcs are checked against the original circle with a limit that accounts for the re-planned circle being fitted through the stopping point. Also fix two WPArcsMission checks that ran at the edge of their limits: the waypoint-delay subtest now approaches along the arc's entry tangent and uses a single 0.75 m limit, and the NAV_DELAY subtest measures deviation against the circle planned from the actual arc start (after a delay the arc is re-planned from the stopping point) with a 2.0 m limit and a 0.75 m converged limit. check_arc_deviation gains a converged_limit_m parameter for this. Co-Authored-By: Muse Spark <noreply@anthropic.com>
Document the arc waypoint mission command on the shared mission command page: a new MAV_CMD_NAV_ARC_WAYPOINT section (Copter and Rover) with the parameter table, Rover notes on the arc radius, TURN_RADIUS arming check and obstacle avoidance, and entries in the Copter and Rover supported-command lists. Rover support for this command is added by ArduPilot/ardupilot#35099. Co-Authored-By: Muse Spark <noreply@anthropic.com>
749fdd1 to
c203f5f
Compare
Previous review (2026-11-15)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Still REQUEST CHANGES at c203f5f: the PR's own WPArcsMission still fails in CI. Since the last review the H7 stack-frame build break and the lap-mission false reject are fixed, now that the pre-arm scan stops at the first DO_JUMP. Blocking
Should fix
Minor (5)
The three other sitltest-rover failures (Offboard, CameraMission, MAVProxy_SetModeUsingSwitch) look like connection errors and were not attributed to this PR. |
Re-timing the current S-Curve track after a speed limit reduction leaves the target far behind the vehicle on an arc leg, and the vehicle cuts across the inside of the arc trying to reach it. Re-plan the leg from the vehicle's current location with the angle that remains instead, falling back to re-timing when the remaining angle cannot be determined or too little of the arc is left. get_remaining_arc_angle_rad() is refactored to share its calculation with the new re-plan path. Co-Authored-By: Muse Spark <noreply@anthropic.com>
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Still REQUEST CHANGES at ef9687b. The PR's sitltest-rover failures are caused by the new pre-arm scan, and multi-turn arcs still fail on a speed drop. Since c203f5f the WPArcsMission low-speed arc failure is fixed: the new commit re-plans the arc when its speed drops, and WPArcsMission and DO_CHANGE_SPEED-before-arc missions now complete. Blocking
Should fix
Minor (6)
The previous review's note that the other sitltest-rover failures were unrelated connection errors was wrong: they are blocker 1. |
Summary
Adds Rover support for
MAV_CMD_NAV_ARC_WAYPOINT(ID 36), which Copteralready supports: in Auto mode the vehicle follows a circular arc with the
commanded signed angle (p1, degrees) to the item's location instead of a
straight line. Useful for defined-radius turns, e.g. headland turns in
mowing.
Fixes #32295
Classification & Testing (check all that apply and add your own)
Description
AR_WPNav::set_desired_location()(new defaultedarc_rad/next_arc_radparameters, mirroring AC_WPNav) into SCurve, whichalready supports arc segments. Other callers (Guided, RTL, SmartRTL)
are unchanged. For this command p1 is the angle, not a loiter time,
so the waypoint loiter is disabled.
Rover: add Arc waypoint support #32295. Pivot turns and the next-waypoint corner angle use the arc's
entry/exit tangents.
passed to SCurve as
accel_c. No new parameters. SCurve readsaccel_conly for arc segments, so straight-line behaviour isunchanged.
arc's radius is smaller than TURN_RADIUS. Skid steering is exempt;
the check is in the mission category and can be skipped with
ARMING_SKIPCHK.
formulas as
SCurve::calculate_track()) because the crosstrack andpivot logic need the geometry of the current and next legs, which
SCurve does not expose.
Limitations
in Rover: add Arc waypoint support #32295): if OA intervenes, the rest of the leg goes straight.
full angle, same as Copter.
circle plus 40°; an exact multiple of 360° = a straight line).
tack logic steers by the bearing to the destination); the mission
still completes. Other arcs track normally.
Guided.
Testing
SITL, re-run after rebasing onto current master. All PASSED:
test.Rover.WPArcs(±90°/180°/270° arcs tracked within0.5 m of the theoretical circle, delay entries, chained arcs,
crosstrack sign in both directions, speed cap, reverse arc, pivot
entry),
WPArcsMission(resume, DO_JUMP into an arc),WPArcsPreArm(tight arc refused; exemptions work),
WPArcsSkid.accel_ccommit reverted, WPArcs andWPArcsSkid fail (4.23 / 3.54 m/s, over the cap); with it they pass
(3.19 / 2.81 m/s).
test.Rover.DriveMission,test.Rover.SkidSteer.sailboat and sailboat-motor SITL models: all completed, no failsafes
(sailboat 90° arc within 0.6 m; see Limitations for the upwind case).
CubeOrange builds clean;
check_branch_conventions.pypassed.AI assistance. This contribution was developed with AI assistance.
I have reviewed the changes and take full responsibility for them; the
commits carry
Co-Authored-Bytrailers accordingly.