Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unexpected repositions #22078

Merged
merged 3 commits into from
Sep 13, 2023
Merged

Avoid unexpected repositions #22078

merged 3 commits into from
Sep 13, 2023

Conversation

tstastny
Copy link
Contributor

Solved Problem

  1. Geofence reposition lifetime: when in RTL, the geofence reposition setpoint is ignored (ok, fine) - however, the reposition struct that holds that geofence position is stored until the next flight. If a manual control loss then engages a hold (during RTL delay time), the reposition setpoint is taken for the hold, which may be anywhere else other than the vehicle's current position.. which would be the desired hold position.
  2. External reposition commands without a requested mode switch (flag) are silently accepted and can cause unexpected positioning when hold is engaged.

Solution

  1. In the loiter activation methods, check the reposition setpoint's timestamp in addition to validity.
  2. Don't allow reposition commands without a requested mode switch.

Changelog Entry

For release notes:

Bugfix: Don't allow external reposition commands without a mode switch, and ensure old reposition commands are not erroneously set.

Alternatives

Real solution is not sharing the reposition struct between multiple modes, and not reusing loiter mode for goto and hold.

Test coverage

  • used libmav to send a reposition command without the modeswitch bit.. it rejects now
  • test case:
    • unplug manual control
    • let the multicopter rtl with geo fence boundary set near home
    • geo fence sets reposition struct somewhere along the path towards home (but rtl ignores)
    • vehicle lands, disarms
    • arm and takeoff again in manual
    • unplug manual control
    • rtl ensues
    • the rtl hold delay before returning to home is correctly set to the vehicle's current position (not the previously set reposition struct from last flight)

guards against left over reposition commands (potentially set via geofence) from previous flights
avoids erroneous (unexpected) position setpoints when switching into hold from another mode
…ished

todo: need to consolidate the command ack strategy in this function
@tstastny tstastny added the bug label Sep 13, 2023
@tstastny tstastny requested a review from dagar September 13, 2023 17:32
@tstastny tstastny self-assigned this Sep 13, 2023
@dagar dagar merged commit a1cd4fd into main Sep 13, 2023
88 checks passed
@dagar dagar deleted the avoid-unexpected-repositions branch September 13, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants