Skip to content

Pr 4631 ported 4575 rc9 - #131

Open
vigneshm-debug wants to merge 30 commits into
airbound-develop-4.6.3from
pr-4631-ported-4575-rc9
Open

Pr 4631 ported 4575 rc9#131
vigneshm-debug wants to merge 30 commits into
airbound-develop-4.6.3from
pr-4631-ported-4575-rc9

Conversation

@vigneshm-debug

@vigneshm-debug vigneshm-debug commented Jul 20, 2026

Copy link
Copy Markdown

akshar-airbound and others added 24 commits July 3, 2026 06:52
* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Co-authored-by: Manuraj P M <[email protected]>
Co-authored-by: akshar-airbound <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Manuraj P M <[email protected]>
Co-authored-by: akshar-airbound <[email protected]>
Co-authored-by: Mayank Joneja <[email protected]>

* Remove redundant control surface check script (#98)

Co-authored-by: akshar-airbound <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Mayank Joneja <[email protected]>
Co-authored-by: Manuraj P M <[email protected]>

* 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 <[email protected]>
Co-authored-by: Manuraj P M <[email protected]>
Co-authored-by: Manuraj-PM <[email protected]>
Co-authored-by: akshar-airbound <[email protected]>
Co-authored-by: Stefard100 <[email protected]>
Co-authored-by: vigneshm <[email protected]>
* 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 <[email protected]>
Co-authored-by: akshar-airbound <[email protected]>
- 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
…ut, ATI logging and default parameters are set
… prompt, recv guard, CPIN scoping, buf.dp clear, TX_RATE)
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR ports rc8/rc9 Airbound features onto the ArduPlane 4.6.3 base, combining the disarm watchdog (DARM_WDG_T), a parameterized land-detector timeout (LND_DET_TIM), a full rewrite of tailsitter attitude relaxation with hysteresis, new Lua scripting bindings for attitude telemetry, and updates to the LTE modem and autobailout scripts.

  • Attitude relaxation rewrite (AC_AttitudeControl): replaces the old single-threshold approach with a static-local LPF and hysteresis pair (RELX_HI/RELX_LO); also adds a hard pitch-clip (PIT_CLIP_MAX). Previously flagged issues (static locals surviving disarm, member/local variable overwrite in thrust-error branches) remain unresolved.
  • Landing detection rework (quadplane.cpp): introduces DARM_WDG_T watchdog and LND_DET_TIM; the 200 ms default is far below the declared @Range floor and reduces both check_land_complete and check_land_final windows dramatically from their prior hard-coded 4000/6000 ms values.
  • Scripting and Lua (lua_bindings.cpp, autobailout.lua): adds four new C-side bindings returning Lua tables, but bindings.desc/docs.lua still declare three separate return values per call.

Confidence Score: 2/5

Not safe to merge; multiple control-path defects in the attitude controller and landing detection remain unaddressed, and the newly added weathervane gain reduction in QPOS_POSITION2 silently has no effect.

The attitude controller thrust-error branches write to _ang_vel_body (member) then unconditionally overwrite it with the untouched local, discarding yaw-gyro clamps and partial feedforward every high-tilt cycle. Land-detector timeouts collapse to 200 ms, opening a false-landing window during powered descent. The new weathervane->set_gain(wvane_max_gain/3) in vtol_position_controller is overwritten every frame by tailsitter.output(), so the intended gain reduction never applies.

AC_AttitudeControl.cpp (thrust-error branch variable scoping and static local state), quadplane.cpp (land detector timeout and weathervane gain calls at lines 2880/2891)

Important Files Changed

