精简仓库结构并增强任务链路:归档双目可选后端、新增LOS判据与自定义返航

归档 legacy/:stereo_yolo/stereo_ranger/target_tracker 三包 + 175 条测试 + demo/配置/权重/三份规格;运行链路不再依赖,默认 pytest 446 条,归档测试按需运行。

目标有效性第二判据改为 LOS 运动学一致性(pod_bridge/los_consistency.py),删除 require_vision;pod_locked() 叠加该判据,状态机随之后退重搜。

自定义返航(task_runner/return_home.py):保持转场高度回起飞点 → 恢复初始航向 → 垂直降落,不再爬 RTL_RETURN_ALT;未起飞/无起飞点/超时/异常仍退回 PX4 原生 RTL。

任务链安全兜底:主循环异常→紧急返航、stop 幂等、landing_stop 保留遥测、in_air 流复用+超时、解锁/起飞与吊舱识别仅执行一次、rtl_timeout 上限。

入口共享件拆到 utils/sitl_support.py;pod_sitl_test.py→l1_sitl_test.py;删除旧架构 test.py;相机脚本移入 tools/。

新增 .gitignore 并剔除历史误跟踪的 59 个 .pyc;requirements 按实际依赖重写;文档全面对齐,新增 legacy/README.md 与 tools/README.md。
This commit is contained in:
keita
2026-10-21 14:48:41 +08:00
parent 53fdd3b13f
commit df91b1110e
159 changed files with 6121 additions and 1617 deletions
+24 -1
View File
@@ -30,7 +30,13 @@ class MavsdkCommandGateway:
self._started = False
async def start(self) -> bool:
"""进入 offboard:PX4 要求先流式发送首条设定点再请求启动。"""
"""进入 offboard:PX4 要求先流式发送首条设定点再请求启动。
幂等:已启动(或重入)时**不重发** offboard.start(),避免任务状态机重入
动作(丢目标后回 SEARCH/参考点)反复重启 offboard 造成模式抖动。
"""
if self._started:
return True
try:
await self._offboard.set_velocity_body(
self._velocity_body(0.0, 0.0, 0.0, 0.0))
@@ -42,6 +48,23 @@ class MavsdkCommandGateway:
logger.info("[MavsdkGateway] offboard 已启动")
return True
async def send_yaw_rate(self, yaw_rate_dps: float,
forward_mps: float = 0.0,
down_mps: float = 0.0) -> bool:
"""原地偏航扫视:零前向/侧向速度 + 指定偏航角速度(SEARCH 态扫视用)。
与 send_brake_hover 同类,但带角速度,故机头缓慢旋转、位置保持——
吊舱相机刚性固连机体,转弯即改变观察方向,以此覆盖参考点周边。
异常一律捕获返回 False(与其它指令一致,不向外抛)。
"""
try:
await self._offboard.set_velocity_body(
self._velocity_body(forward_mps, 0.0, down_mps, yaw_rate_dps))
except Exception as exc:
logger.warning("[MavsdkGateway] 扫视指令发送失败: %s", exc)
return False
return True
async def send_velocity_heading(self, output: ControlOutput,
time_boot_ms: Optional[int] = None) -> bool:
try: