MAV_CMD_DO_CONTROL_VIDEO 200

Param (:Label)
功能
Description
Values
param1
type
设置视频类型
M3T 1主视频 3 IR M30T 1wide 2 zoom 3 IR
param2
width
视频输出宽度

param3
height
视频输出高度

param4
framerate
帧率

param5
bitrate
码率

param6
status
视频开关
0开始 1停止




返回command = MAV_CMD_REQUEST_MESSAGE
返回值 param1 200 执行命令id
返回值 param2 0或1 是否执行成功
返回值 param3 失败代码(0无异常 1无法获取无人机信息)

python测试脚本

import time
from pymavlink import mavutil

timestamp = int(time.time() * 1000)
millis = int(time.time() * 1000)

master = mavutil.mavlink_connection('udpin:0.0.0.0:14550')
master.wait_heartbeat()
boot_time = time.time()


def control(type, width, height, framerate, bitrate, startOrStop=0):
    master.mav.command_long_send(
        master.target_system,
        master.target_component,
        mavutil.mavlink.MAV_CMD_DO_CONTROL_VIDEO,
        0,
        type, width, height, framerate, bitrate, startOrStop, 0
    )

def stop_streaming():
    master.mav.video_stream_status_send(
        1,
        1,
        0,0,0,0,0,0
    )

# type  1 VIS  3 IR
# width  1920
# height  1080
# framerate  30
# bitrate  4096
# start or stop  0 start  1 stop
control(1, 1920, 1080, 30, 4096)
time.sleep(10)
stop_streaming()
time.sleep(5)
control(3,640,480,20,4096)
time.sleep(30)
control(1, 1920, 1080, 30, 4096)
作者:bai  创建时间:2024-09-14 15:33
最后编辑:bai  更新时间:2024-11-20 18:11