Filename Overview
ArduPlane/quadplane.cpp Adds DARM_WDG_T watchdog, LND_DET_TIM parameter, and weathervane gain changes for tailsitter QPOS_POSITION2; the set_gain call is immediately overridden by tailsitter output, and the 200 ms land-detector timeout carries multiple previously-flagged regressions.
libraries/AC_AttitudeControl/AC_AttitudeControl.cpp Rewrites attitude relaxation with hysteresis and pitch-clip; introduces static local relaxation state and a member-vs-local overwrite in thrust-error branches that discards yaw and feedforward corrections (previously flagged P1).
libraries/AC_AttitudeControl/AC_AttitudeControl.h Replaces single-threshold relaxation params with hysteresis pair and adds _att_max_pit; removes ts_back_transition_done and LAND*_MULT fields.
ArduPlane/tailsitter.cpp Removes HAL_LOGGING_ENABLED guard from WriteStreaming call (previously flagged); otherwise no functional changes.
libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C-bdshot/scripts/LTE_modem.lua Refactors signal parsing into QENG/QCSQ handlers; QCSQ sends RSSI/RSRP/RSRQ unconditionally while CPSI still gates on OPT.SIGNALS.
libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C-bdshot/scripts/autobailout.lua Adds rolling-window pitch averaging and rate-based prediction; is_vtol_flight implicit global and multiple para_deploy implicit globals remain outstanding.
libraries/AP_Scripting/lua_bindings.cpp Adds four new C-side bindings returning Lua tables; bindings.desc still declares 3 returns per call (mismatch previously flagged).

Sequence Diagram

sequenceDiagram
    participant PC as vtol_position_controller()
    participant AC as attitude_controller_run_quat()
    participant TS as tailsitter.output()
    participant WV as AC_WeatherVane

    PC->>WV: set_gain(wvane_max_gain/3) [QPOS_POSITION2]
    Note over PC,WV: Intended: reduce weathervane to 1/3

    AC->>AC: compute ang_vel_body (local)
    alt "thrust_error > 3x threshold"
        AC->>AC: "_ang_vel_body.z = gyro.z (member)"
        AC->>AC: reset_I()
    else "thrust_error > 2x threshold"
        AC->>AC: "_ang_vel_body += feedforward (member)"
    else normal
        AC->>AC: "ang_vel_body += feedforward (local)"
    end
    AC->>AC: "_ang_vel_body = ang_vel_body (local overwrites member!)"

    TS->>WV: set_gain(wvane_max_gain) [full pitch-based gain]
    Note over TS,WV: Overrides vtol_position_controller set_gain

    WV->>WV: get_yaw_out() uses full gain, not 1/3
Loading

Reviews (5): Last reviewed commit: "Remove debug LTE_QENG named-float broadc..." | Re-trigger Greptile

Comment on lines +893 to +895
static float relaxation_factor_lpf = 0.0f;
float alpha_relax = _dt / (_dt + _tc_tilt_relax);
static bool _att_relax_active = false;

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 static locals carry stale relaxation state across flights

relaxation_factor_lpf and _att_relax_active are static local variables, so they survive arm/disarm cycles without any reset. If the vehicle was in a high-tilt state when power is cycled or an emergency disarm occurs, relaxation_factor_lpf can be near 1.0 on the next arm. The attitude controller would then immediately zero out the pitch setpoint (euler_sp.y *= (1.0f - 1.0f)) at the start of the next flight until the LPF decays, which could cause unexpected control behaviour during takeoff. These should be promoted to member variables in AC_AttitudeControl so they can be properly reset (e.g., in a reset or initialise method).

Comment on lines 540 to 549
-- DEBUG: always send named floats (regardless of OPT.SIGNALS) for testing.
-- Revert this gating once you've confirmed values are reaching MP.
gcs:send_named_float('LTE_RSRP', rsrp)
gcs:send_named_float('LTE_RSRQ', rsrq)
gcs:send_named_float('LTE_SINR', sinr)
gcs:send_named_float('LTE_BAND', band)
gcs:send_named_float('LTE_CID', cid>>8)
gcs:send_named_float('LTE_MCCMNC', mcc*100+mnc)

local tower_id = cid >> 8

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 Debug bypass of OPT.SIGNALS gate committed to main branch

The OPT.SIGNALS guard that previously controlled whether extended signal metrics (LTE_RSRP, LTE_RSRQ, LTE_SINR, LTE_BAND, LTE_CID, LTE_MCCMNC) are broadcast was removed. The in-code comment explicitly states: "Revert this gating once you've confirmed values are reaching MP." Broadcasting these named floats unconditionally on every +QENG parse adds unnecessary GCS telemetry traffic in production and cannot be disabled via LTE_OPTIONS. The original gate should be restored.

logger:write('AUTB', 'AvgErr,PeakAng,PitchDeg,QPit,QRateP', 'fffff', avg_err, peak_ang, pitch_deg, actual_vtol_pitch_deg, actual_vtol_pitch_rate)
end

