增加口令支持

This commit is contained in:
2025-09-15 21:52:13 +08:00
parent ce963ed7d6
commit 781b490cdc
3 changed files with 109 additions and 4 deletions

View File

@@ -38,6 +38,41 @@
"acceptance_radius": "float, 可选,到达容差半径(米)默认2.0"
}
},
{
"name": "move_direction",
"description": "按指定方向直线移动。方向可为绝对方位或相对机体朝向。",
"params": {
"direction": "string, 取值: 'north'(北), 'south'(南), 'east'(东), 'west'(西), 'forward'(前), 'backward'(后), 'left'(左), 'right'(右)",
"distance": "float, 可选,移动距离(米)[1,10000];缺省表示持续移动,直至外部条件停止"
}
},
{
"name": "orbit_around_point",
"description": "围绕给定中心点等速环绕飞行,可指定圈数与方向。",
"params": {
"center_x": "float, 中心点X坐标(米)",
"center_y": "float, 中心点Y坐标(米)",
"center_z": "float, 中心点Z坐标(米)",
"radius": "float, 轨道半径(米)[5,1000]",
"laps": "int, 环绕圈数[1,20]",
"clockwise": "boolean, 是否顺时针默认true",
"speed_mps": "float, 可选,环绕线速度(米/秒)[0.5,15]",
"gimbal_lock": "boolean, 云台持续指向中心默认true"
}
},
{
"name": "orbit_around_target",
"description": "围绕已获目标等速环绕飞行,可指定圈数与方向。",
"params": {
"target_class": "string, 目标类别",
"description": "string, 可选,目标属性描述",
"radius": "float, 轨道半径(米)[5,1000]",
"laps": "int, 环绕圈数[1,20]",
"clockwise": "boolean, 是否顺时针默认true",
"speed_mps": "float, 可选,环绕线速度(米/秒)[0.5,15]",
"gimbal_lock": "boolean, 云台持续指向目标默认true"
}
},
{
"name": "loiter",
"description": "在当前位置上空悬停一段时间或直到条件触发。",
@@ -323,6 +358,11 @@
- `z` (fly_to_waypoint): [1, 5000]
- `x`, `y` (fly_to_waypoint): [-10000, 10000]
- `radius` (search_pattern): [5, 1000]
- `distance` (move_direction): [1, 10000]
// 环绕动作
- `radius` (orbit_*): [5, 1000]
- `laps` (orbit_*): [1, 20]
- `speed_mps` (orbit_*): [0.5, 15]
- 电池阈值: [0.0, 1.0]
- 等等其他参数范围。
@@ -706,6 +746,49 @@
}
```
#### 9.5 环绕任务范式
所有任务必须包含安全监控。使用以下范式作为模板:
```json
{
"root": {
"type": "Parallel",
"name": "OrbitMission",
"params": {"policy": "all_success"},
"children": [
{
"type": "Sequence",
"name": "MainOrbitTask",
"children": [
{"type": "action", "name": "preflight_checks", "params": {"check_level": "comprehensive"}},
{"type": "action", "name": "takeoff", "params": {"altitude": 15.0}},
{"type": "action", "name": "orbit_around_point", "params": {"center_x": 120.0, "center_y": 80.0, "center_z": 20.0, "radius": 30.0, "laps": 2, "clockwise": true, "gimbal_lock": true}},
{"type": "action", "name": "land", "params": {"mode": "home"}}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {"memory": true},
"children": [
{"type": "condition", "name": "battery_above", "params": {"threshold": 0.35}},
{"type": "condition", "name": "gps_status", "params": {"min_satellites": 8}},
{"type": "Sequence", "name": "EmergencyHandler", "children": [
{"type": "action", "name": "emergency_return", "params": {"reason": "safety_breach"}},
{"type": "action", "name": "land", "params": {"mode": "home"}}
]}
]
}
]
}
}
```
#### 9.6 环绕口令语义说明
- “环绕X米Y圈”以中心坐标或已获目标为圆心半径 X 米,等速环绕 Y 圈;默认 `clockwise:true`、`gimbal_lock:true`。
- 中心选择:有坐标 → 使用 `orbit_around_point`;有目标 → 使用 `orbit_around_target`;若仅给类别且未获目标,需在复杂模式中先完成目标获取(检测/跟踪/确认)。
- 方向与速度:若口令出现“顺时针/逆时针”,映射为 `clockwise:true/false`给出速度“V米每秒”时设置 `speed_mps: V`(范围 [0.5,15]),否则可省略。
- 数字解析:支持中文数字与阿拉伯数字,如“环绕三十两圈”→ `radius:30.0`、`laps:2`。
#### 10. 如何使用参考知识
当用户提供"参考知识"(如坐标信息)时,你必须使用这些信息填充参数。例如:
- 如果参考知识说"目标坐标: (x: 120.5, y: 80.2, z: 60.0)",则在使用`fly_to_waypoint`时设置这些值。