AP_Scripting: Add support for lua scripting based RangeFinder

This commit is contained in:
rishabsingh3003 2023-02-15 12:45:55 +05:30 committed by Peter Barker
parent 52bdca950b
commit c86d2641f1
2 changed files with 38 additions and 0 deletions

View File

@ -1953,11 +1953,40 @@ function terrain:status() end
---@return boolean
function terrain:enabled() end
-- RangeFinder backend
---@class AP_RangeFinder_Backend_ud
local AP_RangeFinder_Backend_ud = {}
-- Send distance to lua rangefinder backend. Returns false if failed
---@param distance number
---@return boolean
function AP_RangeFinder_Backend_ud:handle_script_msg(distance) end
-- Status of this rangefinder instance
---@return integer
function AP_RangeFinder_Backend_ud:status() end
-- Type of rangefinder of this instance
---@return integer
function AP_RangeFinder_Backend_ud:type() end
-- Orintation of the rangefinder of this instance
---@return integer
function AP_RangeFinder_Backend_ud:orientation() end
-- Current distance of the sensor instance
---@return number
function AP_RangeFinder_Backend_ud:distance() end
-- desc
---@class rangefinder
rangefinder = {}
-- get backend based on rangefinder instance provided
---@param rangefinder_instance integer
---@return AP_RangeFinder_Backend_ud
function rangefinder:get_backend(rangefinder_instance) end
-- desc
---@param orientation integer
---@return Vector3f_ud

View File

@ -179,6 +179,13 @@ singleton AP_Proximity method get_closest_object boolean float'Null float'Null
singleton AP_Proximity method get_object_angle_and_distance boolean uint8_t'skip_check float'Null float'Null
include AP_RangeFinder/AP_RangeFinder.h
include AP_RangeFinder/AP_RangeFinder_Backend.h
ap_object AP_RangeFinder_Backend method distance float
ap_object AP_RangeFinder_Backend method orientation Rotation'enum
ap_object AP_RangeFinder_Backend method type uint8_t
ap_object AP_RangeFinder_Backend method status uint8_t
ap_object AP_RangeFinder_Backend method handle_script_msg boolean float'skip_check
singleton RangeFinder rename rangefinder
singleton RangeFinder method num_sensors uint8_t
@ -191,6 +198,8 @@ singleton RangeFinder method status_orient uint8_t Rotation'enum ROTATION_NONE R
singleton RangeFinder method has_data_orient boolean Rotation'enum ROTATION_NONE ROTATION_MAX-1
singleton RangeFinder method get_pos_offset_orient Vector3f Rotation'enum ROTATION_NONE ROTATION_MAX-1
singleton RangeFinder method get_backend AP_RangeFinder_Backend uint8_t'skip_check
include AP_Terrain/AP_Terrain.h
singleton AP_Terrain depends defined(AP_TERRAIN_AVAILABLE) && AP_TERRAIN_AVAILABLE == 1