Skip to content

Commit

Permalink
AP_Scripting: aux function to set TECS to glide
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 authored and peterbarker committed Apr 5, 2024
1 parent 195da1d commit 7ea6474
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libraries/AP_Scripting/examples/fw_vtol_failsafe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
-- If the aircraft drops below a predetermined minimum altitude, QLAND mode is engaged and the aircraft lands at its current position.
-- If the aircraft arrives within Q_FW_LND_APR_RAD of the return point before dropping below the minimum altitude, it should loiter down to the minimum altitude before switching to QRTL and landing.

-- constants
local RC_OPTION = {TECS_PROP_FAILED=177}
local AuxSwitchPos = {LOW=0, MIDDLE=1, HIGH=2}

-- setup param block for VTOL failsafe params
local PARAM_TABLE_KEY = 77
local PARAM_TABLE_PREFIX = "VTFS_"
Expand Down Expand Up @@ -91,10 +95,8 @@ function trigger_failsafe()
-- RTL_AUTOLAND
param:set('RTL_AUTOLAND', 0)
end
if param:get('TECS_SPDWEIGHT') < 2 then
-- force airspeed priority
param:set('TECS_SPDWEIGHT', 2)
end
-- tell the TECS that propulsion has failed
rc:run_aux_function(RC_OPTION.TECS_PROP_FAILED, AuxSwitchPos.HIGH)
-- trigger an RTL to start bringing the vehicle home
-- it will automatically go to the nearest rally point if set or go to home
-- if no rally point available within the RALLY_LIMIT_KM
Expand Down

0 comments on commit 7ea6474

Please sign in to comment.