mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Scripting: Add health checks
Added health checks for the Baro, InertialSensor, IOMCU, and Compass
This commit is contained in:
parent
9ef3241949
commit
09fd157b9b
@ -981,6 +981,25 @@ void AP_Baro::update(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAL_BUILD_AP_PERIPH
|
||||
// calibration and alt check not valid for AP_Periph
|
||||
bool AP_Baro::healthy(uint8_t instance) const {
|
||||
// If the requested instance was outside max instances it is not healthy (it doesn't exist)
|
||||
if (instance >= BARO_MAX_INSTANCES) {
|
||||
return false;
|
||||
}
|
||||
return sensors[instance].healthy;
|
||||
}
|
||||
#else
|
||||
bool AP_Baro::healthy(uint8_t instance) const {
|
||||
// If the requested instance was outside max instances it is not healthy (it doesn't exist)
|
||||
if (instance >= BARO_MAX_INSTANCES) {
|
||||
return false;
|
||||
}
|
||||
return sensors[instance].healthy && sensors[instance].alt_ok && sensors[instance].calibrated;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
update field elevation value
|
||||
*/
|
||||
|
@ -1087,6 +1087,24 @@ function winch:relax() end
|
||||
---@return boolean
|
||||
function winch:healthy() end
|
||||
|
||||
-- desc
|
||||
---@class iomcu
|
||||
iomcu = {}
|
||||
|
||||
-- Check if the IO is healthy
|
||||
---@return boolean
|
||||
function iomcu:healthy() end
|
||||
|
||||
-- desc
|
||||
---@class compass
|
||||
compass = {}
|
||||
|
||||
-- Check if the compass is healthy
|
||||
---@param instance integer -- the 0-based index of the compass instance to return.
|
||||
---@return boolean
|
||||
function compass:healthy(instance) end
|
||||
|
||||
|
||||
-- desc
|
||||
---@class camera
|
||||
camera = {}
|
||||
@ -1357,6 +1375,15 @@ ins = {}
|
||||
---@return number
|
||||
function ins:get_temperature(instance) 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 a specific accelerometer sensor is healthy
|
||||
---@param instance integer -- the 0-based index of the accelerometer instance to return.
|
||||
---@return boolean
|
||||
function ins:get_accel_health(instance) end
|
||||
|
||||
-- desc
|
||||
---@class Motors_dynamic
|
||||
@ -1762,6 +1789,11 @@ function baro:get_pressure() end
|
||||
---@return number
|
||||
function baro:get_altitude() end
|
||||
|
||||
-- Check if a baro sensor is healthy
|
||||
---@param instance integer -- the 0-based index of the BARO instance to return.
|
||||
---@return boolean
|
||||
function baro:healthy(instance) end
|
||||
|
||||
|
||||
-- desc
|
||||
---@class serial
|
||||
|
@ -335,6 +335,7 @@ singleton AP_Baro method get_pressure float
|
||||
singleton AP_Baro method get_temperature float
|
||||
singleton AP_Baro method get_external_temperature float
|
||||
singleton AP_Baro method get_altitude float
|
||||
singleton AP_Baro method healthy boolean uint8_t'skip_check
|
||||
|
||||
include AP_OpticalFlow/AP_OpticalFlow.h
|
||||
singleton AP_OpticalFlow depends AP_OPTICALFLOW_ENABLED
|
||||
@ -514,6 +515,8 @@ userdata AP_MotorsMatrix_Scripting_Dynamic::factor_table field throttle'array AP
|
||||
include AP_InertialSensor/AP_InertialSensor.h
|
||||
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 get_accel_health boolean uint8_t'skip_check
|
||||
|
||||
singleton CAN manual get_device lua_get_CAN_device 1
|
||||
singleton CAN manual get_device2 lua_get_CAN_device2 1
|
||||
@ -632,6 +635,15 @@ singleton AP_Winch method release_length void float'skip_check
|
||||
singleton AP_Winch method set_desired_rate void float'skip_check
|
||||
singleton AP_Winch method get_rate_max float
|
||||
|
||||
include AP_IOMCU/AP_IOMCU.h
|
||||
singleton AP_IOMCU depends HAL_WITH_IO_MCU
|
||||
singleton AP_IOMCU rename iomcu
|
||||
singleton AP_IOMCU method healthy boolean
|
||||
|
||||
include AP_Compass/AP_Compass.h
|
||||
singleton Compass rename compass
|
||||
singleton Compass method healthy boolean uint8_t'skip_check
|
||||
|
||||
-- ----EFI Library----
|
||||
include AP_EFI/AP_EFI.h depends HAL_EFI_ENABLED
|
||||
include AP_EFI/AP_EFI_Scripting.h depends AP_EFI_SCRIPTING_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user