Repository navigation
feat(ground): 新增 tire_slip_curve,把「轮胎附着随滑移率变化」做成可离线校验的曲线与 ABS 目标带 - #1246
Merged
Merged
Conversation
cwq319
approved these changes
Nov 11, 2026
# Conflicts: # docs/index.md # mkdocs.yml
xingwunian
approved these changes
Nov 11, 2026
xingwunian
left a comment
Contributor
There was a problem hiding this comment.
本地按贡献指南第 8 节核对过(fetch pull/1246/head 到本地、逐文件看改动、跑测试),没有阻断问题。
- 把
master(69cf47b)合进本分支,冲突只在mkdocs.yml/docs/index.md;处理方式是保留 master 已有的「VRU 冲突风险图」「里程计健康监视」两条入口,再把「轮胎滑移率-附着曲线」补进导航和首页 - 顺带修正首页那条
* 轮胎附着曲线与 ABS 目标带: './ground/tire_slip_curve.md'—— 单引号 + 没有链接语法,在 mkdocs 里渲染不出来,已改成* [轮胎滑移率-附着曲线](./ground/tire_slip_curve.md) —— ... tests/test_tire_slip_curve_local.py本地跑:通过 161 项,失败 0 项- 相对 master 的净变化 1573 行新增、0 行删除;
catkin_install_python三个脚本都在,package.xml用不到 numpy(只依赖 math/json)
改动只动了作者分支的合并与导航,代码逻辑没动。按贡献指南用 Squash and merge 合并。
This was referenced Nov 11, 2026
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.
修改概述:新增
tire_slip_curve包,把「轮胎附着系数随滑移率先升后降」这件事做成一条有闭式解的解析曲线,可离线运行、可断言,用来解释峰值附着与 ABS 目标带。修改的详细描述
1. 为什么加这个包
仓库里已有多个模块在使用附着系数(
braking_distance_check的减速度、turning_sweep_check的转弯极限、reverse_parking_planner的路径可行性),但没有一个模块回答「这个 μ 是哪来的」。而纵向控制里最容易出错的前提恰恰在这里:附着系数不是常数,它随滑移率先升后降,车轮抱死时只剩峰值的两三成,ABS 的目标就是把滑移率压在峰值附近。本包补上这一环:输入峰值滑移率与峰值附着,输出整条曲线、峰值/锁死/初段刚度/目标带四个关键量。
2. 曲线模型(有闭式解,才能被断言)
以归一化滑移率
ŝ = s / s_peak表示:ŝ = 0→μ = 0(自由滚动)ŝ = 1→μ = μ_peak(唯一极大)s = 1.0(车轮抱死)→μ = μ_peak·2k/(1+k²),k = 1/s_peakdμ/ds|₀ = 2·μ_peak / s_peak默认参数(
μ_peak=0.90、s_peak=0.12):锁死附着0.2129(占峰值 23.7%)、初段刚度15.000 1/s、ABS 目标带[0.0960, 0.1440]。选择这条曲线而不是魔术公式(Pacejka)的原因:魔术公式需要拟合 4 个系数、没有解析极大值,断言只能靠数值搜索;本包要讲的是「峰值 - 锁死 - 目标带」三个概念,有闭式解的曲线能被精确校验。真车标定时把
peak_slip/peak_friction换成实测值即可,0~0.4 区间的形状已足够接近。3. 四条断言
(s_peak, μ_peak)上μ(1.0)/μ_peak ≤ lock_friction_ratio(默认 0.85)s→0时μ ≈ (2μ_peak/s_peak)·s,相对误差 ≤ 2%s_peak默认工况 4 通过 / 0 失败,
结论:PASSED。4. 结构约定
scripts/main.py:入口(符合仓库main.*约定),只做sys.path注入与转发scripts/tire_core.py:纯数学,不 import rospy / numpy,可单独 import 做离线测试scripts/tire_node.py:ROS 收发,发布三个 latched 话题(/tire/report文本、/tire/curveCSV、/tire/peak_slipFloat64)config/tire_slip_curve.yaml:12 个参数;launch/main.launch:12 个带doc的<arg>+rosparam载入 + 12 个<param>覆盖rosparam get核对参数5. 离线与真机共用同一份数学
tire_core.py不依赖 ROS,离线测试与 ROS 节点调用的都是同一个TireSpec.friction();因此测试里写下的期望值就是运行时的真实输出,不存在「测试一套、节点另一套」。6. 自查修掉的问题
TireParams最初把非法参数延迟到spec()才校验,导致构造成功、使用才崩 —— 改成构造即报错,测试也相应改成断言构造抛TireError.底纹行render_curve最初按μ/1.0定纵轴,μ_peak=0.35(雪地)时曲线挤在底部 —— 改成按μ_peak·1.05归一7. 没改动什么
未修改
mkdocs.yml之外任何已有文件;本包为纯新增。docs/index.md与mkdocs.yml各加一行索引。经过了什么样的测试?
python3 tests/test_tire_slip_curve_local.py→ 通过 161 项,失败 0 项,退出码 0(不需要 ROS / CARLA / 显示器)python -m pytest tests/test_tire_slip_curve_local.py -q→ 8 组测试全部通过(_pytest_group包装保证失败会真抛AssertionError)catkin_make通过;roslaunch tire_slip_curve main.launch默认工况4 通过 / 0 失败、PASSEDsamples:=5→ 仅[FAIL] 峰值唯一;反例二lock_friction_ratio:=0.20→ 仅[FAIL] 锁死衰减运行效果(动图、视频、图片、链接等)
离线测试在无 ROS 环境下 161 项全过:
图 1

默认工况 4 条断言全过,报告里给出峰值、锁死占比、初段刚度与 ABS 目标带:
图 2

采样点数从 51 降到 5 后,
s=0.12的峰值落在两个采样点之间,抓到的最大值只有0.7022 @ s=0.25,峰值唯一失败:图 3

把锁死附着的上限从 85% 收到 20%,实测 23.7% 超限,
锁死衰减失败:图 4

参数确实经由 launch 传进节点(
0.12/0.85/dry_asphalt):图 5

所使用具体的大模型声明:使用大模型辅助代码编写、测试编写与文档整理,提交内容由本人负责。