Pr port 4.5.7.5 rc1 rc2 to 4.6.3 - #116
Conversation
* Airbound 4.5.7.2 - hf1 stable release (#37) * [AIRB-76] Plane: Handle tailsitter back transition abort with force transition complete (#2) * Plane: Handle tailsitter back transition abort with force transition complete * Add logs for stabilize controller output for rpy * Update version to dev and add force backtrans abort in string * github: update workflows to use actions/upload-artifact@v4 * Always weathervane for tailsitters in RTL pos1 (#4) * Freeze climb rate pos controller (#12) * Freeze climb rate during RTL phases * Expose time to freeze crt before land descent as param * Add current timestamp to logging * Disable vh power if negative * Add desphi logging * Remove unused fixed wing attitude logs * Fix unit in docstring for param * Add weathervane checks in firmware basis pitch (#15) * Add airbound lua scripts in firmware * Update init log of airbound lua scripts * Add gps, vfgain, wvane lua scripts * Update init test lua script log * Update version string to 4.5.7.1 * Add ahrs pitch to PHID logging to check * Add setter for weathervane gain * Change weathervaning gain basis pitch. * Change variable names for wvane gain setting * Remove wvane autochange lua script from firmware * Fix tailsitter fw transition timeout issue by resampling initial pitch * Change wvane gain upper pitch limit to 91 * Rename version to 4.5.7.1 - rc1 * Revert fw transition timeout discontinuity check * Increase AHRS_PITCH_HI_WVANE_DEG to 95 * Initial pitch discontinuity bug fix, by checking the difference * Expose wvane gain pitch consts as params * Add check for pitch error to freeze crt during land descent * Add break statement for pitch error crt freezing * Change version to rc7 * Add a third segment for wvane gain/2 basis ahrs pitch wvane mid param * Change versiont to rc8 * Scale weathervane gain linearly between mid and low ahrs pitch limits * Change version to rc9 * Remove pitch based crt freezing * Change version to rc10 * Update parachute lua script default channel and expose servo min max * Update version to rc11 --------- Co-authored-by: Manuraj P M <manurajp@airbound.co> * Update version to 4.5.7.1 * Update last_pos2_ms time for non-rtl modes to freeze climb rate (#19) * Update last_pos2_ms time for non-rtl modes to freeze climb rate * Move set climb rate 0 for pos2 height control out of tailsitter check * Ardupilot 4.5.7: Change Synthetic airspeed estimation algorithm from EK3 to DCM (#25) * Add control surface checks lua script * Update parachute lua script log * Add door auto control script * Update version.h * Add wvane lo threshold to pix6c defaults param file * Add all airbound params to defaults.parm with q_tailsit_wv ones as readonly * Reduce default param list basis recent flights * Update version.h * Change EK3 airspeed estimate source from EK3 to DCM Update version.h --------- Co-authored-by: Mayank Joneja <mayankj@airbound.co> * Handle pitch beyond +/- 90 degrees by mapping to 180 degree (#32) * Modify Pixhawk6C-bdshot default parameter list - Update version.h to rc4 - Update default params in lua scripts * Handle gimbal lock singularity specifically for pitch in ahrs view * Update version to rc5 * Add simple ahrs pitch based check to correct att pitch beyond 90 * Add rot matrix based check for nose down belly up/down * Swap pitch corrections in ahrs view --------- Co-authored-by: akshar-airbound <aksharp@airbound.co> * Update version to 4.5.7.2 * Add attitude logging and fix doors script for extreme pitch (#33) * Modify Pixhawk6C-bdshot default parameter list - Update version.h to rc4 - Update default params in lua scripts * Handle gimbal lock singularity specifically for pitch in ahrs view * Update version to rc5 * Add simple ahrs pitch based check to correct att pitch beyond 90 * Add rot matrix based check for nose down belly up/down * Swap pitch corrections in ahrs view * Add logging for ahrs view compensation * Fix logging of pitch before and after compensation * Add logging for att target axis angle * Add logging of att body and error quat as axis angle * Add flags for belly up/down and nose down in logs * Update version to rc6 * Change version to 4.5.7.3 rc1 * Change mode check for landing phase for doors script * Check valid landing mission commands * Add check for vtol land descent from quadplane * Force doors open under takeoff alt_trig_m and don't check for transitions during takeoff * Add a landing latch flag to only trigger doors basis modes * Initialize servo pwm open close based on specific defaults * Update version to 4.5.7.2 hf1 * Update version to v4.5.7.2 - hf1 * Fix vtol flight check logic basis latch * Add global override param for doors auto logic * Fix num params for door script * Fix docstring for ATPC logging --------- Co-authored-by: akshar-airbound <aksharp@airbound.co> --------- Co-authored-by: Manuraj P M <manurajp@airbound.co> Co-authored-by: akshar-airbound <aksharp@airbound.co> * Update airbound-stable to 4.5.7.4-hf3 (#97) * Add 4.5.7.4 hf1 with PWM to RPM conversion factor as a parameter. (#79) * Expose the PWM to RPM conversion factor as a parameter * Update the version to V4.5.7.4 -hf1 * default.param:Update the parameter --------- Co-authored-by: Manuraj P M <manurajp@airbound.co> * Update autobailout and autoparadeploy parameters to ensure effective bailout and paradeploy behaviour (#81) * autobailout.lua: Changed default parameter values of AUTOB_PIT_TOUT, AUTOB_PARA_ANG, AUTOB_PARA_TOUT AUTOB_PIT_TOUT = 500 -> 200 AUTOB_PARA_ANG = -45 -> -15 AUTOB_PARA_TOUT = 200 -> 100 * Changed version name: V4.5.7.4 -hf1 + autob parm chg * autobailout.lua: modified valid AUTOB_PARA_ANG thresholds from (-50,-40) to (-50,-10) * autobailout.lua: Fix gcs message --------- Co-authored-by: akshar-airbound <aksharp@airbound.com> * Change version.h to 4.5.7.4 hf1 * Fix weathervane control slope based scale calculation error when control effort is between Q_TAILSIT_CE_LO and Q_TAILSIT_CE_HI (#82) * Fix weathervane control slope based scale calculation error when control effort is between Q_TAILSIT_CE_LO and Q_TAILSIT_CE_HI * Pixhawk6C-bdshot/scripts: Add vibration monitoring script and rename autobailout script filename --------- Co-authored-by: akshar-airbound <aksharp@airbound.com> * Update version to 4.5.7.4 hf2 * Rename ab_autobailout.lua back to autobailout.lua for hf3 (#84) * Update version.h to 4.5.7.4 hf3 --------- Co-authored-by: Manuraj-PM <91936659+Manuraj-PM@users.noreply.github.com> Co-authored-by: Manuraj P M <manurajp@airbound.co> Co-authored-by: akshar-airbound <aksharp@airbound.com> Co-authored-by: Mayank Joneja <mayankj@airbound.co> * Remove redundant control surface check script (#98) Co-authored-by: akshar-airbound <aksharp@airbound.com> * Add thrust vectoring desaturation and halved PID gain parameters (#99) * Fix weathervane control slope based scale calculation error when control effort is between Q_TAILSIT_CE_LO and Q_TAILSIT_CE_HI (#82) * Fix weathervane control slope based scale calculation error when control effort is between Q_TAILSIT_CE_LO and Q_TAILSIT_CE_HI * Pixhawk6C-bdshot/scripts: Add vibration monitoring script and rename autobailout script filename --------- Co-authored-by: akshar-airbound <aksharp@airbound.com> * Rename ab_autobailout.lua back to autobailout.lua for hf3 (#84) * Update the version to V4.5.7.4 -hf1 * /AP_MotorsTailsitter.cpp:Update the desaturation logic * Update the version to Airbound ArduPlane V4.5.7.5 -rc1 - Controller desaturation * Update version to V4.5.7.4 -hf4 - Controller desaturation * Reset yaw I term when disabling yaw control * Update the angle p gains of roll and yaw axes * Update the version to Airbound ArduPlane V4.5.7.4 -hf4 - Controller desat+ Half gain * Update the fixed wing parameters --------- Co-authored-by: akshar-airbound <aksharp@airbound.com> Co-authored-by: Mayank Joneja <mayankj@airbound.co> Co-authored-by: Manuraj P M <manurajp@airbound.co> * Add function to check tailsitter backtransition in quadplane class Add lua bindings exposing above function for lua scripting * autobailout.lua:Removed debug gcs strings * Changed version to 4.5.7.4-hf3 + new autobailout changed default value of parameter AUTOB_BTRN_DLY to 2500 * autobailout.lua: remove unused variables * quadplane.cpp: add time argument to vtol transition function * autobailout.lua: increase loop rate from 10 to 20 Hz defaults.parm: Change param name TECS_SPD_WEIGHT to TECS_SPDWEIGHT * Changed version name * autobailoout.lua:Renamed variable * Remove hardcoded yaw controller disabling when thrust angle exceeds 60deg * 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 * fixed a bug * Reduce weathervane gain during pos1 pos2 repositioning * Change version name to Airbound V4.5.7.5 - stabfixB * Change parameter value TECS_SYNAIRSPEED 0 -> 1 * Revert yaw rate controller disabling based on thrust error angle threshold * Changed Q_LAND_ALTCHG: 1.5 and Q_LND_DET_TIM: 200 --------- Co-authored-by: Mayank Joneja <mayankj@airbound.co> Co-authored-by: Manuraj P M <manurajp@airbound.co> Co-authored-by: Manuraj-PM <91936659+Manuraj-PM@users.noreply.github.com> Co-authored-by: akshar-airbound <aksharp@airbound.com> Co-authored-by: Stefard100 <airbound@LAPTOP-OVE24MET.localdomain> Co-authored-by: vigneshm <vigneshm@airbound.co>
* Add configuration options for the embedded parameter struct * Modify the GPS auto switching script for more robust checks - Use the vertical accuracy along with the satellite count for switching between GPS instances - Use separate minimum and maximum thresholds for switching as a form of hysteresis - Check for VTOL/landing mission commands in Auto mode - Set the run interval to 1 second * Add check to make sure both GPS instances exist - Check for the existance of both GPS instances before running the GPS instance switching logic * Remove unnecesary guard from the numsats assignment Replace mentions of hacc in the comments * Fix auto disarm parameters and disable autodisarm monitor after motor disarm * Add code to restore desired pitch to 0 when actual pitch exceeds Q_A_RELX_HI * In Copter Attitude controller Change yaw control disable thrust angle error limit from 60 to 90 Change linear scale yaw control thrust angle error limit from (45, 60) to (60, 90) * Change version to 4.5.7.5 - rc2-fixes --------- Co-authored-by: Atharva Sawant <atharvas@airbound.com> Co-authored-by: akshar-airbound <aksharp@airbound.com>
Greptile SummaryThis PR backports several ArduPlane 4.5.7.5 features onto the 4.6.3 base: a configurable land-detection timeout with a disarm watchdog, a redesigned pitch-relaxation controller with hysteresis, yaw-priority clamping in the tailsitter motor mixer, autobailout logic reworked around back-transition timing, and GPS switching improvements with dual sat/vacc hysteresis thresholds.
Confidence Score: 3/5Two behavioural changes need resolution before merge: the static LPF state in the attitude controller carries over across arm cycles, and the land-detector timeout default is 20-30× shorter than the values it replaced. The attitude controller now stores relaxation state in static locals instead of member variables, so a flight that ends with relaxation active leaves non-zero state that immediately attenuates pitch commands on the next arming. Separately, Q_LND_DET_TIM defaults to 200 ms against a documented floor of 1000 ms and the old hardcoded 4–6 s thresholds, making premature landing completion significantly more likely. Both issues sit on frequently-executed control paths. The remaining changes — GPS hysteresis, yaw-priority clamping, autobailout rework, and hwdef expansion — look correct and self-consistent. AC_AttitudeControl.cpp (static locals and orphaned RELX_TC param), quadplane.cpp (LND_DET_TIM default and range annotation). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[QPOS_LAND_DESCEND] --> B[check_land_final]
B -->|land_detector passes ≥200ms + 1000ms| C[QPOS_LAND_FINAL]
C --> D[check_land_complete]
D --> E{motors armed?}
E -->|No| F[return false]
E -->|Yes| G{lower_limit_start_ms != 0 and wdg_start_ms == 0?}
G -->|Yes| H[Start DISARM_WDG timer]
H --> I{elapsed >= wdg_timeout_s?}
I -->|Yes| J[MAV_SEVERITY_EMERGENCY message + restart timer]
I -->|No| K[land_detector check]
G -->|No| K
K -->|passes| L[QPOS_LAND_COMPLETE]
K -->|fails| M[return false]
N[set_armed=true] -->|reset wdg_start_ms=0| D
subgraph AC_AttitudeControl
O[attitude_controller_run_quat] --> P{_ts_enabled and _att_relax_enabled and not _ts_in_transition?}
P -->|Yes| Q[Compute pitch_tilt from attitude_body]
Q --> R{pitch_tilt > RELX_HI?}
R -->|Yes| S[_att_relax_active = true]
R -->|No: pitch_tilt < RELX_LO?| T[_att_relax_active = false]
S --> U[LPF: relaxation_factor_lpf toward 1]
T --> V[LPF: relaxation_factor_lpf toward 0]
U & V --> W[euler_sp.y *= 1 - relaxation_factor_lpf]
W --> X[thrust_heading_rotation_angles]
end
%%{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[QPOS_LAND_DESCEND] --> B[check_land_final]
B -->|land_detector passes ≥200ms + 1000ms| C[QPOS_LAND_FINAL]
C --> D[check_land_complete]
D --> E{motors armed?}
E -->|No| F[return false]
E -->|Yes| G{lower_limit_start_ms != 0 and wdg_start_ms == 0?}
G -->|Yes| H[Start DISARM_WDG timer]
H --> I{elapsed >= wdg_timeout_s?}
I -->|Yes| J[MAV_SEVERITY_EMERGENCY message + restart timer]
I -->|No| K[land_detector check]
G -->|No| K
K -->|passes| L[QPOS_LAND_COMPLETE]
K -->|fails| M[return false]
N[set_armed=true] -->|reset wdg_start_ms=0| D
subgraph AC_AttitudeControl
O[attitude_controller_run_quat] --> P{_ts_enabled and _att_relax_enabled and not _ts_in_transition?}
P -->|Yes| Q[Compute pitch_tilt from attitude_body]
Q --> R{pitch_tilt > RELX_HI?}
R -->|Yes| S[_att_relax_active = true]
R -->|No: pitch_tilt < RELX_LO?| T[_att_relax_active = false]
S --> U[LPF: relaxation_factor_lpf toward 1]
T --> V[LPF: relaxation_factor_lpf toward 0]
U & V --> W[euler_sp.y *= 1 - relaxation_factor_lpf]
W --> X[thrust_heading_rotation_angles]
end
|
| static float relaxation_factor_lpf = 0.0f; | ||
| float alpha_relax = _dt / (_dt + _tc_tilt_relax); | ||
| static bool _att_relax_active = false; |
There was a problem hiding this comment.
Static locals persist across arm/disarm cycles
relaxation_factor_lpf and _att_relax_active are declared static inside a member function called at ~400 Hz. Static locals in C++ are initialized once at program load and never reset. If the vehicle lands with relaxation active (relaxation_factor_lpf > 0), disarms, then re-arms without a full power cycle, the filter state carries over and the attitude controller immediately applies pitch attenuation the moment the motors are armed again. These variables should be member fields of AC_AttitudeControl (initialized in the constructor and optionally reset on arm) so their lifecycle is tied to the object rather than to the process.
| // @User: Advanced | ||
| AP_GROUPINFO("LND_FRZ_TIM", 40, QuadPlane, q_land_freeze_time, 7.0f), | ||
|
|
||
| // @Param: LND_DET_TIM | ||
| // @DisplayName: Qmode Land detection timeout | ||
| // @Description: The maximum time allowed for land detection in milliseconds | ||
| // @Units: ms | ||
| // @Range: 1000 4000 | ||
| // @Increment: 100 | ||
| // @User: Standard | ||
| AP_GROUPINFO("LND_DET_TIM", 43, QuadPlane, landing_detect.timeout_ms, 200), | ||
|
|
There was a problem hiding this comment.
LND_DET_TIM default (200 ms) is outside its documented range and 20-30× shorter than the previous hardcoded timeout
The @Range annotation says 1000–4000 ms, but the default is 200 ms. More critically, the old land_detector() was hardcoded to 4000 ms in check_land_complete() and 6000 ms in check_land_final(); now both use the same parameter that defaults to 200 ms. With a 200 ms timeout the landing condition clears in roughly 1.2 s (200 ms for land_start_ms + 1000 ms for lower_limit_start_ms), down from 5–7 s previously. Combined with the Q_LAND_ALTCHG increase to 1.5 m in defaults.parm, this dramatically lowers the bar for declaring a landing complete, risking premature disarm sequences. The documented range should be corrected to reflect the actual intended operating window, or the default should be raised to something within that range.
| function is_vehicle_landing() | ||
| local current_mode = vehicle:get_mode() | ||
| if current_mode == MODE_QLAND then | ||
| return true | ||
| elseif quadplane:in_vtol_land_descent() then | ||
| if quadplane:in_vtol_land_descent() then | ||
| return true | ||
| else | ||
| return false | ||
| end | ||
| end |
There was a problem hiding this comment.
is_vehicle_landing() is now dead code
The function is defined but no longer called anywhere in the script. The old call site in update() has been replaced by if in_vtol_flight(). The function can be removed to avoid confusion.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
porting of ArduPlane 4.5.7.5 rc1 and rc2 features to the 4.6.3
https://www.notion.so/airbound/backporting-4-5-7-5-rc1-rc2-to-4-6-3-38321adf4be980d39735f1b0dd7ae18b?v=29721adf4be981d59032000c1dc9579e&source=copy_link