Repository navigation
feat(ground): 新增差速小车沿墙行驶模块 - #1150
Merged
tianyutu981 merged 1 commit intoNov 13, 2026
Merged
Conversation
Enemy52
suggested changes
Nov 12, 2026
Enemy52
left a comment
Contributor
There was a problem hiding this comment.
- CMakeLists.txt install 了不存在的
launch/目录:main.launch文件在包根目录,不是在launch/子目录里,但 CMakeLists 写的是install(DIRECTORY launch config ...),catkin_make会因为找不到launch/目录报错。要么把main.launch移到launch/子目录,要么改 install 路径。 - CI 0 个 check:根本没配 workflow,测试和构建都没在 CI 跑过。
- package.xml 还是
format="2":仓库其他包统一用format="3",升级一下。 - 测试文件放在仓库根目录的
tests/下:不是包内的test/目录,和其他包惯例不一致。
xinyangtang91
force-pushed
the
feat/diff_drive_wall_following
branch
2 times, most recently
from
November 12, 2026 14:30
55427db to
7aaee0d
Compare
Contributor
Author
|
已按评审意见修改并重新推送(分支已重建到最新 master):
本地验证:28 项测试通过、 |
This was referenced Nov 13, 2026
Contributor
|
地面载具里已有定点停车、避障和路径跟踪,但缺少一个只用一路激光 保持与墙距离的入门实验。沿墙行驶是理解激光分区、距离闭环和墙角 状态机的经典题目,也便于在没有 Gazebo 时用离线仿真复现。 - 新增 src/ground/diff_drive_wall_following:main.py 订阅 /scan、 发布 /cmd_vel;wall_follower.py 用右侧距离误差与车身夹角误差计算 角速度,正前方过近时进入原地左转状态;包含 launch、参数文件和 离线仿真脚本。 - 新增 docs/ground/diff_drive_wall_following.md:原理、状态图、参数、 ROS 与离线两种运行步骤、三张结果图和指标表。 - 首页与 mkdocs 导航加入口。 评审修复: - main.launch 移到 launch/ 目录,与 install(DIRECTORY launch ...) 一致; - package.xml 升级为 format="3"; - 本地测试从仓库根 tests/ 移到包内 test/ 目录; - 新增 .github/workflows/diff_drive_wall_following_tests.yml,push/PR 时自动运行模块测试、字节编译并构建文档。 验证:离线仿真在 Windows + Python 3.12 实际运行,绕行一圈 60.95 s、 路径 17.06 m、平均跟墙误差 0.031 m、最大 0.273 m;本地测试 28 项通过; mkdocs build 通过。ROS 端未在本机实机验证(没有 ROS 与 Gazebo), 需在 Noetic + TurtleBot3 上复验。 评审修复(第二轮): - docs job 改为安装仓库根的 requirements.txt(仓库没有 requirements-docs.txt),并显式安装 mkdocs 本体,避免只依赖插件的 传递依赖; - WallFollower.update 对 inf 测距做兜底:单路缺失时用 side 代替, 两路都缺失时跳过夹角项,避免 inf-inf=NaN 进入 cmd_vel; - main.py 发布前再次检查线速度/角速度有限性,异常时归零; - 新增 4 项测距缺失单元测试,本地测试 32 项通过。
xinyangtang91
force-pushed
the
feat/diff_drive_wall_following
branch
from
November 13, 2026 11:55
7aaee0d to
bd65394
Compare
Contributor
Author
|
已按评审意见修改并重新推送:
分支已重建到最新 master,PR 现在 |
tianyutu981
approved these changes
Nov 13, 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.
修改目的与内容
地面载具里已有定点停车、避障、路径跟踪等模块,但缺少一个「只用一路激光保持与墙距离」的入门实验。沿墙行驶是理解激光分区、距离闭环和墙角状态机的经典题目,也便于在没有 Gazebo 和实车的情况下用离线仿真复现。
本 PR 新增地面载具模块
diff_drive_wall_following:src/ground/diff_drive_wall_following/:main.py订阅/scan(LaserScan),取正前、正右、右前、右后、正左五路距离,发布/cmd_vel(Twist);wall_follower.py用右侧距离误差和车身夹角误差计算角速度,正前方过近时进入原地左转状态;含main.launch、config/params.yaml、README.md和离线仿真offline_sim.py。scan_timeout(0.5 s)没有更新时发布零速度;角速度越大线速度越低;退出时发布零速度。docs/ground/diff_drive_wall_following.md:五路测距说明、控制律、墙角状态图、ROS 与离线两种运行步骤、三张结果图和指标表。docs/index.md与mkdocs.yml导航加入口。tests/test_diff_drive_wall_following_local.py:不依赖 ROS 的沿墙控制、墙角切换、限幅和工程文件检查。已知限制:离线仿真是理想矩形房间 + 简化运动学,不含轮子打滑和真实激光噪声;本机没有 ROS 与 Gazebo,ROS 端实际运行尚未验证。
测试环境与结果
python src/ground/diff_drive_wall_following/offline_sim.pypython tests/test_diff_drive_wall_following_local.pypython -m mkdocs buildpython -m mkdocs serve --dev-addr 127.0.0.1:8002 --livereloadcp -r src/ground/diff_drive_wall_following ~/catkin_ws/src/ && cd ~/catkin_ws && catkin_make && source devel/setup.bash && roslaunch diff_drive_wall_following main.launchmkdocs build通过(27.03 秒);mkdocs serve下新页面、导航入口和三张图片均返回 200;main.py在 ROS 中与 Gazebo/实车激光雷达的联调、catkin_make编译、main.launch启动。运行效果
沿右侧墙绕行一圈的轨迹(蓝:沿墙,红:墙角转向):
右侧墙距离:
速度指令:
三张图由
offline_sim.py在本机实际运行生成;ROS 端接入 Gazebo/实车后的效果待另一台机器复验后补充。提交前检查
git diff与 PR 页面均只有本模块的 15 个文件;分支基于最新 master,无冲突。)main.py、main.launch、package.xml、CMakeLists.txt已提供,依赖与安装路径已检查;但 README 的 ROS 运行步骤未在本机执行,因为本机没有 ROS,待另一台机器验证。)大模型使用声明