is_vtol_flight = in_vtol_flight()

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 is_vtol_flight is assigned without local, making it an implicit global variable in Lua. It should be declared locally to avoid polluting the global namespace and to prevent potential cross-script interference.

Suggested change
is_vtol_flight = in_vtol_flight()
local is_vtol_flight = in_vtol_flight()

Comment thread ArduPlane/quadplane.cpp
Comment on lines +577 to +584
// @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", 42, QuadPlane, landing_detect.timeout_ms, 200),

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 LND_DET_TIM default (200 ms) is outside its own documented @Range (1000–4000)

The parameter annotation states @Range: 1000 4000 but the default and the defaults.parm entry are both set to 200 ms. The @Range is advisory in ArduPilot (not enforced), so this won't crash, but it misleads ground station users who inspect the parameter limits and may cause confusion when tuning. Either update @Range: 1 4000 to reflect the actual use, or raise the default to the minimum documented value.

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!

Comment thread ArduPlane/tailsitter.cpp
Comment on lines +588 to +594
float position_pitch_sp = quadplane.pos_control->get_pitch_cd();
// Add logging for desired thrust vectoring angles
AP::logger().WriteStreaming("PHID", "TimeUS,DesL,DesR,AhrsPitch,WVGain,WVGainS",
"sddd--", // seconds, degrees
"F00000", // micro (1e-6), no mult (1e0)
"Qfffff", // uint64_t, float
AP_HAL::micros64(), tilt_left/100, tilt_right/100,pitch_cd/100,weathervane_gain,gain_slope);
#endif
AP::logger().WriteStreaming("PHID", "TimeUS,DesL,DesR,AhrsPit,WVGain,VHPwEe,PosPit",
"sddd--d", // seconds, degrees
"F000000", // micro (1e-6), no mult (1e0)
"Qffffff", // uint64_t, float
AP_HAL::micros64(),tilt_left/100,tilt_right/100,pitch_cd/100,weathervane_gain,extra_elevator/100,position_pitch_sp/100);

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 The #if HAL_LOGGING_ENABLED guard was removed from this WriteStreaming call. On targets where HAL_LOGGING_ENABLED is not defined the call is either a no-op stub or fails to compile, depending on the platform. The original guard was deliberate; restore it to preserve portability and avoid unconditional overhead.

Suggested change
float position_pitch_sp = quadplane.pos_control->get_pitch_cd();
// Add logging for desired thrust vectoring angles
AP::logger().WriteStreaming("PHID", "TimeUS,DesL,DesR,AhrsPitch,WVGain,WVGainS",
"sddd--", // seconds, degrees
"F00000", // micro (1e-6), no mult (1e0)
"Qfffff", // uint64_t, float
AP_HAL::micros64(), tilt_left/100, tilt_right/100,pitch_cd/100,weathervane_gain,gain_slope);
#endif
AP::logger().WriteStreaming("PHID", "TimeUS,DesL,DesR,AhrsPit,WVGain,VHPwEe,PosPit",
"sddd--d", // seconds, degrees
"F000000", // micro (1e-6), no mult (1e0)
"Qffffff", // uint64_t, float
AP_HAL::micros64(),tilt_left/100,tilt_right/100,pitch_cd/100,weathervane_gain,extra_elevator/100,position_pitch_sp/100);
float position_pitch_sp = quadplane.pos_control->get_pitch_cd();
#if HAL_LOGGING_ENABLED
// Add logging for desired thrust vectoring angles
AP::logger().WriteStreaming("PHID", "TimeUS,DesL,DesR,AhrsPit,WVGain,VHPwEe,PosPit",
"sddd--d", // seconds, degrees
"F000000", // micro (1e-6), no mult (1e0)
"Qffffff", // uint64_t, float
AP_HAL::micros64(),tilt_left/100,tilt_right/100,pitch_cd/100,weathervane_gain,extra_elevator/100,position_pitch_sp/100);
#endif

Comment on lines +450 to +455
-- DEBUG: print CSQ values to GCS text (throttled to once per 5s)
if not cs.last_csq_print_ms or (millis() - cs.last_csq_print_ms) > 5000 then
cs.last_csq_print_ms = millis()
gcs:send_text(MAV_SEVERITY.INFO,
string.format("LTE CSQ: RSSI=%s BER=%s", rssi_raw, ber_raw))
end

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 Debug CSQ GCS text print committed without a removal plan

