diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index a887c8f095227c..fb206e31a6306a 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -1535,6 +1535,118 @@ function mavlink_camera_information_t_ud:gimbal_device_id(value) end ---@param cam_info mavlink_camera_information_t_ud function camera:set_camera_information(instance, cam_info) end +-- The MAVLink VIDEO_STREAM_INFORMATION message struct +---@class (exact) mavlink_video_stream_information_t_ud +local mavlink_video_stream_information_t_ud = {} + +---@return mavlink_video_stream_information_t_ud +function mavlink_video_stream_information_t() end + +-- get field +---@return number +function mavlink_video_stream_information_t_ud:framerate() end + +-- set field +---@param value number +function mavlink_video_stream_information_t_ud:framerate(value) end + +-- get field +---@return uint32_t_ud +function mavlink_video_stream_information_t_ud:bitrate() end + +-- set field +---@param value uint32_t_ud|integer|number +function mavlink_video_stream_information_t_ud:bitrate(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:flags() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:flags(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:resolution_h() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:resolution_h(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:resolution_v() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:resolution_v(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:rotation() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:rotation(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:hfov() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:hfov(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:stream_id() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:stream_id(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:count() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:count(value) end + +-- get field +---@return integer +function mavlink_video_stream_information_t_ud:type() end + +-- set field +---@param value integer +function mavlink_video_stream_information_t_ud:type(value) end + +-- get array field +---@param index integer +---@return integer +function mavlink_video_stream_information_t_ud:name(index) end + +-- set array field +---@param index integer +---@param value integer +function mavlink_video_stream_information_t_ud:name(index, value) end + +-- get array field +---@param index integer +---@return integer +function mavlink_video_stream_information_t_ud:uri(index) end + +-- set array field +---@param index integer +---@param value integer +function mavlink_video_stream_information_t_ud:uri(index, value) end + +-- Populate the fields of the VIDEO_STREAM_INFORMATION message +---@param instance integer +---@param stream_info mavlink_video_stream_information_t_ud +function camera:set_stream_information(instance, stream_info) end + -- desc mount = {} diff --git a/libraries/AP_Scripting/examples/set_VIDEO_STREAM_INFORMATION.lua b/libraries/AP_Scripting/examples/set_VIDEO_STREAM_INFORMATION.lua new file mode 100644 index 00000000000000..411ddd05ce32f8 --- /dev/null +++ b/libraries/AP_Scripting/examples/set_VIDEO_STREAM_INFORMATION.lua @@ -0,0 +1,33 @@ + --[[ + Populate the fields of the VIDEO_STREAM_INFORMATION message sent by the selected camera instance. + --]] + function set_video_stream_information() + -- set the Video Stream Information data + local stream_info = mavlink_video_stream_information_t() + + local INSTANCE = 0 + local name = 'Video' + local uri = '127.0.0.1:5600' + + stream_info:framerate(30) + stream_info:bitrate(1500) + stream_info:flags(1) -- VIDEO_STREAM_STATUS_FLAGS_RUNNING + stream_info:resolution_h(1920) + stream_info:resolution_v(1080) + stream_info:rotation(0) + stream_info:hfov(50) + stream_info:stream_id(1) + stream_info:count(1) + stream_info:type(1) -- VIDEO_STREAM_TYPE_RTPUDP + for i = 0, #name do + stream_info:name(i, name:byte(i+1)) + end + for i = 0, #uri do + stream_info:uri(i, uri:byte(i+1)) + end + + camera:set_stream_information(INSTANCE, stream_info) + +end + +return set_video_stream_information() \ No newline at end of file diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 4090459ea5a21e..339d1c2a151908 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -785,6 +785,20 @@ userdata mavlink_camera_information_t field lens_id uint8_t'skip_check read writ userdata mavlink_camera_information_t field cam_definition_uri'array 140 uint8_t'skip_check read write userdata mavlink_camera_information_t field gimbal_device_id uint8_t'skip_check read write +userdata mavlink_video_stream_information_t depends AP_CAMERA_ENABLED +userdata mavlink_video_stream_information_t field framerate float'skip_check read write +userdata mavlink_video_stream_information_t field bitrate uint32_t'skip_check read write +userdata mavlink_video_stream_information_t field flags uint16_t'skip_check read write +userdata mavlink_video_stream_information_t field resolution_h uint16_t'skip_check read write +userdata mavlink_video_stream_information_t field resolution_v uint16_t'skip_check read write +userdata mavlink_video_stream_information_t field rotation uint16_t'skip_check read write +userdata mavlink_video_stream_information_t field hfov uint16_t'skip_check read write +userdata mavlink_video_stream_information_t field stream_id uint8_t'skip_check read write +userdata mavlink_video_stream_information_t field count uint8_t'skip_check read write +userdata mavlink_video_stream_information_t field type uint8_t'skip_check read write +userdata mavlink_video_stream_information_t field name'array 32 uint8_t'skip_check read write +userdata mavlink_video_stream_information_t field uri'array 160 uint8_t'skip_check read write + include AP_Camera/AP_Camera.h singleton AP_Camera depends AP_CAMERA_ENABLED && (AP_CAMERA_SCRIPTING_ENABLED == 1) singleton AP_Camera rename camera @@ -804,6 +818,7 @@ userdata AP_Camera::camera_state_t field tracking_p1 Vector2f read userdata AP_Camera::camera_state_t field tracking_p2 Vector2f read singleton AP_Camera method get_state boolean uint8_t'skip_check AP_Camera::camera_state_t'Null singleton AP_Camera method set_camera_information void uint8_t'skip_check mavlink_camera_information_t +singleton AP_Camera method set_stream_information void uint8_t'skip_check mavlink_video_stream_information_t include AP_Winch/AP_Winch.h singleton AP_Winch depends AP_WINCH_ENABLED && APM_BUILD_COPTER_OR_HELI