Skip to content

add 4575 rc5 features to airbound-develop - #122

Draft
akshar-airbound wants to merge 10 commits into
airbound-developfrom
pr-airbound-4575-rc5-fixes
Draft

add 4575 rc5 features to airbound-develop#122
akshar-airbound wants to merge 10 commits into
airbound-developfrom
pr-airbound-4575-rc5-fixes

Conversation

@akshar-airbound

@akshar-airbound akshar-airbound commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

This adds the following changes to airbound-develop

  1. Revert control desaturation

Notion page:
https://app.notion.com/p/airbound/Add-airbound-develop-4-5-7-5-rc5-features-38f21adf4be980debf79ff547fd0bd42?source=copy_link

vigneshm-debug and others added 10 commits June 16, 2026 12:39
- AP_Scripting: expose rate PID info to Lua via get_rate_pid_info(axis)
- Adds lua_get_rate_pid_info() binding returning a table of PID fields
(P, I, D, FF, target, actual, error) for roll (0), pitch (1), or yaw (2)
rate controllers. Used to compute control effort (|P + D + FF|) from Lua.
- Add get_attitude_control() public accessor to QuadPlane
- Add despitch, roll and yaw
…ed pitch (#111)

* Remove controller desaturation in control effort
* Add desaturation logic for Desired servo tilt
* Add logging for VH Power
* Add hard limit for pitch angle setpoint
* Add new parameters in default.param
* Add logging for the position controller demanded pitch
---------

Co-authored-by: Manuraj P M <[email protected]>
* introduced parameter LND_DET_TIM that controls how many milliseconds before disarm is detected
* add disarm watchdog and disable weathervane after touchdown
* Weathervane disable logic changed
* expose land detection timing as params Q_LND_RELAX_MS and Q_LND_LLIM_MS
---------

Co-authored-by: Stefard100 <[email protected]>
* Fix feedforward_scalar calculation when thrust angle error exceeds limits in AC_AttitudeControl.cpp
* add resume after autobailout
@akshar-airbound
akshar-airbound marked this pull request as draft July 1, 2026 08:32
@akshar-airbound akshar-airbound self-assigned this Jul 1, 2026
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates tailsitter recovery and control behavior. The main changes are:

  • New Lua bindings for QuadPlane attitude and rate data.
  • Expanded Pixhawk6C autobailout parameters and recovery-to-previous-mode logic.
  • A new VTOL pitch clip parameter for tailsitter attitude control.
  • Reverted tailsitter thrust-vector desaturation.
  • Updated firmware label and board defaults.

Confidence Score: 4/5

The autobailout recovery path and tailsitter yaw saturation path need fixes before merging.

  • A recovered QLoiter hover can fail the new absolute-pitch recovery gate and stay in bailout.
  • Updating the existing AUTOB table size can stop the safety script until reboot.
  • Raw thrust-vector mixing can saturate yaw without telling the controller it is limited.

autobailout.lua, AP_MotorsTailsitter.cpp, AC_AttitudeControl.cpp

Important Files Changed

Filename Overview
libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C-bdshot/scripts/autobailout.lua Expands the AUTOB parameter table and adds rolling-window recovery logic, with issues in the recovery pitch gate and table resize path.
libraries/AP_Motors/AP_MotorsTailsitter.cpp Reverts pitch/yaw thrust desaturation and removes the yaw limit signal from this saturation path.
libraries/AC_AttitudeControl/AC_AttitudeControl.cpp Adds tailsitter pitch clipping and changes feed-forward behavior in the quaternion attitude controller.
libraries/AP_Scripting/lua_bindings.cpp Adds ArduPlane-only Lua helpers for QuadPlane attitude, rate target, and PID data.
ArduPlane/quadplane.h Exposes QuadPlane attitude-control and AHRS-view pointers for the new scripting bindings.
ArduPlane/tailsitter.cpp Updates PHID logging fields and keeps extra elevator available for logging.
libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C-bdshot/defaults.parm Adds the default value for the new VTOL pitch clip parameter.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Autobailout update loop] --> B[Sample desired and actual pitch]
    B --> C[Pitch limit exceeded]
    C --> D[Switch to QLoiter]
    D --> E[Check rolling avg_err and peak_ang]
    E -->|Both below limits| F[Return to pre-bailout mode]
    E -->|Absolute hover pitch stays high| G[Remain active in QLoiter]
    H[Tailsitter motor mix] --> I[Raw pitch_thrust plus yaw_thrust]
    I --> J[Servo output clipping]
    I --> K[No yaw limit flag]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Autobailout update loop] --> B[Sample desired and actual pitch]
    B --> C[Pitch limit exceeded]
    C --> D[Switch to QLoiter]
    D --> E[Check rolling avg_err and peak_ang]
    E -->|Both below limits| F[Return to pre-bailout mode]
    E -->|Absolute hover pitch stays high| G[Remain active in QLoiter]
    H[Tailsitter motor mix] --> I[Raw pitch_thrust plus yaw_thrust]
    I --> J[Servo output clipping]
    I --> K[No yaw limit flag]
