diff --git a/backend_service/src/prompts/classifier_prompt.txt b/backend_service/src/prompts/classifier_prompt.txt index 900ae0cf..bdedc4ff 100644 --- a/backend_service/src/prompts/classifier_prompt.txt +++ b/backend_service/src/prompts/classifier_prompt.txt @@ -3,7 +3,6 @@ - 简单:单一原子动作即可完成(例如“起飞”“飞机自检”“移动到某地(已给定坐标)”等),且无需行为树与安全并行监控。 - 复杂:需要多步流程、搜索/检测/跟踪/评估、战损确认、或需要模板化任务结构与安全并行监控。 - - 注:口令“环绕X米Y圈(以坐标或已获目标为中心)”若不涉及前置搜索/检测,一般判为简单;若需先“搜索/检测/跟踪后再环绕”,判为复杂。 输出格式(严格遵守): {"mode":"simple"} 或 {"mode":"complex"} @@ -12,7 +11,7 @@ ```json { "actions": [ - {"name": "takeoff"}, {"name": "land"}, {"name": "fly_to_waypoint"}, {"name": "orbit_around_point"}, {"name": "orbit_around_target"}, {"name": "move_direction"}, {"name": "loiter"}, + {"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"} diff --git a/backend_service/src/prompts/simple_mode_prompt.txt b/backend_service/src/prompts/simple_mode_prompt.txt index bd9d355d..404ebeaf 100644 --- a/backend_service/src/prompts/simple_mode_prompt.txt +++ b/backend_service/src/prompts/simple_mode_prompt.txt @@ -11,19 +11,6 @@ - “起飞到10米” → {"mode":"simple","action":{"name":"takeoff","params":{"altitude":10.0}}} - “移动到(120,80,20)” → {"mode":"simple","action":{"name":"fly_to_waypoint","params":{"x":120.0,"y":80.0,"z":20.0,"acceptance_radius":2.0}}} - “飞机自检” → {"mode":"simple","action":{"name":"preflight_checks","params":{"check_level":"comprehensive"}}} - - “环绕三十两圈(以目标为中心)” → {"mode":"simple","action":{"name":"orbit_around_target","params":{"target_class":"person","radius":30.0,"laps":2,"clockwise":true,"gimbal_lock":true}}} - - “以(120,80,20)为中心半径30米环绕两圈” → {"mode":"simple","action":{"name":"orbit_around_point","params":{"center_x":120.0,"center_y":80.0,"center_z":20.0,"radius":30.0,"laps":2,"gimbal_lock":true}}} - -—— 环绕口令语义说明—— -- “环绕X米Y圈”:以指定中心(坐标或目标)为圆心,半径 X 米,等速飞行 Y 圈;默认顺时针(`clockwise:true`),默认云台持续指向中心(`gimbal_lock:true`)。 -- 中心选择: - - 明确给出坐标 → 使用 `orbit_around_point`(`center_x/center_y/center_z` 来自口令或参考知识)。 - - 明确“以目标为中心/围绕某类目标” → 使用 `orbit_around_target`(需要已获目标;若缺少目标实例,复杂模式应先检测/确认)。 - - 未明确中心但上下文存在当前锁定目标 → 视为以该目标为中心。 -- 方向与速度: - - “顺时针/逆时针” → `clockwise: true/false`;未指明默认 `true`。 - - “等速/速度V米每秒” → 指明则设置 `speed_mps: V`(范围 [0.5,15]);未指明可省略。 -- 数字解析:中文数字与阿拉伯数字均可,需规范化为数值,例如“三十两圈” → `radius: 30.0`、`laps: 2`。 —— 可用节点定义—— ```json @@ -32,9 +19,9 @@ {"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": "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", "description": "string, 可选", "radius": "float[5,1000]", "laps": "int[1,20]", "clockwise": "boolean, 默认true", "speed_mps": "float[0.5,15], 可选", "gimbal_lock": "boolean, 默认true"}}, {"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, 见复杂模式定义列表", "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, 见复杂模式定义列表", "description": "string, 可选", "count": "int, 可选, 默认1"}}, {"name": "strike_target", "description": "对已识别目标进行打击。", "params": {"target_class": "string", "description": "string, 可选", "count": "int, 可选, 默认1"}}, @@ -62,9 +49,15 @@ - fly_to_waypoint.x,y: [-10000, 10000] - search_pattern.radius: [5, 1000] - move_direction.distance: [1, 10000] -// 环绕动作 -- orbit_around_point.radius / orbit_around_target.radius: [5, 1000] -- orbit_around_point.laps / orbit_around_target.laps: [1, 20] -- orbit_around_point.speed_mps / orbit_around_target.speed_mps: [0.5, 15] +- 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] - 电池阈值等同复杂模式(如需涉及) -- 若参考知识提供坐标,必须使用并裁剪到约束范围内 \ No newline at end of file +- 若参考知识提供坐标,必须使用并裁剪到约束范围内 + +—— 口令转化规则(环绕类)—— +- “环绕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` \ No newline at end of file diff --git a/backend_service/src/prompts/system_prompt.txt b/backend_service/src/prompts/system_prompt.txt index 3ab84e1f..f990f4f0 100644 --- a/backend_service/src/prompts/system_prompt.txt +++ b/backend_service/src/prompts/system_prompt.txt @@ -48,29 +48,29 @@ }, { "name": "orbit_around_point", - "description": "围绕给定中心点等速环绕飞行,可指定圈数与方向。", + "description": "以给定中心点为中心,等速圆周飞行指定圈数。", "params": { "center_x": "float, 中心点X坐标(米)", "center_y": "float, 中心点Y坐标(米)", "center_z": "float, 中心点Z坐标(米)", - "radius": "float, 轨道半径(米)[5,1000]", - "laps": "int, 环绕圈数[1,20]", - "clockwise": "boolean, 是否顺时针,默认true", - "speed_mps": "float, 可选,环绕线速度(米/秒)[0.5,15]", - "gimbal_lock": "boolean, 云台持续指向中心,默认true" + "radius": "float, 半径(米)[5,1000]", + "laps": "int, 圈数[1,20]", + "clockwise": "boolean, 可选,顺时针为true,默认true", + "speed_mps": "float, 可选,线速度(米/秒)[0.5,15]", + "gimbal_lock": "boolean, 可选,云台持续指向中心,默认true" } }, { "name": "orbit_around_target", - "description": "围绕已获目标等速环绕飞行,可指定圈数与方向。", + "description": "以目标为中心,等速圆周飞行指定圈数。需要已确认目标。", "params": { - "target_class": "string, 目标类别", + "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" + "radius": "float, 半径(米)[5,1000]", + "laps": "int, 圈数[1,20]", + "clockwise": "boolean, 可选,顺时针为true,默认true", + "speed_mps": "float, 可选,线速度(米/秒)[0.5,15]", + "gimbal_lock": "boolean, 可选,云台持续指向目标,默认true" } }, { @@ -359,10 +359,9 @@ - `x`, `y` (fly_to_waypoint): [-10000, 10000] - `radius` (search_pattern): [5, 1000] - `distance` (move_direction): [1, 10000] -// 环绕动作 -- `radius` (orbit_*): [5, 1000] -- `laps` (orbit_*): [1, 20] -- `speed_mps` (orbit_*): [0.5, 15] +- `radius` (orbit_around_point/orbit_around_target): [5, 1000] +- `laps` (orbit_around_point/orbit_around_target): [1, 20] +- `speed_mps` (orbit_around_point/orbit_around_target): [0.5, 15] - 电池阈值: [0.0, 1.0] - 等等其他参数范围。 @@ -746,53 +745,17 @@ } ``` -#### 9.5 环绕任务范式 -所有任务必须包含安全监控。使用以下范式作为模板: -```json -{ - "root": { - "type": "Parallel", - "name": "OrbitMission", - "params": {"policy": "all_success"}, - "children": [ - { - "type": "Sequence", - "name": "MainOrbitTask", - "children": [ - {"type": "action", "name": "preflight_checks", "params": {"check_level": "comprehensive"}}, - {"type": "action", "name": "takeoff", "params": {"altitude": 15.0}}, - {"type": "action", "name": "orbit_around_point", "params": {"center_x": 120.0, "center_y": 80.0, "center_z": 20.0, "radius": 30.0, "laps": 2, "clockwise": true, "gimbal_lock": true}}, - {"type": "action", "name": "land", "params": {"mode": "home"}} - ] - }, - { - "type": "Selector", - "name": "SafetyMonitor", - "params": {"memory": true}, - "children": [ - {"type": "condition", "name": "battery_above", "params": {"threshold": 0.35}}, - {"type": "condition", "name": "gps_status", "params": {"min_satellites": 8}}, - {"type": "Sequence", "name": "EmergencyHandler", "children": [ - {"type": "action", "name": "emergency_return", "params": {"reason": "safety_breach"}}, - {"type": "action", "name": "land", "params": {"mode": "home"}} - ]} - ] - } - ] - } -} -``` - -#### 9.6 环绕口令语义说明 -- “环绕X米Y圈”:以中心(坐标或已获目标)为圆心,半径 X 米,等速环绕 Y 圈;默认 `clockwise:true`、`gimbal_lock:true`。 -- 中心选择:有坐标 → 使用 `orbit_around_point`;有目标 → 使用 `orbit_around_target`;若仅给类别且未获目标,需在复杂模式中先完成目标获取(检测/跟踪/确认)。 -- 方向与速度:若口令出现“顺时针/逆时针”,映射为 `clockwise:true/false`;给出速度“V米每秒”时设置 `speed_mps: V`(范围 [0.5,15]),否则可省略。 -- 数字解析:支持中文数字与阿拉伯数字,如“环绕三十两圈”→ `radius:30.0`、`laps:2`。 - #### 10. 如何使用参考知识 当用户提供"参考知识"(如坐标信息)时,你必须使用这些信息填充参数。例如: - 如果参考知识说"目标坐标: (x: 120.5, y: 80.2, z: 60.0)",则在使用`fly_to_waypoint`时设置这些值。 - 确保坐标符合约束(如z≥1)。 +环绕口令到参数的映射规则(当口令涉及“环绕/绕圈”等): +- “环绕X米Y圈” → `radius=X`, `laps=Y`,默认 `clockwise=true`, `gimbal_lock=true` +- 明确“顺时针/逆时针”时 → 设置 `clockwise=true/false` +- 出现“等速”时 → 若未给速度则 `speed_mps` 使用默认值(如3.0);若口令给出速度,裁剪到[0.5,15] +- “以(中心坐标)为中心/当前位置为中心” → 使用 `orbit_around_point` 并填写 `center_x/center_y/center_z` +- “以目标为中心/围绕目标” → 使用 `orbit_around_target`;若任务未提供目标来源,则需要在主任务中先行确认目标(通过检测/跟踪或参考知识) + #### 11. 输出要求 你的输出必须是严格的、单一的JSON对象,符合上述所有规则。不包含任何自然语言描述。 \ No newline at end of file