The comment explicitly marks this as -- DEBUG: and it throttle-prints LTE CSQ: RSSI=… BER=… to the GCS text channel every 5 s regardless of LTE_OPTIONS. Unlike named floats, GCS text messages are visible in all ground stations and consume MAVLink bandwidth continuously. This should be guarded behind OPT.LOGALL or removed before merging.

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!

@vigneshm-debug vigneshm-debug self-assigned this Jul 20, 2026
Comment thread ArduPlane/quadplane.cpp
Comment on lines +3564 to +3566
if (!motors->armed()) {
return false;
}

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 QPOS_LAND_COMPLETE is unreachable after a soft disarm

The new early return exits check_land_complete() when !motors->armed(). This means that if the motors are already disarmed (e.g. after a quiet-disarm command, an arming watchdog trip, or the watchdog block just above), the position controller can never transition to QPOS_LAND_COMPLETE. Any logic that gates on QPOS_LAND_COMPLETE (logging, mission continuation, payload-place handling) would then be skipped permanently for that landing.

Comment thread ArduPlane/quadplane.cpp
Comment on lines 3627 to 3631
also apply landing detector, in case we have landed in descent
phase. Use a longer threshold
*/
return land_detector(6000);
return land_detector();
}

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 check_land_final timeout silently dropped from 6000 ms to 200 ms

The in-code comment on the block immediately above (/* also apply landing detector, in case we have landed in descent phase. Use a longer threshold */) explicitly acknowledges that check_land_final must use a longer threshold than check_land_complete. Before this PR, check_land_final called land_detector(6000) and check_land_complete called land_detector(4000). After the refactor both call the parameterless land_detector(), which uses landing_detect.timeout_ms — defaulting to 200 ms. The lower-limit guard consequently shrinks from 7 000 ms to 1 200 ms. During the powered-descent phase (QPOS_LAND_DESCEND), any 200 ms window with less than detect_alt_change altitude variation could trigger a false land-complete, causing premature transition and potential crash.

Comment on lines +1318 to +1362
auto *qp = QuadPlane::get_singleton();
if (qp == nullptr) {
return luaL_error(L, "QuadPlane not available");
}
auto *att = qp->get_attitude_control();
if (att == nullptr) {
return luaL_error(L, "attitude_control not available");
}

const Vector3f target = att->get_att_target_euler_cd();

lua_newtable(L);
lua_pushnumber(L, target.x); lua_setfield(L, -2, "roll_cd");
lua_pushnumber(L, target.y); lua_setfield(L, -2, "pitch_cd");
lua_pushnumber(L, target.z); lua_setfield(L, -2, "yaw_cd");

return 1;
}

int lua_get_rate_ef_targets(lua_State *L) {
binding_argcheck(L, 0);

auto *qp = QuadPlane::get_singleton();
if (qp == nullptr) {
return luaL_error(L, "QuadPlane not available");
}
auto *att = qp->get_attitude_control();
if (att == nullptr) {
return luaL_error(L, "attitude_control not available");
}

const Vector3f &rates = att->get_rate_ef_targets();

lua_newtable(L);
lua_pushnumber(L, degrees(rates.x)); lua_setfield(L, -2, "roll_dps");
lua_pushnumber(L, degrees(rates.y)); lua_setfield(L, -2, "pitch_dps");
lua_pushnumber(L, degrees(rates.z)); lua_setfield(L, -2, "yaw_dps");

return 1;
}

int lua_get_actual_euler_cd(lua_State *L) {
binding_argcheck(L, 0);
auto *qp = QuadPlane::get_singleton();
if (qp == nullptr) {

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 Docs and bindings descriptor claim 3 return values; implementation returns 1 table

bindings.desc registers qp_att_desired, qp_att_actual, and qp_angle_rate with 0 3 (0 args, 3 returns). docs.lua annotates them the same way — three separate @return number entries. But each C implementation pushes a single Lua table and returns 1. A script author following the documented API would write local roll, pitch, yaw = qp_att_desired() and silently get (table, nil, nil). The Lua scripts in this PR that use these functions do so correctly (capturing the single table), but the discrepancy between the declared and actual return shape will mislead any future scripts relying on the documentation.

@vigneshm-debug
vigneshm-debug requested a review from botmayank July 23, 2026 11:10
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