-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP_Scripting: Add example script for setting VIDEO_STREAM_INFORMATION
- Loading branch information
1 parent
fdfe295
commit 4164045
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
libraries/AP_Scripting/examples/set_VIDEO_STREAM_INFORMATION.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |