实现预定流程全链路: 任务状态机 + 编排器 + 地面站 + 真机/SITL入口
- utils/task_runner: 6态状态机(WAIT→ARM_TAKEOFF→GOTO(L2)→TRACK(L1)→APPROACH→RTL) + 编排器(快照采集/状态动作) + 双层日志(事件JSONL/遥测CSV) + 吊舱控制指令(0x07/0x0F/0x0E/0x08) - pod_bridge: ground_link 地面坐标UDP注入(超龄判无效,无激光替代表4); set_heading_servo_enabled() 运行时L1/L2切换(切换即reset清积分防输出跳变); pod_locked 提为公共门控; config 新增 ground_inject 段 - virtual_pod 模拟吊舱(无电机语义) + verify_px4 增量④仅飞控验证 + pod_sitl_test L1 SITL全流程(飞行编排不塞进 run_bridge, 保持纯offboard闭环入口) - 入口: task_runner_sitl(VirtualPod+虚拟目标, SITL端到端跑通约1m24s) / task_runner_real(真串口+UDP注入+吊舱控制) - 地面站 ground_station: 坐标注入 + 状态可视化(Flask) - S1标定回填(2026-10-09): beta_sign=+1 / alpha_sign=-1, 加标定回归测试守护 - 新增测试: task_runner x4 + ground_link/virtual_pod*/bridge/px4_gateway 增量; 全量 483 passed - 文档: 预定流程(需求) + 预定流程-操作指南(操作/待办) + L1方案补S1结论与实现状态
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""pod_control_test.py —— 吊舱目标识别/锁定控制器单元测试。
|
||||
|
||||
覆盖:arm_detection 发 0x07(识别,目标类型)+0x0F(自动锁定)、
|
||||
stop_tracking 发 0x0E(停止)+0x08(识别关)。
|
||||
"""
|
||||
|
||||
from pod_bridge.protocol import ControlCode
|
||||
from task_runner.pod_control import PodController
|
||||
|
||||
|
||||
class FakeBridge:
|
||||
def __init__(self):
|
||||
self.sent = []
|
||||
|
||||
def send_control(self, cmd):
|
||||
self.sent.append(cmd)
|
||||
|
||||
|
||||
def test_arm_detection_sends_detect_and_autolock():
|
||||
bridge = FakeBridge()
|
||||
pc = PodController(bridge, target_type=1)
|
||||
pc.arm_detection()
|
||||
|
||||
assert len(bridge.sent) == 2
|
||||
assert bridge.sent[0].code == ControlCode.TARGET_DETECT_ON
|
||||
assert bridge.sent[0].param_x == 1 # 目标类型 1 = 无人机
|
||||
assert bridge.sent[1].code == ControlCode.AUTO_LOCK_ON_FOUND
|
||||
|
||||
|
||||
def test_arm_detection_default_target_type_is_person_vehicle():
|
||||
bridge = FakeBridge()
|
||||
pc = PodController(bridge) # 默认 target_type=0 = 人/车
|
||||
pc.arm_detection()
|
||||
assert bridge.sent[0].code == ControlCode.TARGET_DETECT_ON
|
||||
assert bridge.sent[0].param_x == 0
|
||||
|
||||
|
||||
def test_stop_tracking_sends_stop_and_detect_off():
|
||||
bridge = FakeBridge()
|
||||
pc = PodController(bridge)
|
||||
pc.stop_tracking()
|
||||
|
||||
assert len(bridge.sent) == 2
|
||||
assert bridge.sent[0].code == ControlCode.STOP_TRACK
|
||||
assert bridge.sent[1].code == ControlCode.TARGET_DETECT_OFF
|
||||
Reference in New Issue
Block a user