复杂动态环境中完成目标导航#3189
Merged
Merged
Conversation
1. 核心修改:在 main.py 头部新增自动切换工作目录逻辑 - 通过 os.path 获取脚本绝对路径,计算并切换到项目根目录(D:\pycharm\nn2) - 统一相对路径基准,避免因运行目录不同导致的路径错误 2. 增强鲁棒性: - 新增模型路径存在性检查,提前捕获「文件不存在」错误并给出明确提示 - 路径使用正斜杠(/)替代反斜杠(\),保证 Windows/macOS/Linux 跨平台兼容性 - 打印日志增加 [INFO]/[SUCCESS]/[ERROR] 前缀,便于调试定位问题 3. 解决的核心问题: - 原版代码因相对路径基准不统一,频繁出现「No such file or directory」错误 - 无需手动修改模型路径,支持从任意目录运行 main.py 仍能正常加载 humanoid.xml 修改文件:src/humanoid_motion_control/main.py
1. 核心修改:在 main.py 头部新增自动切换工作目录逻辑 - 通过 os.path 获取脚本绝对路径,计算并切换到项目根目录(D:\pycharm\nn2) - 统一相对路径基准,避免因运行目录不同导致的路径错误 2. 增强鲁棒性: - 新增模型路径存在性检查,提前捕获「文件不存在」错误并给出明确提示 - 路径使用正斜杠(/)替代反斜杠(\),保证 Windows/macOS/Linux 跨平台兼容性 - 打印日志增加 [INFO]/[SUCCESS]/[ERROR] 前缀,便于调试定位问题 3. 解决的核心问题: - 原版代码因相对路径基准不统一,频繁出现「No such file or directory」错误 - 无需手动修改模型路径,支持从任意目录运行 main.py 仍能正常加载 humanoid.xml 修改文件:src/humanoid_motion_control/main.py
1. 核心修改:在 main.py 头部新增自动切换工作目录逻辑 - 通过 os.path 获取脚本绝对路径,计算并切换到项目根目录(D:\pycharm\nn2) - 统一相对路径基准,避免因运行目录不同导致的路径错误 2. 增强鲁棒性: - 新增模型路径存在性检查,提前捕获「文件不存在」错误并给出明确提示 - 路径使用正斜杠(/)替代反斜杠(\),保证 Windows/macOS/Linux 跨平台兼容性 - 打印日志增加 [INFO]/[SUCCESS]/[ERROR] 前缀,便于调试定位问题 3. 解决的核心问题: - 原版代码因相对路径基准不统一,频繁出现「No such file or directory」错误 - 无需手动修改模型路径,支持从任意目录运行 main.py 仍能正常加载 humanoid.xml 修改文件:src/humanoid_motion_control/main.py
donghaiwang
approved these changes
Dec 15, 2025
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.
修改概述:
修改的详细描述
新增 3 个不同运动特性的动态障碍(总计 4 个障碍:1 固定 + 3 动态)
为每个动态障碍设计差异化复杂运动模式(正弦组合、随机游走、圆周运动)
优化避障逻辑适配多障碍场景(多目标检测、优先级避障)
保留原导航功能,确保机器人能在复杂动态环境中完成目标导航
复杂运动模式实现:
正弦组合运动:wall2 同时在 Y 轴(水平)和 Z 轴(垂直)做不同频率的正弦运动,模拟上下 + 左右摆动
随机游走运动:wall3 随机切换运动方向和速度,模拟不可预测的障碍运动
圆周运动:wall4 绕固定中心旋转,同时径向半径做正弦变化,模拟弧形运动障碍
1.
2.
经过了什么样的测试?
运行效果
动图、视频、截图等
