跳到主要内容

自定义飞行区

接口变更说明​

本章接口为 Autel Nest2 新增,EVO Nest 不提供。

自定义飞行区用于圈定飞行器允许作业的地理范围。

同步链路:云端下发更新指令 → 机巢请求飞行区文件列表 → 机巢下载文件并推送到飞行器 → 机巢上报同步状态。飞行过程中,机巢持续上报飞行器与飞行区边界的位置关系。

自定义飞行区文件名固定为 fence.yaml。

点击下载自定义飞行区模板文件:自定义飞行区文件协议模板

Event​

自定义飞行区告警信息推送​

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: flight_areas_drone_location

Data:

ColumnNameTypeconstraintDescription
drone_locations飞行器自定义飞行区距离信息array{"size":"-","item_type":"struct"}飞行器与各自定义飞行区的位置关系列表
»area_id飞行区 IDtext自定义飞行区的唯一标识
»area_distance距离飞行边界距离float{"unit_name":"米 / m"}飞行器到该飞行区边界的距离
»is_in_area是否在自定义飞行区内booltrue 表示飞行器位于该飞行区内部

说明:

  • 每 2 秒评估一次,仅在飞行器飞行中上报;在舱、离线或遥测数据过期时不上报。
  • 仅上报「在飞行区内」或「距边界小于近区阈值」的飞行区,无匹配时不发报文。
  • need_reply 为 0,云端无需回复。

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"drone_locations": [
{
"area_distance": 100.11,
"area_id": "d275c4e1-d864-4736-8b5d-5f5882ee9bdd",
"is_in_area": true
}
]
},
"method": "flight_areas_drone_location",
"need_reply": 0,
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

自定义飞行区文件同步状态​

上报飞行区文件从云端同步到设备端的进展。

Topic: thing/product/{gateway_sn}/events

Direction: up

Method: flight_areas_sync_progress

Data:

ColumnNameTypeconstraintDescription
status同步状态enum_string{"wait_sync":"待同步","synchronizing":"同步中","synchronized":"已同步","fail":"失败","switch_fail":"使能开关失败"}飞行区文件的同步状态
reason返回码int{"0":"成功","1":"解析云端返回的文件信息失败","2":"获取飞行器端文件信息失败","3":"从云端下载文件失败","4":"链路翻转失败","5":"传输文件失败","6":"disable 失败","7":"自定义飞行区删除失败","8":"飞行器端加载作业区域数据失败","9":"enable 失败","10":"机巢增强图传无法关闭,作业区域数据同步失败","11":"飞行器开机失败,无法同步作业区域数据","12":"checksum 校验失败","13":"同步异常超时"}非 0 代表错误
file自定义飞行区文件struct本次同步的飞行区文件信息
»name自定义飞行区文件名称text飞行区文件名
»checksum文件签名摘要text文件 SHA256 签名;清空飞行区时该字段为空字符串

说明:

  • 飞行器离线或飞行中时,机巢先把文件下载到本地并上报 wait_sync,推送延后到下次起飞前执行,不算失败。
  • 清空飞行区时同样上报本事件,file.checksum 为空字符串。

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"file": {
"checksum": "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4",
"name": "fence.yaml"
},
"reason": 0,
"status": "synchronized"
},
"method": "flight_areas_sync_progress",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Service​

自定义飞行区更新指令​

飞行区数据变更后下发该指令。机巢收到后立即回复,并发起 flight_areas_get 请求拉取最新文件列表。

Topic: thing/product/{gateway_sn}/services

Direction: down

Method: flight_areas_update

Data: null

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": null,
"method": "flight_areas_update",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Topic: thing/product/{gateway_sn}/services_reply

Direction: up

Method: flight_areas_update

Data:

ColumnNameTypeconstraintDescription
result返回码int非 0 代表错误

说明: 该回复仅表示指令已接收,同步结果通过 flight_areas_sync_progress 事件上报。

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"result": 0
},
"method": "flight_areas_update",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Requests​

自定义飞行区文件获取​

机巢在收到 flight_areas_update 指令后、或 MQTT 订阅就绪后发起该请求,拉取云端当前的飞行区文件列表。

Topic: thing/product/{gateway_sn}/requests

Direction: up

Method: flight_areas_get

Data: null

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {},
"method": "flight_areas_get",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}

Topic: thing/product/{gateway_sn}/requests_reply

Direction: down

Method: flight_areas_get

Data:

ColumnNameTypeconstraintDescription
result返回码int非 0 代表错误
output输出struct飞行区文件列表的返回结果
»files自定义飞行区文件列表,没有自定义飞行区则为空数组array{"size":"-","item_type":"struct"}云端当前的飞行区文件列表
»»name文件名text飞行区文件名
»»url文件 URLtext文件下载地址,仅支持 http:// 与 https://
»»checksum文件签名摘要text文件 SHA256 签名
»»size文件大小int{"unit_name":"字节 / byte"}文件字节数

说明:

  • 机巢收到回复即下载文件,下载地址必须在回复时刻仍然有效。
  • files 为空数组表示删除机巢与飞行器上的全部自定义飞行区。
  • 列表中存在无效下载地址时,机巢丢弃整批文件,避免飞行区只同步一部分。

Example:

{
"bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"data": {
"output": {
"files": [
{
"checksum": "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4",
"name": "fence.yaml",
"size": 500,
"url": "https://storage.example.com/flight-area/fence.yaml?expires=1654074568&signature=xxxxxxxx"
}
]
},
"result": 0
},
"method": "flight_areas_get",
"tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"timestamp": 1654070968655
}