diff --git a/backend_service/src/__pycache__/__init__.cpython-313.pyc b/backend_service/src/__pycache__/__init__.cpython-313.pyc index 3a3bc7d5..4e403fce 100644 Binary files a/backend_service/src/__pycache__/__init__.cpython-313.pyc and b/backend_service/src/__pycache__/__init__.cpython-313.pyc differ diff --git a/backend_service/src/__pycache__/main.cpython-313.pyc b/backend_service/src/__pycache__/main.cpython-313.pyc index 176b615d..497637e3 100644 Binary files a/backend_service/src/__pycache__/main.cpython-313.pyc and b/backend_service/src/__pycache__/main.cpython-313.pyc differ diff --git a/backend_service/src/__pycache__/models.cpython-313.pyc b/backend_service/src/__pycache__/models.cpython-313.pyc index 92238477..13fe7a6f 100644 Binary files a/backend_service/src/__pycache__/models.cpython-313.pyc and b/backend_service/src/__pycache__/models.cpython-313.pyc differ diff --git a/backend_service/src/__pycache__/py_tree_generator.cpython-313.pyc b/backend_service/src/__pycache__/py_tree_generator.cpython-313.pyc index f74f7092..34987b70 100644 Binary files a/backend_service/src/__pycache__/py_tree_generator.cpython-313.pyc and b/backend_service/src/__pycache__/py_tree_generator.cpython-313.pyc differ diff --git a/backend_service/src/__pycache__/websocket_manager.cpython-313.pyc b/backend_service/src/__pycache__/websocket_manager.cpython-313.pyc index 939083a5..0878380b 100644 Binary files a/backend_service/src/__pycache__/websocket_manager.cpython-313.pyc and b/backend_service/src/__pycache__/websocket_manager.cpython-313.pyc differ diff --git a/backend_service/src/prompts/classifier_prompt.txt b/backend_service/src/prompts/classifier_prompt.txt index 1754b0b0..cc1cf448 100644 --- a/backend_service/src/prompts/classifier_prompt.txt +++ b/backend_service/src/prompts/classifier_prompt.txt @@ -18,7 +18,7 @@ {"name":"takeoff","params":{"altitude":"float[1,100],默认2"}}, {"name":"land","params":{"mode":"'current'/'home'"}}, {"name":"fly_to_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","acceptance_radius":"默认2.0"}}, - {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'z':5}, ...])","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东北天坐标系)","speed":"float,可选"}}, + {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'depth':5}, ...];depth可选,不填则保持当前高度)","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东南天坐标系)","speed":"float,可选"}}, {"name":"move_direction","params":{"direction":"north/south/east/west/forward/backward/left/right","distance":"[1,10000],缺省持续移动","speed":"float,可选"}}, {"name":"approach_target","params":{"target_class":"string,要趋近的目标类别","description":"string,可选,目标属性描述","stop_distance":"float,期望的最终停止距离","speed":"float,可选,期望的逼近速度"}}, {"name":"rotate","params":{"angle":"float,无人机自身旋转角度(正数逆时针,负数顺时针)","angular_velocity":"rad/s,旋转角速度"}}, diff --git a/backend_service/src/prompts/simple_mode_prompt.txt b/backend_service/src/prompts/simple_mode_prompt.txt index 4ffef9a2..27b7243d 100644 --- a/backend_service/src/prompts/simple_mode_prompt.txt +++ b/backend_service/src/prompts/simple_mode_prompt.txt @@ -18,7 +18,7 @@ {"name":"takeoff","params":{"altitude":"float[1,100],默认2"}}, {"name":"land","params":{"mode":"'current'/'home'"}}, {"name":"fly_to_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","acceptance_radius":"默认2.0"}}, - {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'z':5}, ...])","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东北天坐标系)","speed":"float,可选"}}, + {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'depth':5}, ...];depth可选,不填则保持当前高度)","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东南天坐标系)","speed":"float,可选"}}, {"name":"move_direction","params":{"direction":"north/south/east/west/forward/backward/left/right/up/down","distance":"[1,10000],缺省持续移动","speed":"float,可选"}}, {"name":"approach_target","params":{"target_class":"string,要趋近的目标类别","description":"string,可选,目标属性描述","stop_distance":"float,期望的最终停止距离","speed":"float,可选,期望的逼近速度"}}, {"name":"rotate","params":{"angle":"float,无人机自身旋转角度(正数逆时针,负数顺时针)","angular_velocity":"rad/s,旋转角速度"}}, diff --git a/backend_service/src/prompts/system_prompt.txt b/backend_service/src/prompts/system_prompt.txt index 01b71831..fe9aebbd 100644 --- a/backend_service/src/prompts/system_prompt.txt +++ b/backend_service/src/prompts/system_prompt.txt @@ -9,7 +9,7 @@ {"name":"takeoff","params":{"altitude":"float[1,100],默认2"}}, {"name":"land","params":{"mode":"'current'/'home'"}}, {"name":"fly_to_waypoint","params":{"x":"±10000","y":"±10000","z":"[1,5000]","acceptance_radius":"默认2.0","desc":"仅当指令提及具体地点(如'去广场'、'去大门')或需计算明确坐标时使用"}}, - {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'z':5}, ...])","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东南天坐标系)","speed":"float,可选"}}, + {"name":"fly_sequence","params":{"waypoints":"list[dict] (e.g. [{'x':10,'y':20,'depth':5}, ...];depth可选,不填则保持当前高度)","coordinate_frame":"'global'/'local_enu'(global:经纬度, local_enu:以起飞点为原点的东南天坐标系)","speed":"float,可选"}}, {"name":"move_direction","params":{"direction":"north/south/east/west/forward/backward/left/right","distance":"[1,10000],缺省则持续移动","speed":"float,可选","desc":"当指令仅包含'往东/西...飞xx米'且无具体地点名词时,必须使用此节点"}}, {"name":"approach_target","params":{"target_class":"string,要趋近的目标类别","description":"string,可选,目标属性描述","stop_distance":"float,期望的最终停止距离","speed":"float,可选,期望的逼近速度"}}, {"name":"rotate","params":{"angle":"float,无人机自身旋转角度(正数逆时针,负数顺时针)","angular_velocity":"rad/s,旋转角速度"}}, @@ -278,6 +278,496 @@ } ``` +#### 场景 7:空中上升后沿建筑外围侦察(Sequence + Selector) +**指令**:“无人机当前在空中,再往上飞3米,接着绕这栋楼外围侦察有没有人,看到了就拍照传回来。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在空中,无需自检与起飞。先向上移动3米(仅方向+距离,使用`move_direction`)。随后“边飞边判断”:用`Parallel`并行执行`fly_sequence`与持续检测分支。检测分支使用`object_detect` + `object_detected` + `take_photos`,再用`SuccessIsFailure`保证不会提前结束并行;并行策略为`success_on_one`,当巡查飞行完成即结束任务。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "RiseAndPatrolPerimeter", + "children": [ + { + "type": "action", + "name": "move_direction", + "params": { + "direction": "up", + "distance": 3.0 + } + }, + { + "type": "Parallel", + "name": "PatrolAndDetect", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8}, + {"x": -108.5, "y": 241.8}, + {"x": -108.5, "y": 289.8}, + {"x": -24.0, "y": 292.8}, + {"x": -24.0, "y": 241.8} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectAndPhotoWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"person","description":"建筑外围人员"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"person","description":"建筑外围人员"}}, + {"type":"action","name":"take_photos","params":{"target_class":"person","description":"建筑外围人员","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 8:地面起飞到楼前12米高度并沿外围查找杂物(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,沿着外围查找所有的杂物堆积并拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,需自检后起飞。指令是到具体地点且明确高度,使用`fly_sequence`沿外围巡查,所有航点设置为12米高度(`depth`=12)。为满足“边飞边判断”,使用`Parallel`并行飞行与检测,检测分支持续执行`object_detect` + `object_detected` + `take_photos`,用`SuccessIsFailure`避免提前结束。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterAndPhotoGarbage", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectGarbage", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectGarbageWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"action","name":"take_photos","params":{"target_class":"garbage","description":"杂物堆积","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 9:地面到12米绕外围查看打开的窗户(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,绕着外围看有没有打开的窗户,发现则进行拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,先自检起飞。随后使用`fly_sequence`沿外围绕飞,航点高度为12米(`depth`=12)。同时并行执行检测分支,发现打开窗户就拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterAndPhotoWindows", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectWindows", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectOpenWindowsWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"action","name":"take_photos","params":{"target_class":"window","description":"打开的窗户","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 10:地面到12米沿外围查找打开的窗户(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,沿着外围查找所有打开的窗户并拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,起飞后使用`fly_sequence`沿外围巡查(`depth`=12),并行持续检测打开的窗户并拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterAndPhotoOpenWindows", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectOpenWindows", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectAllOpenWindowsWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"action","name":"take_photos","params":{"target_class":"window","description":"打开的窗户","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 11:空中上升后绕外围侦察打开窗户(Sequence) +**指令**:“无人机当前在空中,再往上飞3米,接着绕这栋楼外围侦察有没有打开的窗户,看到了就拍照传回来。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在空中,先上升3米。随后并行执行绕飞巡查与检测,发现打开窗户立即拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "RiseAndDetectOpenWindows", + "children": [ + {"type":"action","name":"move_direction","params":{"direction":"up","distance":3.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectOpenWindows", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8}, + {"x": -108.5, "y": 241.8}, + {"x": -108.5, "y": 289.8}, + {"x": -24.0, "y": 292.8}, + {"x": -24.0, "y": 241.8} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectOpenWindowsWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"window","description":"打开的窗户"}}, + {"type":"action","name":"take_photos","params":{"target_class":"window","description":"打开的窗户","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 12:地面到12米绕外围巡视杂物堆积(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,绕着外围巡视杂物堆积现象,发现则进行拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,起飞后沿外围绕飞(`depth`=12),并行检测杂物堆积并拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterAndPhotoGarbageObserve", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectGarbageObserve", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectGarbageWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"action","name":"take_photos","params":{"target_class":"garbage","description":"杂物堆积","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 13:空中下降后绕外围侦察杂物堆积(Sequence) +**指令**:“无人机当前在空中,往下飞3米,接着绕这栋楼外围侦察有没有杂物堆积,看到了就拍照传回来。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在空中,先下降3米。随后并行执行绕飞巡查与检测,发现杂物堆积立即拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "DescendAndDetectGarbage", + "children": [ + {"type":"action","name":"move_direction","params":{"direction":"down","distance":3.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectGarbage", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8}, + {"x": -108.5, "y": 241.8}, + {"x": -108.5, "y": 289.8}, + {"x": -24.0, "y": 292.8}, + {"x": -24.0, "y": 241.8} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectGarbageWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"garbage","description":"杂物堆积"}}, + {"type":"action","name":"take_photos","params":{"target_class":"garbage","description":"杂物堆积","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 14:地面到12米绕外围查看是否有人(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,绕着外围看有没有人,发现则进行拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,起飞后沿外围绕飞(`depth`=12),并行检测人员并拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterAndPhotoPerson", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolAndDetectPerson", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectPersonWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"person","description":"人员"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"person","description":"人员"}}, + {"type":"action","name":"take_photos","params":{"target_class":"person","description":"人员","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + +#### 场景 15:地面到12米沿外围逆时针查找人员(Sequence) +**指令**:“无人机当前在地面,去面前大楼的12米高处,沿着外围逆时针查找所有的人并拍照。” +**参考信息**:面前的大楼外围四个点东南天坐标系坐标:A(-24.00, 241.80),B(-108.50, 241.80),C(-108.50, 289.80),D(-24.00, 292.80)。 +**思路**:无人机在地面,起飞后按逆时针顺序巡查外围(示例航点顺序:A→D→C→B→A),并行检测人员与拍照。 +**结构**:Sequence +```json +{ + "root": { + "type": "Sequence", + "name": "FlyPerimeterCounterClockwiseAndPhotoPerson", + "children": [ + {"type":"action","name":"system_checks","params":{"check_level":"comprehensive"}}, + {"type":"action","name":"takeoff","params":{"altitude":10.0}}, + { + "type": "Parallel", + "name": "PatrolCCWAndDetectPerson", + "params": { + "policy": "success_on_one" + }, + "children": [ + { + "type": "action", + "name": "fly_sequence", + "params": { + "waypoints": [ + {"x": -24.0, "y": 241.8, "depth": 12.0}, + {"x": -24.0, "y": 292.8, "depth": 12.0}, + {"x": -108.5, "y": 289.8, "depth": 12.0}, + {"x": -108.5, "y": 241.8, "depth": 12.0}, + {"x": -24.0, "y": 241.8, "depth": 12.0} + ], + "coordinate_frame": "local_enu" + } + }, + { + "type": "decorator", + "name": "SuccessIsFailure", + "child": { + "type": "Sequence", + "name": "DetectPersonWhileFlying", + "children": [ + {"type":"action","name":"object_detect","params":{"target_class":"person","description":"人员"}}, + {"type":"condition","name":"object_detected","params":{"target_class":"person","description":"人员"}}, + {"type":"action","name":"take_photos","params":{"target_class":"person","description":"人员","track_time":10.0}} + ] + } + } + ] + } + ] + } +} +``` + ## 六、高频错误规避 1. 控制流节点的 `type` 必须是 `"Sequence"`, `"Selector"` 或 `"Parallel"` 2. **人工确认节点 (`manual_confirmation`) 使用原则**: diff --git a/backend_service/src/py_tree_generator.py b/backend_service/src/py_tree_generator.py index 6d11a937..5b2c147c 100644 --- a/backend_service/src/py_tree_generator.py +++ b/backend_service/src/py_tree_generator.py @@ -304,9 +304,9 @@ def _generate_pytree_schema(allowed_actions: set, allowed_conditions: set) -> di "properties": { "x": {"type": "number"}, "y": {"type": "number"}, - "z": {"type": "number"} + "depth": {"type": "number"} }, - "required": ["x", "y", "z"] + "required": ["x", "y"] }, "minItems": 1 }, diff --git a/backend_service/src/tools/__pycache__/__init__.cpython-313.pyc b/backend_service/src/tools/__pycache__/__init__.cpython-313.pyc index f75f01da..cf655a69 100644 Binary files a/backend_service/src/tools/__pycache__/__init__.cpython-313.pyc and b/backend_service/src/tools/__pycache__/__init__.cpython-313.pyc differ diff --git a/backend_service/src/tools/__pycache__/coordinate_tools.cpython-313.pyc b/backend_service/src/tools/__pycache__/coordinate_tools.cpython-313.pyc index 2a2949ab..1fac4489 100644 Binary files a/backend_service/src/tools/__pycache__/coordinate_tools.cpython-313.pyc and b/backend_service/src/tools/__pycache__/coordinate_tools.cpython-313.pyc differ