Loading

Reviews (1): Last reviewed commit: "Update the version to AB ArduPlane V4.5...." | Re-trigger Greptile

local actual_pitch_deg = actual and (actual.pitch_cd * 0.01) or 0

pitch_error_buf[buf_idx] = math.abs(target_pitch_deg - actual_pitch_deg)
pitch_angle_buf[buf_idx] = math.abs(actual_pitch_deg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Hover Pitch Blocks Recovery

When autobailout switches a tailsitter into QLoiter, the new resume gate stores absolute pitch in pitch_angle_buf and later requires it to stay below AUTOB_PEAK_LIM defaulting to 30 degrees. A recovered QLoiter hover is still near vertical pitch, so peak_ang can remain around 80-90 degrees and vehicle:set_mode(pre_bailout_mode) never runs.

Suggested change
pitch_angle_buf[buf_idx] = math.abs(actual_pitch_deg)
pitch_angle_buf[buf_idx] = math.abs(target_pitch_deg - actual_pitch_deg)

-- 1. SETUP PARAMETER TABLE
local KEY = 110
assert(param:add_table(KEY, "AUTOB_", 7), "AUTOB table failed")
assert(param:add_table(KEY, "AUTOB_", 13), "AUTOB table failed")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Parameter Table Resize Halts Script

On an in-place script update, key 110 can already be registered with the old seven-slot AUTOB_ table. Expanding it to 13 slots makes param:add_table fail until reboot, and this assert stops the whole autobailout script, leaving the vehicle without the recovery monitor during that run.

Comment on lines +213 to +214
_tilt_left = pitch_thrust - yaw_thrust;
_tilt_right = pitch_thrust + yaw_thrust;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Yaw Saturation Loses Limit Flag

The reverted thrust-vectoring path now sends raw pitch_thrust ± yaw_thrust while later tailsitter output code still clips the servo commands to their range. When combined pitch and yaw demand exceeds that range, yaw authority is saturated but limit.yaw is no longer raised, so the yaw controller can keep integrating against an unavailable actuator and overshoot when the demand drops.

Suggested change
_tilt_left = pitch_thrust - yaw_thrust;
_tilt_right = pitch_thrust + yaw_thrust;
_tilt_left = pitch_thrust - yaw_thrust;
_tilt_right = pitch_thrust + yaw_thrust;
if (fabsf(_tilt_left) > 1.0f || fabsf(_tilt_right) > 1.0f) {
limit.yaw = true;
}

Comment on lines +786 to +791
if(_ts_enabled && !_ts_in_transition){
Vector3f euler_sp;
_attitude_target.to_euler(euler_sp.x, euler_sp.y, euler_sp.z);
euler_sp.y = constrain_float(euler_sp.y,radians(-_att_max_pit),radians(_att_max_pit));
_attitude_target.from_euler(euler_sp.x, euler_sp.y, euler_sp.z);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Pitch Clamp Leaves Stale Rate

This clamp changes _attitude_target after the pitch rate target has already been produced and relaxed, but it does not adjust _ang_vel_target.y. When a VTOL caller requests pitch beyond Q_A_PIT_CLIP_MAX, feedback uses the clipped attitude while feed-forward can still use the larger unclipped pitch-rate command, producing a rate kick past the intended pitch limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants