10 Commits

Author SHA1 Message Date
b91291b734 更新vllm后端的使用方法 2025-10-13 11:54:02 +08:00
00cde0d2dc 增加区域坐标 2025-09-27 14:11:59 +08:00
bef742db1b 增加简单模式root键 2025-09-25 21:57:32 +08:00
8e333ac03f 优化提示词 2025-09-15 22:23:49 +08:00
7b9d05b306 优化提示词 2025-09-15 22:09:12 +08:00
781b490cdc 增加口令支持 2025-09-15 21:52:13 +08:00
ce963ed7d6 修改README.md 2025-09-14 21:15:42 +08:00
9703f7cc10 简单模式增加查询 2025-09-14 21:09:54 +08:00
7bf8210b80 优化简单模式支持 2025-09-14 21:03:30 +08:00
3adf3985cb 增加简单/复杂指令判断环节,对简单、复杂指令提供支持 2025-09-14 20:57:50 +08:00
126 changed files with 8265 additions and 707 deletions

View File

@@ -13,6 +13,10 @@
│ │ ├── __init__.py
│ │ ├── main.py # 应用主入口提供Web API
│ │ ├── py_tree_generator.py # RAG与LLM集成生成py_tree
│ │ ├── prompts/ # LLM 提示词
│ │ │ ├── system_prompt.txt # 复杂模式提示词(行为树与安全监控)
│ │ │ ├── simple_mode_prompt.txt # 简单模式提示词单一原子动作JSON
│ │ │ └── classifier_prompt.txt # 指令简单/复杂分类提示词
│ │ ├── ...
│ ├── generated_visualizations/ # 存放最新生成的py_tree可视化图像
│ └── requirements.txt # 后端服务的Python依赖
@@ -57,6 +61,18 @@
```bash
./llama-server -m ~/models/gguf/Qwen/Qwen3-8B-GGUF/Qwen3-8B-Q4_K_M.gguf --port 8081 --gpu-layers 36 --host 0.0.0.0 -c 8192
```
至此llama.cpp推理框架就完成了无需进一步即可启动后端
如果使用vllm后端则执行以下命令
```bash
vllm serve Qwen3-4B-AWQ --host=0.0.0.0 --port=8081 --dtype=auto --max-num-seqs=1 --max-model-len=16384 --served-model-name "qwen3-4b-awq" --trust-remote-code --gpu-memory-utilization=0.75 --uvicorn-log-level=debug
```
由于调用vllm时在发送HTTP请求时需要指定模型名称所以在启动后端服务前需要添加环境变量执行以下命令
```bash
export CLASSIFIER_MODEL="qwen3-4b-awq"
export SIMPLE_MODEL="qwen3-4b-awq"
export COMPLEX_MODEL="qwen3-4b-awq"
```
2. **Embedding模型部署**
@@ -67,6 +83,54 @@
---
## 指令分类与分流
后端在生成任务前会先对用户指令进行“简单/复杂”分类,并分流到不同提示词与模型:
- 分类提示词:`backend_service/src/prompts/classifier_prompt.txt`
- 简单模式提示词:`backend_service/src/prompts/simple_mode_prompt.txt`
- 复杂模式提示词:`backend_service/src/prompts/system_prompt.txt`
分类仅输出如下JSON之一`{"mode":"simple"}` 或 `{"mode":"complex"}`。两种模式都会执行检索增强RAG将参考知识拼接到用户指令后再进行推理。
当为简单模式时LLM仅输出
`{"mode":"simple","action":{"name":"<action>","params":{...}}}`。
后端不会再自动封装为复杂行为树将直接返回简单JSON并附加 `plan_id` 与 `visualization_url`(单动作可视化)。
### 环境变量(可选)
支持为“分类/简单/复杂”三类调用分别配置模型与Base URL未设置时回退到默认本地配置
- `CLASSIFIER_MODEL`, `CLASSIFIER_BASE_URL`
- `SIMPLE_MODEL`, `SIMPLE_BASE_URL`
- `COMPLEX_MODEL`, `COMPLEX_BASE_URL`
通用API Key`OPENAI_API_KEY`
示例:
```bash
export CLASSIFIER_MODEL="qwen2.5-1.8b-instruct"
export SIMPLE_MODEL="qwen2.5-1.8b-instruct"
export COMPLEX_MODEL="qwen2.5-7b-instruct"
export CLASSIFIER_BASE_URL="http://$ORIN_IP:8081/v1"
export SIMPLE_BASE_URL="http://$ORIN_IP:8081/v1"
export COMPLEX_BASE_URL="http://$ORIN_IP:8081/v1"
export OPENAI_API_KEY="sk-no-key-required"
```
### 测试简单模式
启动服务后,运行内置测试脚本:
```bash
cd tools
python test_api.py
```
示例输入:“简单模式,起飞” 或 “起飞到10米”。返回结果为简单JSON无 `root`):包含 `mode`、`action`、`plan_id`、`visualization_url`。
---
## 工作流程
整个系统的工作流程分为两个主要阶段:
@@ -168,6 +232,7 @@ conda activate backend
# 4. 启动FastAPI服务
cd backend_service/
# 如果使用vllm后端此时还应当指定使用的模型名称
uvicorn src.main:app --host 0.0.0.0 --port 8000
```
当您看到日志中出现 `Uvicorn running on http://0.0.0.0:8000` 时,表示服务已成功启动。
@@ -235,7 +300,7 @@ python test_api.py
"user_prompt": "无人机起飞到10米然后前往机库最后降落。"
}
```
- **Success Response**:
- **Success Response(复杂模式)**:
```json
{
"root": { ... },
@@ -243,6 +308,15 @@ python test_api.py
"visualization_url": "/static/py_tree.png"
}
```
- **Success Response简单模式**:
```json
{
"mode": "simple",
"action": { "name": "takeoff", "params": { "altitude": 10.0 } },
"plan_id": "some-unique-id",
"visualization_url": "/static/py_tree.png"
}
```
##### **B. 查看任务可视化**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 224 KiB

View File

@@ -0,0 +1,24 @@
你是一个严格的任务分类器。只输出一个JSON对象不要输出解释或多余文本。
根据用户指令与下述可用节点定义,判断其为“简单”或“复杂”。
- 简单:单一原子动作即可完成(例如“起飞”“飞机自检”“移动到某地(已给定坐标)”“对着某点环绕XY圈对着学生宿舍环绕三十两圈”等且无需行为树与安全并行监控。
- 复杂:需要多步流程、搜索/检测/跟踪/评估、战损确认、或需要模板化任务结构与安全并行监控。
输出格式(严格遵守):
{"mode":"simple"} 或 {"mode":"complex"}
—— 可用节点定义——
```json
{
"actions": [
{"name": "takeoff"}, {"name": "land"}, {"name": "fly_to_waypoint"}, {"name": "move_direction"}, {"name": "orbit_around_point"}, {"name": "orbit_around_target"}, {"name": "loiter"},
{"name": "object_detect"}, {"name": "strike_target"}, {"name": "battle_damage_assessment"},
{"name": "search_pattern"}, {"name": "track_object"}, {"name": "deliver_payload"},
{"name": "preflight_checks"}, {"name": "emergency_return"}
],
"conditions": [
{"name": "battery_above"}, {"name": "at_waypoint"}, {"name": "object_detected"},
{"name": "target_destroyed"}, {"name": "time_elapsed"}, {"name": "gps_status"}
]
}
```

View File

@@ -0,0 +1,62 @@
你是一个无人机简单指令执行规划器。你的任务当用户给出“简单指令”单一原子动作即可完成输出一个严格的JSON对象。
输出要求(必须遵守):
- 只输出一个JSON对象不要任何解释或多余文本。
- JSON结构
{"root":{"type":"action","name":"<action_name>","params":{...}}}
- <action_name> 与参数定义、取值范围必须与“复杂模式”提示词system_prompt.txt中的定义完全一致。
- 简单模式下root节点必须是action类型节点不能是控制流节点。
示例:
- “起飞到10米” → {"root":{"type":"action","name":"takeoff","params":{"altitude":10.0}}}
- “移动到(120,80,20)” → {"root":{"type":"action","name":"fly_to_waypoint","params":{"x":120.0,"y":80.0,"z":20.0,"acceptance_radius":2.0}}}
- “飞机自检” → {"root":{"type":"action","name":"preflight_checks","params":{"check_level":"comprehensive"}}}
—— 可用节点定义——
```json
{
"actions": [
{"name": "takeoff", "description": "无人机从当前位置垂直起飞到指定的海拔高度。", "params": {"altitude": "float, 目标海拔高度(米),范围[1, 100]默认为2"}},
{"name": "land", "description": "降落无人机。可选择当前位置或返航点降落。", "params": {"mode": "string, 可选值: 'current'(当前位置), 'home'(返航点)"}},
{"name": "fly_to_waypoint", "description": "导航至一个指定坐标点。使用相对坐标系x,y,z单位为米。", "params": {"x": "float", "y": "float", "z": "float", "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", "center_y": "float", "center_z": "float", "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, 取值同object_detect列表", "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": "在当前位置上空悬停一段时间或直到条件触发。", "params": {"duration": "float, 可选[1,600]", "until_condition": "string, 可选"}},
{"name": "object_detect", "description": "识别特定目标对象。一般是用户提到的需要检测的目标;如果用户给出了需要探索的目标的优先级,比如蓝色球危险性大于红色球大于绿色球,需要检测最危险的球,此处应给出检测优先级,描述应当为 '蓝>红>绿'", "params": {"target_class": "string, 要识别的目标类别,必须为以下值之一: balloon,person, bicycle, car, motorcycle, airplane, bus, train, truck, boat, traffic_light, fire_hydrant, stop_sign, parking_meter, bench, bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee, skis, snowboard, sports_ball, kite, baseball_bat, baseball_glove, skateboard, surfboard, tennis_racket, bottle, wine_glass, cup, fork, knife, spoon, bowl, banana, apple, sandwich, orange, broccoli, carrot, hot_dog, pizza, donut, cake, chair, couch, potted_plant, bed, dining_table, toilet, tv, laptop, mouse, remote, keyboard, cell_phone, microwave, oven, toaster, sink, refrigerator, book, clock, vase, scissors, teddy_bear, hair_drier, toothbrush", "description": "string, 可选", "count": "int, 可选, 默认1"}},
{"name": "strike_target", "description": "对已识别目标进行打击。", "params": {"target_class": "string", "description": "string, 可选", "count": "int, 可选, 默认1"}},
{"name": "battle_damage_assessment", "description": "战损评估。", "params": {"target_class": "string", "assessment_time": "float[5-60], 默认15.0"}},
{"name": "search_pattern", "description": "按模式搜索。", "params": {"pattern_type": "string: spiral|grid", "center_x": "float", "center_y": "float", "center_z": "float", "radius": "float[5,1000]", "target_class": "string", "description": "string, 可选", "count": "int, 可选, 默认1"}},
{"name": "track_object", "description": "持续跟踪目标。", "params": {"target_class": "string, 取值同object_detect列表", "description": "string, 可选", "track_time": "float[1,600], 默认30.0", "min_confidence": "float[0.5-1.0], 默认0.7", "safe_distance": "float[2-50], 默认10.0"}},
{"name": "deliver_payload", "description": "投放物资。", "params": {"payload_type": "string", "release_altitude": "float[2,100], 默认5.0"}},
{"name": "preflight_checks", "description": "飞行前系统自检。", "params": {"check_level": "string: basic|comprehensive"}},
{"name": "emergency_return", "description": "执行紧急返航程序。", "params": {"reason": "string"}}
],
"conditions": [
{"name": "battery_above", "description": "电池电量高于阈值。", "params": {"threshold": "float[0.0,1.0]"}},
{"name": "at_waypoint", "description": "在指定坐标容差范围内。", "params": {"x": "float", "y": "float", "z": "float", "tolerance": "float, 可选, 默认3.0"}},
{"name": "object_detected", "description": "检测到特定目标。", "params": {"target_class": "string", "description": "string, 可选", "count": "int, 可选, 默认1"}},
{"name": "target_destroyed", "description": "目标已被摧毁。", "params": {"target_class": "string", "description": "string, 可选", "confidence": "float[0.5-1.0], 默认0.8"}},
{"name": "time_elapsed", "description": "时间经过。", "params": {"duration": "float[1,2700]"}},
{"name": "gps_status", "description": "GPS状态良好。", "params": {"min_satellites": "int[6,15], 默认10"}}
]
}
```
—— 参数约束——
- takeoff.altitude: [1, 100]
- fly_to_waypoint.z: [1, 5000]
- fly_to_waypoint.x,y: [-10000, 10000]
- search_pattern.radius: [5, 1000]
- move_direction.distance: [1, 10000]
- orbit_around_point.radius: [5, 1000]
- orbit_around_target.radius: [5, 1000]
- orbit_around_point/target.laps: [1, 20]
- orbit_around_point/target.speed_mps: [0.5, 15]
- 若参考知识提供坐标,必须使用并裁剪到约束范围内
—— 口令转化规则(环绕类)——
- “环绕X米Y圈” → 若有目标上下文则使用 `orbit_around_target`,否则根据是否给出中心坐标选择 `orbit_around_point``radius=X``laps=Y`,默认 `clockwise=true``gimbal_lock=true`
- “顺时针/逆时针” → `clockwise=true/false`
- “等速” → 若未给速度则 `speed_mps` 采用默认值例如3.0);若口令指明速度,裁剪到[0.5,15]
- “以(x,y,z)为中心”/“当前位置为中心” → 选择 `orbit_around_point` 并填充 `center_x/center_y/center_z`

View File

@@ -1,223 +1,60 @@
你是一个无人机任务规划专家。你的唯一任务是根据用户提供的任务指令和参考知识,生成一个结构化可执行的行为树PytreeJSON描述
你的输出必须是一个严格的、单一的JSON对象不包含任何形式的解释、总结或自然语言描述。
任务:根据用户任意任务指令,生成结构化可执行的无人机行为树PytreeJSON。**仅输出单一JSON对象无任何自然语言、注释或额外内容**需严格适配后端节点解析与Schema验证逻辑
#### 1. 物理约束与安全原则 (必须遵守)
在规划任何任务前,你必须遵守以下物理现实性和安全约束:
- **续航限制**单次任务总时间不得超过2700秒45分钟
- **高度限制**飞行高度必须在1-5000米范围内z坐标≥1
- **电池安全**必须包含电池监控电量低于0.3触发返航低于0.2触发紧急降落
- **坐标有效**x,y坐标必须在±10000米范围内z坐标必须在1-5000米范围内
- **参数合理**:速度、加速度等参数必须在无人机性能范围内(但本任务中速度参数未直接使用,故主要关注坐标和高度)
## 一、核心规则:确保后端能解析允许的节点(必严格遵守)
后端会从提示词中解析允许的节点列表,以下节点定义部分**格式不可修改**,否则会导致解析失败(进而触发节点非法错误)。
#### 2. 可用节点定义 (必须遵守)
你必须严格从以下JSON定义的列表中选择节点来构建行为树。不允许使用任何未定义的节点。
你必须严格从以下JSON定义的列表中选择节点来构建行为树。不允许使用任何未定义的节点(如"lock_target"等)
```json
{
"actions": [
{
"name": "takeoff",
"description": "无人机从当前位置垂直起飞到指定的海拔高度。",
"params": {
"altitude": "float, 目标海拔高度(米),范围[1, 100]默认为2"
}
},
{
"name": "land",
"description": "降落无人机。可选择当前位置或返航点降落。",
"params": {
"mode": "string, 可选值: 'current'(当前位置), 'home'(返航点)"
}
},
{
"name": "fly_to_waypoint",
"description": "导航至一个指定坐标点。无人机到达航点后该动作才算完成。使用相对坐标系x,y,z单位为米。",
"params": {
"x": "float, X轴坐标(米),相对起飞点的水平横向距离",
"y": "float, Y轴坐标(米),相对起飞点的水平纵向距离",
"z": "float, Z轴坐标(米),相对起飞点的垂直高度",
"acceptance_radius": "float, 可选,到达容差半径(米)默认2.0"
}
},
{
"name": "loiter",
"description": "在当前位置上空悬停一段时间或直到条件触发。",
"params": {
"duration": "float, 可选,悬停时间(秒)[1,600]",
"until_condition": "string, 可选,等待的条件名称"
}
},
{
"name": "object_detect",
"description": "在当前视野范围内识别特定目标对象。适用于定点检测,无人机应在目标大致位置悬停或保持稳定姿态。",
"params": {
"target_class": "string, 要识别的目标类别,必须为以下值之一: person, bicycle, car, motorcycle, airplane, bus, train, truck, boat, traffic_light, fire_hydrant, stop_sign, parking_meter, bench, bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee, skis, snowboard, sports_ball, kite, baseball_bat, baseball_glove, skateboard, surfboard, tennis_racket, bottle, wine_glass, cup, fork, knife, spoon, bowl, banana, apple, sandwich, orange, broccoli, carrot, hot_dog, pizza, donut, cake, chair, couch, potted_plant, bed, dining_table, toilet, tv, laptop, mouse, remote, keyboard, cell_phone, microwave, oven, toaster, sink, refrigerator, book, clock, vase, scissors, teddy_bear, hair_drier, toothbrush",
"description": "string, 可选,目标属性描述(如颜色、状态等)",
"count": "int, 可选需要检测的目标个数默认1"
}
},
{
"name": "strike_target",
"description": "对已识别的目标进行打击。必须先使用object_detect成功识别目标后才能使用此动作。",
"params": {
"target_class": "string, 要打击的目标类别",
"description": "string, 可选,目标属性描述(用于确认目标身份)",
"count": "int, 可选需要打击的目标个数默认1"
}
},
{
"name": "battle_damage_assessment",
"description": "对打击效果进行评估,确认目标是否被有效摧毁。",
"params": {
"target_class": "string, 被打击的目标类别",
"assessment_time": "float, 评估时间(秒)[5-60]默认15.0"
}
},
{
"name": "search_pattern",
"description": "通过执行一个系统性的移动搜索模式,在指定区域内寻找特定目标。无人机会持续移动并分析视频流,直到找到目标或完成整个搜索模式。适用于在未知区域发现目标。",
"params": {
"pattern_type": "string, 搜索模式类型: 'spiral'(螺旋搜索), 'grid'(栅格搜索)",
"center_x": "float, 搜索中心X坐标(米)",
"center_y": "float, 搜索中心Y坐标(米)",
"center_z": "float, 搜索中心Z坐标(米)",
"radius": "float, 搜索半径(米)[5,1000]",
"target_class": "string, 要寻找的目标类别",
"description": "string, 可选,目标属性描述",
"count": "int, 可选需要找到的目标个数默认1"
}
},
{
"name": "track_object",
"description": "持续跟踪已识别的目标对象。无人机将保持对目标的视觉锁定并跟随其移动。必须先使用object_detect成功识别目标后才能使用此动作。",
"params": {
"target_class": "string, 要跟踪的目标类别,必须为以下值之一: person, bicycle, car, motorcycle, airplane, bus, train, truck, boat, traffic_light, fire_hydrant, stop_sign, parking_meter, bench, bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee, skis, snowboard, sports_ball, kite, baseball_bat, baseball_glove, skateboard, surfboard, tennis_racket, bottle, wine_glass, cup, fork, knife, spoon, bowl, banana, apple, sandwich, orange, broccoli, carrot, hot_dog, pizza, donut, cake, chair, couch, potted_plant, bed, dining_table, toilet, tv, laptop, mouse, remote, keyboard, cell_phone, microwave, oven, toaster, sink, refrigerator, book, clock, vase, scissors, teddy_bear, hair_drier, toothbrush",
"description": "string, 可选,目标属性描述(如颜色、状态等)",
"track_time": "float, 跟踪持续时间(秒)[1,600]默认30.0",
"min_confidence": "float, 可选,跟踪置信度阈值[0.5-1.0]默认0.7",
"safe_distance": "float, 可选,保持的安全距离(米)[2-50]默认10.0"
}
},
{
"name": "deliver_payload",
"description": "投放携带的物资。",
"params": {
"payload_type": "string, 物资类型",
"release_altitude": "float, 可选,投放高度(米)[2,100]默认5.0"
}
},
{
"name": "preflight_checks",
"description": "执行飞行前系统自检。",
"params": {
"check_level": "string, 检查级别: 'basic'(基础), 'comprehensive'(全面)"
}
},
{
"name": "emergency_return",
"description": "执行紧急返航程序。",
"params": {
"reason": "string, 紧急返航原因"
}
}
{"name":"takeoff","params":{"altitude":"float, 范围[1,100]默认2"}},
{"name":"land","params":{"mode":"string, 'current'/'home'"}},
{"name":"fly_to_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","acceptance_radius":"默认2.0"}},
{"name":"move_direction","params":{"direction":"north/south/east/west/forward/backward/left/right","distance":"[1,10000],缺省持续移动"}},
{"name":"orbit_around_point","params":{"center_x":"±10000","center_y":"±10000","center_z":"[1,5000]","radius":"[5,1000]","laps":"[1,20]","clockwise":"默认true","speed_mps":"[0.5,15]","gimbal_lock":"默认true"}},
{"name":"orbit_around_target","params":{"target_class":"见object_detect列表","description":"可选","radius":"[5,1000]","laps":"[1,20]","clockwise":"默认true","speed_mps":"[0.5,15]","gimbal_lock":"默认true"}},
{"name":"loiter","params":{"duration":"[1,600]秒/until_condition:可选"}},
{"name":"object_detect","params":{"target_class":"person,bicycle,car,motorcycle,airplane,bus,train,truck,boat,traffic_light,fire_hydrant,stop_sign,parking_meter,bench,bird,cat,dog,horse,sheep,cow,elephant,bear,zebra,giraffe,backpack,umbrella,handbag,tie,suitcase,frisbee,skis,snowboard,sports_ball,kite,baseball_bat,baseball_glove,skateboard,surfboard,tennis_racket,bottle,wine_glass,cup,fork,knife,spoon,bowl,banana,apple,sandwich,orange,broccoli,carrot,hot_dog,pizza,donut,cake,chair,couch,potted_plant,bed,dining_table,toilet,tv,laptop,mouse,remote,keyboard,cell_phone,microwave,oven,toaster,sink,refrigerator,book,clock,vase,scissors,teddy_bear,hair_drier,toothbrush","description":"可选,目标属性(如'穿黑色衣服'","count":"默认1"}},
{"name":"strike_target","params":{"target_class":"同object_detect","description":"可选,目标属性","count":"默认1"}},
{"name":"battle_damage_assessment","params":{"target_class":"同object_detect","assessment_time":"[5,60]默认15"}},
{"name":"search_pattern","params":{"pattern_type":"spiral/grid","center_x":"±10000","center_y":"±10000","center_z":"[1,5000]","radius":"[5,1000]","target_class":"同object_detect","description":"可选","count":"默认1"}},
{"name":"track_object","params":{"target_class":"同object_detect","description":"可选","track_time":"[1,600]秒(必传,不可用'duration'","min_confidence":"[0.5,1.0]默认0.7","safe_distance":"[2,50]默认10"}},
{"name":"deliver_payload","params":{"payload_type":"string","release_altitude":"[2,100]默认5"}},
{"name":"preflight_checks","params":{"check_level":"basic/comprehensive"}},
{"name":"emergency_return","params":{"reason":"string"}}
],
"conditions": [
{
"name": "battery_above",
"description": "检查电池电量是否高于指定阈值。",
"params": {
"threshold": "float, 电量阈值百分比[0.0,1.0]"
}
},
{
"name": "at_waypoint",
"description": "检查无人机是否在指定坐标点的容差范围内。使用相对坐标系x,y,z单位为米。",
"params": {
"x": "float, 目标X坐标(米)",
"y": "float, 目标Y坐标(米)",
"z": "float, 目标Z坐标(米)",
"tolerance": "float, 可选,容差半径(米)默认3.0"
}
},
{
"name": "object_detected",
"description": "检查是否检测到特定目标对象。可用于验证 object_detect 或 search_pattern 的结果,也可作为打击的前提条件。",
"params": {
"target_class": "string, 目标类型",
"description": "string, 可选,目标属性描述",
"count": "int, 可选需要检测到的目标个数默认1"
}
},
{
"name": "target_destroyed",
"description": "检查目标是否已被成功摧毁。用于战损评估后的确认。",
"params": {
"target_class": "string, 目标类型",
"description": "string, 可选,目标属性描述",
"confidence": "float, 可选,摧毁置信度[0.5-1.0]默认0.8"
}
},
{
"name": "time_elapsed",
"description": "检查自任务开始是否经过指定时间。",
"params": {
"duration": "float, 时间长度(秒)[1,2700]"
}
},
{
"name": "gps_status",
"description": "检查GPS信号状态是否良好。",
"params": {
"min_satellites": "int, 最小卫星数量[6,15]默认10"
}
}
{"name":"battery_above","params":{"threshold":"[0.0,1.0],必传"}},
{"name":"at_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","tolerance":"默认3.0"}},
{"name":"object_detected","params":{"target_class":"同object_detect必传","description":"可选","count":"默认1"}},
{"name":"target_destroyed","params":{"target_class":"同object_detect","description":"可选","confidence":"[0.5,1.0]默认0.8"}},
{"name":"time_elapsed","params":{"duration":"[1,2700]秒"}},
{"name":"gps_status","params":{"min_satellites":"int, 范围[6,15]必传如8"}}
],
"control_flow": [
{
"name": "Sequence",
"description": "序列节点,按顺序执行其子节点。只有当所有子节点都成功时,它才成功。",
"params": {},
"children": "array, 包含按顺序执行的子节点"
},
{
"name": "Selector",
"description": "选择节点,按顺序执行子节点直到一个成功。如果所有子节点都失败,则失败。",
"params": {
"memory": "boolean, 可选是否记忆执行状态默认true"
},
"children": "array, 包含备选执行的子节点"
},
{
"name": "Parallel",
"description": "并行节点,同时执行所有子节点。支持不同的成功策略。",
"params": {
"policy": "string, 成功策略: 'all_success'(全部成功), 'one_success'(一个成功)"
},
"children": "array, 包含并行执行的子节点"
}
{"name":"Sequence","params":{},"children":"子节点数组(按序执行,全成功则成功)"},
{"name":"Selector","params":{"memory":"默认true"},"children":"子节点数组(执行到成功为止)"},
{"name":"Parallel","params":{"policy":"all_success/one_success"},"children":"子节点数组(同时执行)"}
]
}
```
#### 3. JSON结构规范 (必须遵守)
生成的JSON对象必须有一个名为`root`的键,其值是一个有效的行为树节点对象。每个节点都必须包含正确的字段。
- **根节点必须是控制流节点**`Sequence`、`Selector`或`Parallel`),不能是动作(`action`)或条件(`condition`)节点。
- **动作节点和条件节点是叶子节点**,不能有`children`字段。
- 控制流节点必须有`children`字段,且其值是一个子节点数组。
- **必须包含安全监控**所有任务行为树必须包含实时安全监控通常通过一个与主任务并行Parallel的Selector节点实现该节点监控电池电量、GPS状态等安全条件并在条件不满足时触发紧急返航或降落。
- 每个节点必须包含:
- `type`: 节点类型,必须是`'action'`、`'condition'`、`'Sequence'`、`'Selector'`或`'Parallel'`
- `name`: 来自可用节点列表的确切名称
- `params`: 对象,包含所需的参数(必须符合参数范围约束)
- `children`: 数组(仅控制流节点需要),包含子节点对象
**安全监控要求详解**
1. **必须使用Parallel节点**根节点必须是Parallel节点其策略必须设置为`"policy": "all_success"`,确保主任务和安全监控同时执行
2. **必须包含安全监控Selector**Parallel节点的子节点中必须包含一个Selector节点用于安全监控通常命名为`"SafetyMonitor"`
3. **必须包含电池监控**安全监控Selector必须包含`battery_above`条件节点,监控电池电量
4. **必须包含GPS监控**安全监控Selector应该包含`gps_status`条件节点监控GPS信号状态
5. **必须包含紧急处理流程**安全监控Selector必须包含紧急处理Sequence在安全条件不满足时执行紧急返航和降落
## 二、节点必填字段后端Schema强制要求缺一验证失败
每个节点必须包含以下字段,字段名不可自定义:
1. **`type`**:节点类型(严格匹配)
- 动作节点:`"action"`
- 条件节点:`"condition"`
- 控制流节点:`"Sequence"`/`"Selector"`/`"Parallel"`(与`name`字段值完全一致)
2. **`name`**节点名称必须是上述JSON中`actions`/`conditions`/`control_flow`下的`name`值,如"gps_status"而非其他)
3. **`params`**参数对象严格匹配上述JSON中对应节点的`params`定义,不可加自定义参数,如`object_detected`不可加"color",需用"description"
4. **`children`**:子节点数组(仅控制流节点必含,动作/条件节点无此字段)
**正确示例**
## 三、根节点与安全监控固定结构(后端安全验证必含)
根节点必须是`Parallel`,且`children`包含`MainTask`Sequence和`SafetyMonitor`Selector结构不可修改
```json
{
"root": {
@@ -228,9 +65,18 @@
{
"type": "Sequence",
"name": "MainTask",
"params": {},
"children": [
// 主任务步骤
{"type": "action", "name": "land", "params": {"mode": "home"}}
// 主任务步骤按用户指令分解如preflight_checks→takeoff→fly_to_waypoint→...→land
// 示例步骤(需替换为用户任务):
{"type":"action","name":"preflight_checks","params":{"check_level":"comprehensive"}},
{"type":"action","name":"takeoff","params":{"altitude":2.0}},
{"type":"action","name":"fly_to_waypoint","params":{"x":100.0,"y":80.0,"z":10.0}},
{"type":"action","name":"object_detect","params":{"target_class":"person","description":"穿黑色衣服"}},
{"type":"condition","name":"object_detected","params":{"target_class":"person","description":"穿黑色衣服"}},
{"type":"action","name":"track_object","params":{"target_class":"person","description":"穿黑色衣服","track_time":30.0}},
{"type":"action","name":"strike_target","params":{"target_class":"person","description":"穿黑色衣服"}},
{"type":"action","name":"land","params":{"mode":"home"}}
]
},
{
@@ -238,22 +84,16 @@
"name": "SafetyMonitor",
"params": {"memory": true},
"children": [
// 必含电池监控battery_above、GPS监控gps_status、紧急处理EmergencyHandler
{"type":"condition","name":"battery_above","params":{"threshold":0.3}},
{"type":"condition","name":"gps_status","params":{"min_satellites":8}},
{
"type": "condition",
"name": "battery_above",
"params": {"threshold": 0.3}
},
{
"type": "condition",
"name": "gps_status",
"params": {"min_satellites": 8}
},
{
"type": "Sequence",
"name": "EmergencyHandler",
"type":"Sequence",
"name":"EmergencyHandler",
"params": {},
"children": [
{"type": "action", "name": "emergency_return", "params": {"reason": "safety_breach"}},
{"type": "action", "name": "land", "params": {"mode": "home"}}
{"type":"action","name":"emergency_return","params":{"reason":"safety_breach"}},
{"type":"action","name":"land","params":{"mode":"home"}}
]
}
]
@@ -263,453 +103,16 @@
}
```
**错误示例**(缺少安全监控):
```json
{
"root": {
"type": "Sequence", // 错误根节点不是Parallel无法同时运行安全监控
"name": "MainTaskOnly",
"children": [
// 只有主任务,没有安全监控
]
}
}
```
错误示例(根节点为动作节点)
```json
{
"root": {
"type": "action",
"name": "land",
"children": [ ... ], // 错误:动作节点不能有子节点
"params": {"mode": "home"}
}
}
```
## 四、高频错误规避(后端验证常失败点)
1. **禁止自定义节点**:如"lock_target"是未定义节点,必须删除,用"object_detect"+"object_detected"替代锁定逻辑。
2. **参数名严格匹配**
- `track_object`用`track_time`(不可用`duration`
- `object_detected`描述目标属性用`description`(不可用`color`/`target`等);
- `gps_status`必传`min_satellites`范围6-15如8
3. **条件节点`object_detected`必含`target_class`**值必须是上述JSON中`object_detect`的`target_class`列表中的值(如"person")。
4. **控制流节点`name`与`type`一致**:如`type:"Sequence"`则`name:"Sequence"`,不可自定义`name`。
##### 重要安全警告Parallel节点使用禁忌
**严禁**在安全监控场景中使用 `"policy": "one_success"` 的Parallel节点
错误模式(会导致任务中断):
```json
{
"type": "Parallel",
"params": {"policy": "one_success"}, // 严禁这样使用!
"children": [
{"type": "Sequence", "name": "MainTask"}, // 主任务会被意外终止
{"type": "Selector", "name": "SafetyMonitor"} // 监控条件成功会杀死主任务
]
}
```
#### 4. Selector节点memory参数使用规范
- **默认使用** `"memory": true`:用于任务执行和监控检查,避免不必要的任务中断。
- **仅在高优先级安全中断**时使用 `"memory": false`如急停按钮每个tick都检查。
- **决策流程**
- Selector用于选择长时任务 → `"memory": true`
- Selector用于持续监控安全条件 → `"memory": true`
- Selector用于最高优先级安全中断 → `"memory": false`(谨慎使用)
#### 5. 搜索与检测节点使用区分
- **object_detect**:用于已知位置的定点检测(无人机悬停或稳定时识别)。
- **search_pattern**:用于未知区域的移动搜索(无人机按模式飞行覆盖区域)。
- 严禁混淆使用例如在search_pattern后不应立即使用object_detect除非需要进一步验证。
#### 6. 参数约束检查 (必须遵守)
在生成JSON时你必须确保所有参数值符合物理约束
- `altitude` (takeoff): [1, 100]
- `z` (fly_to_waypoint): [1, 5000]
- `x`, `y` (fly_to_waypoint): [-10000, 10000]
- `radius` (search_pattern): [5, 1000]
- 电池阈值: [0.0, 1.0]
- 等等其他参数范围。
如果用户指令或参考知识提供坐标必须使用这些坐标但确保调整到约束范围内例如如果z<5则设置为5.0)。
#### 7. 标准任务范式
所有任务必须包含安全监控。使用以下范式作为模板:
```json
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {"policy": "all_success"},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
// 主任务步骤最后以land结束
{"type": "action", "name": "land", "params": {"mode": "home"}}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {"memory": true},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {"threshold": 0.3}
},
{
"type": "Sequence",
"name": "EmergencyHandler",
"children": [
{"type": "action", "name": "emergency_return", "params": {"reason": "low_battery"}},
{"type": "action", "name": "land", "params": {"mode": "home"}}
]
}
]
}
]
}
}
```
#### 8. 打击任务范式
所有任务必须包含安全监控。使用以下范式作为模板:
{
"root": {
"type": "Parallel",
"name": "CompleteStrikeMission",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainStrikeSequence",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 200.0,
"y": 150.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "truck",
"description": "军事卡车",
"count": 1
}
},
{
"type": "condition",
"name": "object_detected",
"params": {
"target_class": "truck",
"description": "军事卡车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 200.0,
"center_y": 150.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "truck",
"description": "军事卡车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "strike_target",
"params": {
"target_class": "truck",
"description": "军事卡车",
"count": 1
}
},
{
"type": "action",
"name": "battle_damage_assessment",
"params": {
"target_class": "truck",
"assessment_time": 20.0
}
},
{
"type": "Selector",
"name": "DamageConfirmationSelector",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "target_destroyed",
"params": {
"target_class": "truck",
"description": "军事卡车",
"confidence": 0.8
}
},
{
"type": "Sequence",
"name": "ReStrikeSequence",
"children": [
{
"type": "action",
"name": "strike_target",
"params": {
"target_class": "truck",
"description": "军事卡车",
"count": 1
}
},
{
"type": "action",
"name": "battle_damage_assessment",
"params": {
"target_class": "truck",
"assessment_time": 15.0
}
}
]
}
]
},
{
"type": "action",
"name": "land",
"params": {
"mode": "home"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitorSelector",
"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": "EmergencyProcedureSequence",
"children": [
{
"type": "action",
"name": "emergency_return",
"params": {
"reason": "safety_breach"
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "home"
}
}
]
}
]
}
]
}
}
#### 9. 跟踪任务范式
所有任务必须包含安全监控。使用以下范式作为模板:
```json
{
"root": {
"type": "Parallel",
"name": "TrackingMission",
"params": {"policy": "all_success"},
"children": [
{
"type": "Sequence",
"name": "MainTrackingTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {"check_level": "comprehensive"}
},
{
"type": "action",
"name": "takeoff",
"params": {"altitude": 15.0}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 100.0,
"y": 80.0,
"z": 15.0,
"acceptance_radius": 3.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {"memory": true},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {"duration": 10.0}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "红色轿车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "spiral",
"center_x": 100.0,
"center_y": 80.0,
"center_z": 15.0,
"radius": 50.0,
"target_class": "car",
"description": "红色轿车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "track_object",
"params": {
"target_class": "car",
"description": "红色轿车",
"track_time": 120.0,
"min_confidence": 0.7,
"safe_distance": 15.0
}
},
{
"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"}
}
]
}
]
}
]
}
}
```
#### 10. 如何使用参考知识
当用户提供"参考知识"(如坐标信息)时,你必须使用这些信息填充参数。例如:
- 如果参考知识说"目标坐标: (x: 120.5, y: 80.2, z: 60.0)",则在使用`fly_to_waypoint`时设置这些值。
- 确保坐标符合约束如z≥1
#### 11. 输出要求
你的输出必须是严格的、单一的JSON对象符合上述所有规则。不包含任何自然语言描述。
## 五、输出要求
仅输出1个严格符合上述所有规则的JSON对象**确保后端能解析到所有节点尤其是conditions中的gps_status且无任何冗余内容**。

View File

@@ -335,6 +335,39 @@ def _generate_pytree_schema(allowed_actions: set, allowed_conditions: set) -> di
return schema
def _generate_simple_mode_schema(allowed_actions: set) -> dict:
"""
生成简单模式JSON Schema{"root":{"type":"action","name":"<action_name>","params":{...}}}
仅校验动作名称在允许集合内,以及基本结构完整性;参数按对象形状放宽,由上游提示词与运行时再约束。
"""
# 使用复杂模式Schema中的node定义但限制root节点必须是action类型
node_definition = {
"type": "object",
"properties": {
"type": {"type": "string", "const": "action"},
"name": {"type": "string", "enum": sorted(list(allowed_actions))},
"params": {"type": "object"}
},
"required": ["type", "name"],
"additionalProperties": False
}
schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SimpleMode",
"definitions": {
"node": node_definition
},
"type": "object",
"properties": {
"root": { "$ref": "#/definitions/node" }
},
"required": ["root"],
"additionalProperties": False
}
return schema
def _validate_pytree_with_schema(pytree_instance: dict, schema: dict) -> bool:
"""
使用JSON Schema验证给定的Pytree实例。
@@ -522,13 +555,27 @@ class PyTreeGenerator:
# Updated output directory for visualizations
self.vis_dir = os.path.abspath(os.path.join(self.base_dir, '..', 'generated_visualizations'))
os.makedirs(self.vis_dir, exist_ok=True)
self.system_prompt = self._load_prompt("system_prompt.txt")
# 加载提示词:复杂模式复用现有 system_prompt.txt;简单模式与分类器独立提示词
self.complex_prompt = self._load_prompt("system_prompt.txt")
self.simple_prompt = self._load_prompt("simple_mode_prompt.txt")
self.classifier_prompt = self._load_prompt("classifier_prompt.txt")
# 兼容旧变量名
self.system_prompt = self.complex_prompt
self.orin_ip = os.getenv("ORIN_IP", "localhost")
self.llm_client = openai.OpenAI(
api_key=os.getenv("OPENAI_API_KEY", "sk-no-key-required"),
base_url=f"http://{self.orin_ip}:8081/v1"
)
# 三类模型的可配置项基于不同模型与Base URL分流
self.classifier_model = os.getenv("CLASSIFIER_MODEL", os.getenv("OPENAI_MODEL", "local-model"))
self.simple_model = os.getenv("SIMPLE_MODEL", os.getenv("OPENAI_MODEL", "local-model"))
self.complex_model = os.getenv("COMPLEX_MODEL", os.getenv("OPENAI_MODEL", "local-model"))
self.classifier_base_url = os.getenv("CLASSIFIER_BASE_URL", f"http://{self.orin_ip}:8081/v1")
self.simple_base_url = os.getenv("SIMPLE_BASE_URL", f"http://{self.orin_ip}:8081/v1")
self.complex_base_url = os.getenv("COMPLEX_BASE_URL", f"http://{self.orin_ip}:8081/v1")
self.api_key = os.getenv("OPENAI_API_KEY", "sk-no-key-required")
# 为不同用途分别创建客户端
self.classifier_client = openai.OpenAI(api_key=self.api_key, base_url=self.classifier_base_url)
self.simple_llm_client = openai.OpenAI(api_key=self.api_key, base_url=self.simple_base_url)
self.complex_llm_client = openai.OpenAI(api_key=self.api_key, base_url=self.complex_base_url)
# --- ChromaDB Client Setup ---
vector_store_path = os.path.abspath(os.path.join(self.base_dir, '..', '..', 'tools', 'vector_store'))
@@ -542,8 +589,10 @@ class PyTreeGenerator:
embedding_function=embedding_func
)
allowed_actions, allowed_conditions = _parse_allowed_nodes_from_prompt(self.system_prompt)
# 使用复杂模式提示词作为节点来源确保Schema稳定
allowed_actions, allowed_conditions = _parse_allowed_nodes_from_prompt(self.complex_prompt)
self.schema = _generate_pytree_schema(allowed_actions, allowed_conditions)
self.simple_schema = _generate_simple_mode_schema(allowed_actions)
def _load_prompt(self, file_name: str) -> str:
try:
@@ -574,14 +623,39 @@ class PyTreeGenerator:
"""
logging.info(f"接收到用户请求: {user_prompt}")
retrieved_context = self._retrieve_context(user_prompt)
# 第一步:分类(简单/复杂)
mode = "complex"
try:
classifier_resp = self.classifier_client.chat.completions.create(
model=self.classifier_model,
messages=[
{"role": "system", "content": self.classifier_prompt or "你是一个分类器只输出JSON。"},
{"role": "user", "content": user_prompt}
],
temperature=0.0,
response_format={"type": "json_object"}
)
class_str = classifier_resp.choices[0].message.content
class_obj = json.loads(class_str)
if isinstance(class_obj, dict) and class_obj.get("mode") in ("simple", "complex"):
mode = class_obj.get("mode")
logging.info(f"分类结果: {mode}")
except Exception as e:
logging.warning(f"分类失败,默认按复杂指令处理: {e}")
# 第二步:根据模式准备提示词与上下文(简单与复杂都执行检索增强)
# 基于模式选择提示词;复杂模式追加一条强制规则,避免模型误输出简单结构
use_prompt = self.simple_prompt if mode == "simple" else (
(self.complex_prompt or "") +
"\n\n【强制规则】仅生成包含root的复杂行为树JSON不得输出简单模式不得包含mode字段或仅有action节点"
)
final_user_prompt = user_prompt
retrieved_context = self._retrieve_context(user_prompt)
if retrieved_context:
augmentation = (
"\n\n---\n"
"参考知识:\n"
"以下是从知识库中检索到的、与当前任务最相关的信息,请优先参考这些信息来生成行为树\n"
"以下是从知识库中检索到的、与当前任务最相关的信息,请优先参考这些信息来生成结果\n"
f"{retrieved_context}"
"\n---"
)
@@ -591,17 +665,87 @@ class PyTreeGenerator:
for attempt in range(3):
logging.info(f"--- 第 {attempt + 1}/3 次尝试生成Pytree ---")
try:
response = self.llm_client.chat.completions.create(
model="local-model",
# 简单/复杂分流到不同模型与提示词
client = self.simple_llm_client if mode == "simple" else self.complex_llm_client
model_name = self.simple_model if mode == "simple" else self.complex_model
response = client.chat.completions.create(
model=model_name,
messages=[
{"role": "system", "content": self.system_prompt},
{"role": "system", "content": use_prompt},
{"role": "user", "content": final_user_prompt}
],
temperature=0.1,
temperature=0.1 if mode == "complex" else 0.0,
response_format={"type": "json_object"}
)
pytree_str = response.choices[0].message.content
pytree_dict = json.loads(pytree_str)
# 单独捕获JSON解析错误并打印原始响应
try:
pytree_dict = json.loads(pytree_str)
except json.JSONDecodeError as e:
logging.error(f"❌ JSON解析失败{attempt + 1}/3 次)。原始响应如下:\n{pytree_str}")
continue
# 简单/复杂分别验证与返回
if mode == "simple":
try:
jsonschema.validate(instance=pytree_dict, schema=self.simple_schema)
logging.info("✅ 简单模式JSON Schema验证成功")
except jsonschema.ValidationError as e:
logging.warning(f"❌ 简单模式验证失败: {e.message}")
continue
# 附加元信息并生成简单可视化(单动作)
plan_id = str(uuid.uuid4())
pytree_dict['plan_id'] = plan_id
# 简单模式可视化直接使用root节点
try:
vis_filename = "py_tree.png"
vis_path = os.path.join(self.vis_dir, vis_filename)
_visualize_pytree(pytree_dict['root'], os.path.splitext(vis_path)[0])
pytree_dict['visualization_url'] = f"/static/{vis_filename}"
except Exception as e:
logging.warning(f"简单模式可视化失败: {e}")
return pytree_dict
# 复杂模式回退:若模型误返回简单结构,则自动包装为含安全监控的行为树
if mode == "complex" and isinstance(pytree_dict, dict) and 'root' not in pytree_dict:
try:
jsonschema.validate(instance=pytree_dict, schema=self.simple_schema)
logging.warning("⚠️ 复杂模式生成了简单结构,触发自动包装为完整行为树的回退逻辑。")
simple_action_obj = pytree_dict.get('action') or {}
action_name = simple_action_obj.get('name')
action_params = simple_action_obj.get('params') if isinstance(simple_action_obj.get('params'), dict) else {}
safety_selector = {
"type": "Selector",
"name": "SafetyMonitor",
"params": {"memory": True},
"children": [
{"type": "condition", "name": "battery_above", "params": {"threshold": 0.3}},
{"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"}}
]}
]
}
main_children = [{"type": "action", "name": action_name, "params": action_params}]
if action_name != "land":
main_children.append({"type": "action", "name": "land", "params": {"mode": "home"}})
root_parallel = {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {"policy": "all_success"},
"children": [
{"type": "Sequence", "name": "MainTask", "children": main_children},
safety_selector
]
}
pytree_dict = {"root": root_parallel}
except jsonschema.ValidationError:
# 不符合简单结构,按正常复杂验证继续
pass
if _validate_pytree_with_schema(pytree_dict, self.schema):
logging.info("✅ 成功生成并验证了Pytree")
plan_id = str(uuid.uuid4())
@@ -614,8 +758,11 @@ class PyTreeGenerator:
pytree_dict['visualization_url'] = f"/static/{vis_filename}"
return pytree_dict
else:
# 打印未通过验证的Pytree以便排查
preview = json.dumps(pytree_dict, ensure_ascii=False, indent=2)
logging.warning(f"❌ 未通过验证的Pytree{attempt + 1}/3 次尝试):\n{preview}")
logging.warning("生成的Pytree验证失败正在重试...")
except (OpenAIError, json.JSONDecodeError) as e:
except OpenAIError as e:
logging.error(f"生成Pytree时发生错误: {e}")
raise RuntimeError("在3次尝试后仍未能生成一个有效的Pytree。")

View File

@@ -1,3 +1,5 @@
{"text": "在地图上有一个名为 '跷跷板' 的地点或区域它的leisure是'playground',其中心位置坐标大约在 (x:15, y:-8.5, z:1.2)。"}
{"text": "在地图上有一个名为 'A地' 的地点或区域它的building是'commercial',其中心位置坐标大约在 (x:10, y:-10, z:2)。"}
{"text": "在地图上有一个名为 '学生宿舍' 的地点或区域它的building是'dormitory',其中心位置坐标大约在 (x:5, y:3, z:2)。"}
{"text": "在地图上有一个名为 '作业区域' 的地点或区域它的building是'commercial',其中心位置坐标大约在 (x:13.0, y:0.0, z:1.5)。"}
{"text": "在地图上有一个名为 '搜索区' 的地点或区域它的building是'restaurant',其中心位置坐标大约在 (x:8.0, y:0.0, z:1.5)。"}

View File

@@ -12,7 +12,7 @@ BASE_URL = "http://127.0.0.1:8000"
ENDPOINT = "/generate_plan"
# The user prompt we will send for the test
TEST_PROMPT = "起飞后移动到学生宿舍上方搜索蓝色车辆,并进行打击"
TEST_PROMPT = "无人机起飞后移动到学生宿舍投放救援物资"
def test_generate_plan():
"""

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "b99d8d9a-84e6-474c-a512-61f8e74945e8",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "c74dd92d-450c-4a95-80eb-84441812b7e5",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "c9a68f7d-e8c0-4446-8fcf-e5a9325827b6",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "9e34b939-8410-4aec-a9bb-2261e6a21c48",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "09c44e51-9323-4072-9cb4-61c623d49f76",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "5110f6fe-778d-4191-b321-f1a8c6de9877",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "51bb856d-4804-48fc-9a72-564c4c2f13ba",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "61fe6be0-5252-45f1-9b89-bf23387a9ada",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "2fdeb41f-99da-4055-adab-ea795def40d6",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,93 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "action",
"name": "land",
"params": {
"mode": "current"
}
}
]
},
{
"type": "Selector",
"name": "SafetyMonitor",
"params": {
"memory": true
},
"children": [
{
"type": "condition",
"name": "battery_above",
"params": {
"threshold": 0.3
}
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "6259d34d-4ac3-4a45-a683-e36cd219fe8e",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "96546010-2887-463b-96aa-e9a4237944f2",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "92d92c59-b3cd-47d0-9371-967d6086dc11",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "a2f5a53d-c90d-4cd8-9a28-22399aab3b05",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "12f71128-f676-443f-89bc-8f0b5e16e9cd",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "4c0c5cb7-5438-444f-9278-741fd65d370a",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "65d91ac8-2526-4447-b5f6-113c8033f956",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "46a40452-9535-49aa-8eb9-e8ef77cfb0a1",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "aa95931b-6e05-4cd9-aadc-33405bef45a9",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "2bd7d8df-bfcd-487b-a313-645373b450d5",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "9eeccc4a-ab3b-469f-8aa5-ce9c5c921190",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "3b541f31-120d-4283-86c1-6a98cd6bf4a6",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "5b81b00f-fd8d-4e7b-97e5-5ad5f25b8199",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "26cdb6ce-bb70-4a58-92c6-19470551a931",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "6703241e-5367-42e9-bbcf-8518f7a7982f",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "71c89dc5-5e3b-46d5-9c0b-59535d5c12b2",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "1142491e-1a37-4a09-a64d-ed5773cea09e",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "35ff42a3-2871-4b6e-820d-69a2b05411f6",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "a836fb2c-74b1-4451-94a7-83ea9dc04fc5",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "d716a58c-8cb1-4792-98a1-c2a44d86ba72",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "cbb57237-e84d-4de8-bba1-a1f7a7dd8538",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "619957a5-92b3-4f1f-b556-7d744aee247f",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "7d1394a0-595f-4745-8c05-7c27bbe6a893",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "172d07ff-4746-48e0-a47c-ce721dbfd9da",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "15364c4e-badb-4cf0-ad55-9507b3f42ca6",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "ba86bac9-b1c9-4ea8-a255-f0589b776622",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "3518e34d-d5ab-4750-98e3-4aa5272b4617",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "410d15c8-a536-4ecc-a0e1-e0f8b0299285",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "c3f8c7f7-85d7-4be3-8c41-10731cae7d35",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "c4c5e35b-f1d1-4b0a-8b3a-c664322a6ffc",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "a486685e-679c-4a63-8582-192ea188e03a",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,138 @@
{
"root": {
"type": "Parallel",
"name": "MissionWithSafety",
"params": {
"policy": "all_success"
},
"children": [
{
"type": "Sequence",
"name": "MainTask",
"children": [
{
"type": "action",
"name": "preflight_checks",
"params": {
"check_level": "comprehensive"
}
},
{
"type": "action",
"name": "takeoff",
"params": {
"altitude": 2.0
}
},
{
"type": "action",
"name": "fly_to_waypoint",
"params": {
"x": 5.0,
"y": 3.0,
"z": 2.0,
"acceptance_radius": 2.0
}
},
{
"type": "Selector",
"name": "TargetAcquisitionSelector",
"params": {
"memory": true
},
"children": [
{
"type": "Sequence",
"name": "DirectDetectionSequence",
"children": [
{
"type": "action",
"name": "loiter",
"params": {
"duration": 10.0
}
},
{
"type": "action",
"name": "object_detect",
"params": {
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"type": "action",
"name": "search_pattern",
"params": {
"pattern_type": "grid",
"center_x": 5.0,
"center_y": 3.0,
"center_z": 2.0,
"radius": 80.0,
"target_class": "car",
"description": "蓝色的车",
"count": 1
}
}
]
},
{
"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"
}
}
]
}
]
}
]
},
"plan_id": "776b10d3-2c2f-45d5-89df-8984ee0d4f1c",
"visualization_url": "/static/py_tree.png"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Some files were not shown because too many files have changed in this diff Show More