Skip to content

Tracker: wait for first command in guided mode before doing anything - #23525

Draft
peterbarker wants to merge 2 commits into
ArduPilot:masterfrom
peterbarker:pr/tracker-guided-mode-wait-for-command
Draft

peterbarker wants to merge 2 commits into
ArduPilot:masterfrom
peterbarker:pr/tracker-guided-mode-wait-for-command

Conversation

@peterbarker

Copy link
Copy Markdown
Contributor

without this it's hard to go into guided mode without the vehicle moving to extremes. We reject various commands in the mavlink layer if you're not in guided...

@peterbarker

Copy link
Copy Markdown
Contributor Author

.... need to stop continuous yaw servos turning...

Guided mode steered to whatever attitude target it last held as soon as
it was entered - north and level after boot, otherwise the previous
guided target.  SET_ATTITUDE_TARGET is ignored outside guided mode, so
a GCS cannot supply a target before switching.

Set the target to the current attitude on entry so the tracker stays
put until it is told otherwise.  This also keeps continuous-rotation
and on/off servos actively driven, and keeps ATTITUDE_TARGET sensible.
Covers both the first entry after boot and re-entry after a previous
GUIDED target.  The tracker is parked in AUTO, which holds its bearing
when there is no vehicle position, so that the servo output and PID
state are continuous across the switch into GUIDED.
@peterbarker
peterbarker force-pushed the pr/tracker-guided-mode-wait-for-command branch from 0153ef0 to bb63c69 Compare October 19, 2026 20:52
@peterbarker
peterbarker marked this pull request as draft October 19, 2026 21:04
@github-actions

Copy link
Copy Markdown

Global Size Summary (Total Flash delta in bytes)

Built from bb63c69 rebased onto dc78bc5

Board Periph tracker blimp bootloader copter heli iofw plane rover sub
DrotekP3Pro _ _ _ * _ _ _ _ _ _
Durandal _ +84 * _ * * _ * * *
Hitec-Airspeed * _ _ _ _ _ _ _ _ _
KakuteF7 _ +80 * _ * * _ * * *
MambaH743v4 _ +84 * _ * * _ * * *
MatekF405-CAN _ _ _ * _ _ _ _ _ _
MatekF405 _ +80 * _ * * _ * * *
MatekH743-bdshot _ +84 * _ * * _ * * *
Pixhawk1-1M _ +84 * _ * * _ * * *
disco _ -20 * _ * * _ * * *
f103-GPS * _ _ _ _ _ _ _ _ _

@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head bb63c6984c.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/ardupilot/23525/1.html#pr23525

Thanks for picking this up again. Holding the current attitude on entry is a good fix for the jump to north and level.

There's one problem: ModeGuided::enter() doesn't reset the yaw and pitch PIDs (mode_guided.cpp:12). After SCAN, or AUTO with no vehicle, the controllers still hold the old error. On the first GUIDED loop the error drops to about zero, and the D term kicks the tracker about 5 deg before any command arrives. On blu6 your new GUIDEDHoldsAttitudeOnEntry test fails most runs at this head: 0/3 standalone, 2/7 in the full suite. With tracker.g.pidYaw2Srv.reset_filter() and tracker.g.pidPitch2Srv.reset_filter() added to enter() it passed every run, and the merge-base code still fails the test. Continuous-rotation servos get the same kick directly. The test comment saying AUTO holds the bearing (antennatracker.py:129) could also be reworded: AUTO isn't running the controller there, so the PID state isn't continuous across the switch.

Minor: the title still says "wait for first command". The new code holds the current attitude, so a retitle would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants