Files
gofly-platform-services/zlt-business/device-center/doc/指令飞行.md
T
2025-12-11 12:11:48 +08:00

8.4 KiB

指令飞行

websocket发送指令json格式

{
"type": "sub",
"topic": "/device-message-sender/D-Dock2/deviceSn",
"parameter": {
"messageType":"WRITE_PROPERTY",
"properties": {指令json},
"headers":{
"async":false
}
},
"id": "request-id-ceshi123-2222"
}

一键起飞

Topic: /write-property

Direction: down

Method: takeoff_to_point

Data:

Column Name Type constraint Description
target_latitude 目标点纬度 double {"max":90,"min":-90} 目标点纬度,角度值,南纬是负,北纬是正,精度到小数点后6位
target_longitude 目标点经度 double {"max":180,"min":-180} 目标点经度,角度值,东经是正,西经是负,精度到小数点后6位
target_height 目标点高度 float {"max":1500,"min":2,"step":0.1,"unit_name":"米 / m"} 目标点高度(椭球高),使用 WGS84 模型,飞行器到点后默认行为:悬停
security_takeoff_height 安全起飞高度 float {"max":1500,"min":20,"step":0.1,"unit_name":"米 / m"} 相对(机场)起飞点的高度(ALT),飞行器先升到特定的高度,然后再飞向目标点。
rth_mode 返航模式设置值 enum_int {"0":"智能高度","1":"设定高度"} 智能返航模式下,飞行器将自动规划最佳返航高度。大疆机场当前不支持设置返航高度模式,只能选择'设定高度'模式。当环境,光线不满足视觉系统要求时(譬如傍晚阳光直射、夜间弱光无光),飞行器将使用您设定的返航高度进行直线返航
rth_altitude 返航高度 int {"max":1500,"min":2,"step":1,"unit_name":"米 / m"} 相对(机场)起飞点的高度,相对高 ALT
rc_lost_action 遥控器失控动作 enum_int {"0":"悬停","1":"着陆(降落)","2":"返航"} 遥控器失控动作
commander_mode_lost_action 指点飞行失控动作 enum_int {"0":"继续执行指点飞行任务","1":"退出指点飞行任务,执行普通失控行为"}
commander_flight_mode 指点飞行模式设置值 enum_int {"0":"智能高度飞行","1":"设定高度飞行"}
commander_flight_height 指点飞行高度 float {"max":3000,"min":2,"step":0.1,"unit_name":"米 / m"} 相对(机场)起飞点的高度,相对高 ALT
flight_id 一键起飞任务 UUID text 任务 UUID,全局唯一,用于染色,云端区分该值是普通计划任务还是一键起飞任务
max_speed 一键起飞的飞行过程中能达到的最大速度 int {"max":15,"min":1,"unit_name":"米每秒 / m/s"}
simulate_mission 是否在模拟器中执行任务 struct 可选字段,用于在室内进行模拟任务调试。
注意:进行模拟飞行前,请务必取下桨叶,以防舱盖关闭时夹断桨叶。
»is_enable 是否开启模拟器任务 enum_int {"0":"不开启","1":"开启"} 当次任务打开或关闭模拟器
»latitude 纬度 double {"max":"90.0","min":"-90.0"}
»longitude 经度 double {"max":"180.0","min":"-180.0"}
flight_safety_advance_check 飞行安全预检查 bool {"0":"关闭","1":"开启"} 设置一键起飞和航线任务中的飞行安全是否预先检查。此字段为可选,默认为0,值为0表示关闭,1表示开启。飞行安全预先检查表示: 飞行器执行任务前,检查自身作业区文件是否与云端一致,如果不一致则拉取文件更新,如果一致则不处理

Example:

JSON

{  
"method": "takeoff_to_point",  
"data": {  
"data": {  
"rth_altitude": 50,  
"target_latitude": 31.2120679,  
"rth_mode": 1,  
"commander_flight_mode": 1,  
"flight_safety_advance_check": 0,  
"max_speed": 5,  
"security_takeoff_height": 50,  
"flight_id": "ABDEAC21DCADDA",  
"commander_mode_lost_action": 1,  
"target_height": 322.63797,  
"commander_flight_height": 50,  
"rc_lost_action": 2,  
"target_longitude": 110.86967  
}  
}  
}  

一键返航

Topic: /write-property

Direction: down

Method: return_home

Data: null

JSON
{
"data": {
},
"method": "return_home"
}

返航取消

Topic: /write-property

Direction: down

Method: return_home_cancel

Data: null

JSON
{
"data": {
},
"method": "return_home_cancel"
}

航线恢复

Topic: /write-property

Direction: down

Method: flighttask_recovery

Data: null

Example:

JSON
{
"data": {
},
"method": "flighttask_recovery"
}

航线暂停

Topic: /write-property

Direction: down

Method: flighttask_pause

Data: null

Example:

JSON
{
"data": {
},
"method": "flighttask_pause"
}

进入指令飞行模式

Topic: /write-property

Direction: down

Method: drc_mode_enter

Data: null

Example:

JSON
{
"data": {
},
"method": "drc_mode_enter"
}

负载控制—画面拖动控制

Topic: /write-property

Direction: down

Method: camera_screen_drag

Data:

Column Name Type constraint Description
locked 机头和云台的相对关系是否锁定 bool {"false":"仅云台转,机身不转","true":"锁定机头,云台和机身一起转"}
pitch_speed 云台 pitch 速度 double {"unit_name":"度每秒 / degree/s"} 云台 pitch 速度
yaw_speed 云台 yaw 速度 double {"unit_name":"度每秒 / degree/s"} 云台 yaw 速度,仅不锁机头时才生效

Example:

JSON
{
"data": {
"pitch_speed": 10,
"yaw_speed": -10,
"locked": false
},
"method": "stick_control"
}

切换相机模式

Topic: /write-property

Direction: down

Method: camera_mode_switch

Data:

Column Name Type constraint Description
camera_mode 相机模式 enum_int {"0":"拍照","1":"录像","2":"智能低光","3":"全景拍照"}

Example:

JSON
{
"data": {
"camera_mode": 0,
},
"method": "camera_mode_switch"
}

开始拍照

Topic: /write-property

Direction: down

Method: camera_photo_take

Data: null

Example:

JSON
{
"data": {
},
"method": "camera_photo_take"
}

开始录像

Topic: /write-property

Direction: down

Method: camera_recording_start

Data: null

Example:

JSON
{
"data": {
},
"method": "camera_recording_start"
}

停止录像

Topic: /write-property

Direction: down

Method: camera_recording_stop

Data: null

Example:

JSON
{
"data": {
},
"method": "camera_recording_stop"
}

DRC-杆量控制

建立DRC链路之后,可通过“DRC-杆量控制”指令控制飞行器和云台姿态。发送频率需要保持5-10hz,才能比较精准地控制飞行器的运动。本协议无回包机制。

Topic: /write-property

Direction: down

Method: stick_control

Data:

Column Name Type constraint Description remark
roll 横滚通道 int {"max":"1424","min":"624","unit_name":""} 对应遥控器A通道,控制飞行器横滚(表现为左右平移)。杆量范围[1024±400],1024为中值(无动作),数值增大表示向右倾斜,减小表示向左倾斜。 >1074判定为1424 <974判定为624,每次下发持续10s
pitch 俯仰通道 int {"max":"1424","min":"624","unit_name":""} 对应遥控器E通道,控制飞行器俯仰(表现为前后平移)。杆量范围[1024±400]**,1024为中值(无动作),数值增大表示向前俯冲,减小表示向后抬头。 >1074判定为1424 <974判定为624,每次下发持续10s
throttle 升降通道 int {"max":"1424","min":"624","unit_name":""} 对应遥控器T通道,控制飞行器升降。杆量范围[1024±400],1024为悬停状态,数值增大表示升高,减小表示降低。 >1074判定为1424 <974判定为624,每次下发持续10s
yaw 偏航通道 int {"max":"1424","min":"624","unit_name":""} 对应遥控器R通道,控制飞行器偏航(表现为左右旋转)。杆量范围[1024±400],1024为中值(无动作),数值增大表示顺时针旋转,减小表示逆时针旋转。 >1074判定为1424 <974判定为624,每次下发持续10s

JSON
{
"data": {
"roll": 1024,
"pitch": 1024,
"throttle": 1024,
"yaw": 1024
},
"method": "stick_control"
}