LUA failsafe APIs

Besides battery:has_failsafed() and vehicle:has_ekf_failsafed(), are there failsafe LUA APIs for other failsafe notifications, such as Radio Failsafe, and GCS Failsafe?

In other words, a method to get notified when a Radio or GCS failsafe has been triggered.

1 Like

We don’t have bindings for the actual failsafes. But you can check the validity to run your own checks.

---@return boolean
function rc:has_valid_input() end

-- Return the system time when a gcs with id of SYSID_MYGCS was last seen
---@return uint32_t_ud -- system time in milliseconds
function gcs:last_seen() end

1 Like

What is wrong with this implementation? Arducopter 4.4.4.

    local gcs_last_seen = gcs:last_seen()
    gcs:send_text(6, "Monitor GCS fail safe last seen = " .. tostring(gcs_last_seen))

12/12/2024 14:32:39 : mpt to call a nil value (method 'last_seen')
12/12/2024 14:32:39 : Lua: /APM/scripts/test_rc_gcs_failsafe.lua:7: atte

FS_GCS_ENABLE,1
SYSID_MYGCS,255

image

Your on a version from before the binding was added. It will work on the current stable.

Is there a release note on LUA script supported for Ardupilot where user can track and follow?

How do user verify it is working for
gcs:last_seen()? For rc:has_valid_input(), I can use gcs:send_text to verify.