Skip to content

AP_Follow: remove auto sysid - #33937

Merged
rmackay9 merged 2 commits into
ArduPilot:masterfrom
lthall:20260804_Follow_Remove_Auto_Sysid
Aug 11, 2026
Merged

AP_Follow: remove auto sysid#33937
rmackay9 merged 2 commits into
ArduPilot:masterfrom
lthall:20260804_Follow_Remove_Auto_Sysid

Conversation

@lthall

@lthall lthall commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the behaviour where FOLL_SYSID = 0 causes AP_Follow to latch onto the
first vehicle it hears from. Zero now means no target has been selected.

Classification & Testing (check all that apply and add your own)

  • Checked by a human programmer
  • Tested manually, description below (e.g. SITL)

SITL Copter and Plane. ModeFollow_with_FOLLOW_TARGET and ModeFollow both pass;
the latter is flaky on my machine for unrelated reasons (harness timeout waiting to
receive GLOBAL_POSITION_INT from the vehicle). Both commits build standalone. Not
flown on hardware.

Description

FOLL_SYSID = 0 meant "follow the first vehicle we hear from": AP_Follow wrote the
first sender's system id into the parameter, and cleared it back to zero if that
vehicle went quiet for ten seconds. So the library mutated a user facing parameter
on its own, and the target was chosen by message arrival order rather than by
configuration. MAV_CMD_DO_FOLLOW already rejects a target id of zero, so this
makes the parameter agree with the command interface.

Zero now means no target is selected: no target message is accepted and the library
never writes FOLL_SYSID. The second commit is a rename only, since
AP_FOLLOW_SYSID_TIMEOUT_MS no longer has anything to do with the system id.

Behaviour change. Anyone relying on the default of zero to follow a single lead
vehicle must now set FOLL_SYSID. In Copter, FOLLOW mode holds position instead.
Worth a release note.

lthall added 2 commits August 4, 2026 21:02
A FOLL_SYSID of zero meant "follow the first vehicle we hear from". The
library wrote that vehicle's system id into the FOLL_SYSID parameter, and
cleared the parameter back to zero if the vehicle went quiet for ten
seconds.

This made the library mutate a user facing parameter on its own, and left
the choice of target to message arrival order rather than to
configuration. With more than one vehicle in range the target was
whichever one happened to be heard first.

A FOLL_SYSID of zero now means that no target has been selected. No
target message is accepted and the parameter is never written by the
library. Following starts once the user sets a system id.
The constant no longer has anything to do with the target system id. Its
only remaining job is to discard a stale target estimate. Value and
behaviour are unchanged.
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Aug 4, 2026
@timtuxworth

timtuxworth commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I like this, I never liked the magic behavior, so I never used it. If anyone really wants it they can write it in Lua.

Also - the arming checks lua already (configurable) raises an warning or error if follow is enabled but FOLL_SYSID is not set to a value > 0.

@timtuxworth timtuxworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rmackay9
rmackay9 merged commit 50d88be into ArduPilot:master Aug 11, 2026
99 checks passed
@rmackay9 rmackay9 changed the title 20260804 follow remove auto sysid AP_Follow: remove auto sysid Aug 11, 2026
@lthall
lthall deleted the 20260804_Follow_Remove_Auto_Sysid branch August 11, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WikiNeeded needs wiki update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants