From 06d1beb4d8e7843997be501c4589f25dadd02723 Mon Sep 17 00:00:00 2001 From: Hayden Donald Date: Wed, 7 Feb 2024 15:06:58 +1100 Subject: [PATCH] AP_Scripting: Add gyro/accel consistency checks to lua Added the accels_consistent and gyros_consistent methods to the lua bindings --- libraries/AP_Scripting/docs/docs.lua | 12 ++++++++++++ .../AP_Scripting/generator/description/bindings.desc | 2 ++ 2 files changed, 14 insertions(+) diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index 0d4ac3d3a7d1d7..ea06ba6ae27787 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -1496,11 +1496,23 @@ ins = {} ---@return number function ins:get_temperature(instance) end +-- Check if the gyrometers are consistent +---@param threshold integer -- the allowed threshold in degrees per second +---@param consistency_seconds integer -- how many seconds to require consistent data for +---@return boolean +function ins:gyros_consistent(threshold, consistency_seconds) end + -- Check if a specific gyrometer sensor is healthy ---@param instance integer -- the 0-based index of the gyrometer instance to return. ---@return boolean function ins:get_gyro_health(instance) end +-- Check if the accelerometers are consistent +---@param threshold float -- the threshold allowed before returning false +---@param consistency_seconds integer -- how many seconds to require consistent data for +---@return boolean +function ins:accels_consistent(threshold, consistency_seconds) end + -- Check if a specific accelerometer sensor is healthy ---@param instance integer -- the 0-based index of the accelerometer instance to return. ---@return boolean diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 0eee97bf20d509..77ef730ef570e7 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -632,7 +632,9 @@ singleton AP_InertialSensor depends AP_INERTIALSENSOR_ENABLED singleton AP_InertialSensor rename ins singleton AP_InertialSensor method get_temperature float uint8_t 0 INS_MAX_INSTANCES singleton AP_InertialSensor method get_gyro_health boolean uint8_t'skip_check +singleton AP_InertialSensor method accels_consistent boolean float'skip_check uint8_t'skip_check singleton AP_InertialSensor method get_accel_health boolean uint8_t'skip_check +singleton AP_InertialSensor method gyros_consistent boolean uint8_t'skip_check uint8_t'skip_check singleton CAN manual get_device lua_get_CAN_device 1 singleton CAN manual get_device2 lua_get_CAN_device2 1