Skip to content

Commit

Permalink
AP_Scripting: Add gyro/accel consistency checks to lua
Browse files Browse the repository at this point in the history
Added the accels_consistent and gyros_consistent methods to the lua bindings
  • Loading branch information
haydendonald committed Feb 7, 2024
1 parent 5428a92 commit a32e2a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/AP_Scripting/docs/docs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1495,11 +1495,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
Expand Down
2 changes: 2 additions & 0 deletions libraries/AP_Scripting/generator/description/bindings.desc
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,10 @@ 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 calibrating boolean
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
Expand Down

0 comments on commit a32e2a8

Please sign in to comment.