Skip to content

Copter: simple mode fix - #33947

Merged
IamPete1 merged 4 commits into
ArduPilot:masterfrom
rmackay9:copter-simple-mode-fix
Aug 11, 2026
Merged

Copter: simple mode fix#33947
IamPete1 merged 4 commits into
ArduPilot:masterfrom
rmackay9:copter-simple-mode-fix

Conversation

@rmackay9

@rmackay9 rmackay9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This resolves issue #33936

Replaces update_simple_mode with apply_simple_mode that takes roll and pitch input arguments. The rotation is now done within the various get-pilot-desired-xxx methods removing the need for each flight mode to call update_simple_mode and also removing the slightly ugly call to overwrite RC_Channels' control inputs from the flight code (e.g. no more calls to set_control_in)

This fix also introduces these changes which I think are OK:

  • Drift mode and Precision Landing's repositioning now support simple mode
  • Save trim also works in simple mode although the user needs to be careful not to change the vehicle's heading while landing and saving the trim.

This has been tested in SITL in Acro, AltHold, Drift, Loiter and Land modes to ensure both simple mode and super simple mode work as expected. Below are the modes I've tested:

  • Acro (both multicopters and heli)
  • Drift
  • Sport
  • Precision Landing repositioning
  • Save Trim

A new autotest borrowed from PR #33939 ensure the behaviour is correct so that this doesn't happen again

Below are some screen shots of testing save trim in SITL. During this test did this:

  • manually set AHRS_TRIM_X to 0.0872 (e.g. 5 deg)
  • armed and took off to 20-ish meters
  • engaged simple mode
  • rotated the vehicle's yaw to point south
  • because of the AHRS_TRIM_X the vehicle drifted quite quickly to its right
  • applied RC roll and pitch input until the vehicle came to a stop
  • manually landed and used the aux switch to save trim
  • checked the AHRS_TRIM_X, Y values to confirm they were close to zero (much improved from the initial 5deg)
sitl-testing

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

  • Checked by a human programmer
  • Non-functional change
  • No-binary change
  • Infrastructure change (e.g. unit tests, helper scripts)
  • Automated test(s) verify changes (e.g. unit test, autotest)
  • Tested manually, description below (e.g. SITL)
  • Tested on hardware
  • Logs attached
  • Logs available on request

Comment thread Tools/autotest/arducopter.py Outdated
@tridge

tridge commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Automated review note — AI-generated (Claude), cross-checked by an independent second model against the live diff. Please sanity-check before acting.

Reviewed at head d5e72a7554.

Verdict: REQUEST CHANGES

  • BUGArduCopter/mode.cpp:570Drift mode silently gains simple mode — re-raised, still unaddressed. This was raised on 2026-08-05 at head a5d54f6a50 and has neither been fixed nor answered. apply_simple_mode() is called unconditionally inside Mode::get_pilot_desired_lean_angles_rad(), and mode_drift.cpp routes through that helper. Re-checked at the current head by fetching mode_drift.cpp directly (6393 bytes, so the fetch genuinely succeeded): it still contains zero simple-mode references and still calls the helper, and the PR adds no opt-out. Drift's roll drives a coordinated turn and is inherently body-referenced, so rotating it by the simple-mode heading changes the mode materially. Either exclude Drift or state in the PR description that this is intended. The thread since then discusses the resemblance to Copter: move simple transform into mode class stop using set_control_in #18581 but nobody has engaged with this point.

  • ISSUEArduCopter/mode.cpp:577Implicit application in get_pilot_desired_velocity(). Softened after cross-check: the transform is implicit here too, but this is a design concern rather than a live regression — the callers of this helper already had simple mode. The old design had each mode opt in explicitly, which made the affected set reviewable; the new one makes it implicit.

  • NOTETools/autotest/arducopter.py:0The new autotest cannot catch the Drift case. It covers AltHold only, so it would not detect the regression above.

Full report: https://uav.tridgell.net/DevCallReviews/2026_08_11/devcall_pr_reviews.html

@IamPete1

IamPete1 commented Aug 6, 2026

Copy link
Copy Markdown
Member

This is surprisingly close to #18581. I think anything we can do to remove uses of the "control in" methods on RC is a good thing.

@rmackay9

rmackay9 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@IamPete1,

That is incredible. It's nearly identical!

rmackay9 and others added 4 commits August 10, 2026 10:22
Co-authored-by: Iampete1 <iampete@hotmail.co.uk>

Replaces update_simple_mode with apply_simple_mode function that takes roll and pitch input arguments.  The rotation is now done within the various get-pilot-desired-xxx methods removing the need for each flight mode to call update_simple_mode and also removing the slightly ugly call to overwrite RC_Channels' control inputs from the flight code (e.g. no more calls to set_control_in)
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>

@peterbarker peterbarker 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

I'm not particularly fussed if there are a few differences in e.g. drift mode and whatnot.

Such a good improvement.

@IamPete1
IamPete1 merged commit 327bd39 into ArduPilot:master Aug 11, 2026
86 of 87 checks passed
@rmackay9
rmackay9 deleted the copter-simple-mode-fix branch August 11, 2026 01:23
@Georacer Georacer moved this from Pending to 4.7.1-beta1 in 4.7 Backports Aug 11, 2026
@Georacer Georacer mentioned this pull request Aug 11, 2026
6 tasks
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4.7.1-beta1

Development

Successfully merging this pull request may close these issues.

7 participants