Skip to content

Plane: set tailsitter enable before creating the VTOL AHRS view - #34643

Open
Abtektas wants to merge 2 commits into
ArduPilot:masterfrom
Abtektas:fix/tailsitter-first-boot
Open

Abtektas wants to merge 2 commits into
ArduPilot:masterfrom
Abtektas:fix/tailsitter-first-boot

Conversation

@Abtektas

@Abtektas Abtektas commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #34001. A tailsitter that is enabled through the legacy parameters (Q_FRAME_CLASS or Q_TAILSIT_MOTMX, with Q_TAILSIT_ENABLE not set) could not take off in any VTOL mode on its first boot. Q_TAILSIT_ENABLE is now set before the VTOL AHRS view is created.

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

SITL on macOS (arm64, Apple clang 21), --model quadplane-copter_tailsitter with the stock default parameter files, base 9dd2e0f.

A pymavlink script that boots SITL, switches to GUIDED, arms and sends MAV_CMD_NAV_TAKEOFF to 60m, then watches 30s of simulated time:

first boot (-w) second boot (same parameters)
master stays on the ground (max -0.1m), motors 1648/1688/1150/1949 climbs to 55m
this PR climbs to 55m climbs to 55m

The motor outputs on master match the ones in the issue.

Autotests (Tools/autotest/autotest.py --no-configure test.QuadPlane.<name>):

  • CopterTailsitter without its reboot_sitl() (as in this PR): fails on master with Failed to attain Altitude want 62.0, reached -0.103, passes with the fix.
  • CopterTailsitter as it is on master (with the reboot) also passes with the fix.
  • Tailsitter, MAV_CMD_NAV_TAKEOFF and BootInAUTO pass with the fix.

I did not run the whole QuadPlane suite locally, and I have no hardware to test on.

Description

QuadPlane::setup() creates the VTOL AHRS view with ROTATION_PITCH_90 if tailsitter.enable > 0. The flag was only set from the legacy parameters later, in Tailsitter::setup(). On the first boot with those parameters the view was therefore created without the rotation: with the vehicle sitting on its tail, the attitude controller saw a pitch error of about 90 degrees and saturated the motors. Tailsitter::setup() then saved Q_TAILSIT_ENABLE=1, so every later boot worked. This is the analysis @naruto0916 posted on the issue; I confirmed it in SITL.

Plane: the legacy check moves out of Tailsitter::setup() into a new Tailsitter::setup_enable(), which QuadPlane::setup() calls just before it creates the view. The check itself is unchanged.

autotest: CopterTailsitter rebooted SITL right after wiping the parameters, which is why it never saw this. The reboot is removed, so the test now flies on the first boot.

Outside SITL this affects a vehicle whose parameters still rely on the legacy detection, on the first boot after Q_TAILSIT_ENABLE was introduced or after a parameter reset.

Not changed: the tiltrotor has the same kind of legacy check in Tiltrotor::setup(). It does not affect the AHRS view, so I left it where it is. The "not both a tailsitter and a tiltrotor" check in QuadPlane::setup() still runs before either legacy check, as before.

This contribution was AI-assisted (Claude Code): it reproduced the problem, wrote the change and ran the SITL checks above. I have not reviewed the code myself.

Assisted-by: Claude:claude-opus-5-5

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Global Size Summary (Total Flash delta in bytes)

Built from 5157938 rebased onto 95e2ddb

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

@Abtektas

Abtektas commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

A note on CI: the one red job is sitltest-quadplane-tests1c, and the only test that fails in it is QAUTOTUNE, which ends with "AutoTune: Failed to level" after repeated "Pitch Angle P Up 0%". That looks like the intermittent failure ArduPilot/ardupilot#33628 fixes. I saw the same failure in the same job on ArduPilot/ardupilot#34517, which only changes Tools/autotest/arduplane.py.

QAUTOTUNE flies the default quadplane frame, which sets neither Q_FRAME_CLASS nor Q_TAILSIT_MOTMX for a tailsitter, so Tailsitter::setup_enable() leaves Q_TAILSIT_ENABLE alone there. The other 44 tests in that job pass, Tailsitter among them. I have not changed anything for it.

Assisted-by: Claude:claude-opus-5-5

QuadPlane::setup() chooses the rotation of the VTOL AHRS view from
Q_TAILSIT_ENABLE, but the flag was only set from the legacy parameters
(Q_FRAME_CLASS, Q_TAILSIT_MOTMX) later, in Tailsitter::setup().  On the
first boot with those parameters the view was created without the
pitch rotation, so the attitude controller saw a 90 degree pitch error
with the vehicle sitting on its tail, saturated the motors and the
vehicle could not take off until the next reboot.

Move the legacy check into Tailsitter::setup_enable() and call it
before the view is created.

Assisted-by: Claude:claude-opus-5-5
The test rebooted SITL straight after wiping the parameters, which hid
that the copter tailsitter could not take off on its first boot.
Remove the reboot so the first boot is the one that flies.

Assisted-by: Claude:claude-opus-5-5
@Abtektas
Abtektas force-pushed the fix/tailsitter-first-boot branch from 16a1514 to 5157938 Compare October 21, 2026 21:38
@Abtektas

Copy link
Copy Markdown
Contributor Author

Rebased onto master to resolve the conflict with the new Tailsitter::is_dual_motor_frame(); setup_enable() now uses it. Rerun in SITL on the new base: CopterTailsitter fails without the Plane change ("Failed to attain Altitude want 62.0, reached -0.101") and passes with it; Tailsitter, MAV_CMD_NAV_TAKEOFF, BootInAUTO and TiltrotorVectoringRoll pass.

The one red CI job is again sitltest-quadplane-tests1c, where only QAUTOTUNE fails ("autotune did not succeed"). The same test failed in the same job on Oct 21 on unrelated branches, for example pr/mission-checksum and remote_power_off.

@Abtektas

Copy link
Copy Markdown
Contributor Author

Friendly ping: this fixes #34001. A tailsitter enabled only through the legacy Q_FRAME_CLASS or Q_TAILSIT_MOTMX parameters could not take off in any VTOL mode on its first boot; Q_TAILSIT_ENABLE is now set before the VTOL AHRS view is created. The branch still merges cleanly into master.

On CI: the one red job, sitltest-quadplane-tests1c from Oct 21, fails only in QAUTOTUNE ("AutoTune: Failed to level, please tune manually"). That is the intermittent failure #33628 addresses, which is still open. QAUTOTUNE flies the default quadplane frame, which this change does not touch. Happy to update the branch or rerun anything if that helps.

Assisted-by: Claude:claude-opus-5-5

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.

SITL quadplane-copter_tailsitter cannot take off in any VTOL mode (Plane 4.7.0)

1 participant