Repository navigation
feat(air): 新增低空多机路权判定与让路恢复 - #1010
Open
usernamekkyy wants to merge 1 commit into
Open
usernamekkyy wants to merge 1 commit into
usernamekkyy wants to merge 1 commit into
Conversation
两机 8 s 内 CPA < 40 m 时按四条规则(优先级/左让右/对头右转/左侧 追越)即时给出让路动作,决策理由逐条落盘可审计;脱离威胁后按余弦 剖面回到计划航路,恢复期间持续监视二次冲突。三场景 MuJoCo 真飞 对比:对头 1.68→14.56 m,交叉 1.19→33.44 m,追越 0.42→19.98 m。 48 项单元测试通过。 作业信息:黄家欣 2535030010
Contributor
Author
Contributor
Author
LinFengCi
requested changes
Nov 12, 2026
LinFengCi
left a comment
Contributor
There was a problem hiding this comment.
审核未通过,需修改后重提。
主要问题:缺少大模型使用声明(仓库 README L58 明确要求“使用大模型需要在最后声明,并对提交内容负全部责”)。
- 你的同批其他 PR(#1275/#1274/#1273/#1272)均在描述与 README 末尾明确写了“使用 OpenAI Codex 辅助……提交者复核并对提交内容负责”。本 PR 描述中未见任何大模型声明。
- 若该模块使用了大模型(含 Codex 等)辅助生成/整理,请按仓库要求在 PR 描述末尾补充声明,点名具体工具并明确“提交者复核并对内容负责”;若确实未使用,也请简要说明。
其余均合规,已本地复现:pytest 45 passed + 1 skipped(无 ROS/MuJoCo 的干净环境下核心逻辑跑通),文件结构(src/air/uav_right_of_way + docs/air)、命名、入口 main.py + launch/main.launch.py、导航栏与首页跳转、运行效果图(cross/headon/overtake.gif 及 trajectories.png,均<10MB)均符合规范。补完声明后即可批准合并。
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
模块简介
新增
src/air/uav_right_of_way:两架无人机在空中近距离相遇时的在线让路决策。uav_deconflict在起飞前把计划层的冲突解掉(改起飞时刻/高度/航路),但计划赶不上变化——风、计时误差、临时任务都会让两机在空中实际靠近。这个模块补的是飞行中这一层:预测 8 s 内两机最近距离小于 40 m 就触发决策,按四条规则(优先级 → 左让右 → 对头各右转 → 追越从左侧)给出动作,并把每条决策的理由字符串落盘,事后可逐条对账。威胁过去后按余弦剖面回到计划航路,恢复期间继续检测,有二次冲突就重新让。全程不改飞行计划。让路动作四种,都作用在参考速度上,控制器本身不动:右转 30°、降高 10 m、减速 30%、左侧追越偏置(20 m)。
效果动图
三个场景各录了一段,左栏不开规则直飞、右栏开规则,同一时刻同帧对比。录的是 MuJoCo 刚体积分出来的真实位置(由
tools/make_gif.py重新跑仿真生成,不是示意动画):三场景轨迹总览(虚线基线、实线规则启用):
结果
全程机对间最小三维距离(越小越危险):
代价是航迹偏离计划的平均值从 2
3 m 涨到 48 m,属于让路的正常开销。一条决策日志长这样(
results/<场景>_result.json的decision_log):复现
测试在只装 numpy/matplotlib/pyyaml/pytest 的环境也能全过(闭环用例自动退化成运动学参考点跑通),不需要 ROS 2,也不需要装 MuJoCo。
主要改动
core/detect.py:相对运动解析求 CPA,0 < t_cpa ≤ 8 s且d_cpa < 40 m判侵入;正在远离不算威胁core/rules.py:四条规则引擎,几何分类看航向差(>150° 对头、<10° 追越、其余交叉),左右侧用航向叉积符号core/recover.py:威胁消失后观察 3 s,余弦剖面(1 + cos πs)/2恢复,两端速度为零不激励姿态环core/sim.py:每架机独立实例化uav_mujoco_sim的Quadrotor+GeometricController;参考速度前馈一阶低通 τ=0.5 s、姿态阻尼 kw≈−0.18,与uav_deconflict/core/sim.py同一写法ros/row_node.py:在线决策节点,订阅<prefix><n>/odom,命中规则就往/uav_right_of_way/commands发 JSON(动作+理由);判定逻辑全在core/,节点是收发薄壳tools/make_gif.py:跑一遍三场景,录 gif 和总览图docs/air/uav_right_of_way.md文档页;mkdocs.yml、docs/index.md各加一行导航(插在着陆载荷预测之后,与在审 PR 的插入位置错开)已知限制
提交前检查
git merge upstream/master实测自动合并通过)python -m pytest test/ -q:48 passed(6.6 s,本机带 MuJoCo;干净环境 48 passed,闭环用例自动退化)results/*.json),动图用仓库内相对路径引用,不依赖 fork raw 链接