Improve develop scripts#45
Conversation
Walkthrough新增一个用于启动 Foxglove 的 Bash 脚本,并在模板 shell 配置中将 ROS 环境变量从 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 分钟 诗歌
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.script/template/env_setup.zsh:
- Line 1: 文件开头的 shebang 写成 #!/bin/bash 与文件中使用的 zsh 特性不匹配(fpath、autoload -Uz
compinit、compinit),会误导开发者并触发静态检查错误;将 shebang 改为 zsh(例如 #!/usr/bin/env zsh 或
#!/bin/zsh)以匹配这些符号,或如果该脚本确实只能被 source 使用,添加注释说明仅供 sourcing 并保留 zsh shebang,确保涉及
fpath、autoload -Uz compinit 和 compinit 的代码块与新 shebang 一致。
🧹 Nitpick comments (1)
.script/foxglove (1)
3-3:~/env_setup.bash路径依赖隐式的文件部署。此处
source ~/env_setup.bash假设模板文件已被复制到用户的 home 目录。如果文件不存在,source会静默失败,后续ros2 launch可能因环境未配置而报出难以排查的错误。建议添加存在性检查,或直接引用仓库内的模板路径:
方案 A:添加检查
-source ~/env_setup.bash +if [ -f ~/env_setup.bash ]; then + source ~/env_setup.bash +else + echo "Error: ~/env_setup.bash not found" >&2 + exit 1 +fi方案 B:使用仓库内路径
-source ~/env_setup.bash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/template/env_setup.bash"
efb575f to
bf00a8a
Compare
PR 45 摘要:改进开发脚本
概述
此 PR 增强了开发环境脚本:新增用于启动 Foxglove Bridge 的脚本,并调整 ROS 环境变量以改变自动发现行为。
变更内容
新增文件
修改的文件
.script/template/env_setup.bash (+1/−1)
ROS_LOCALHOST_ONLY=1替换为ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST.script/template/env_setup.zsh (+2/−2)
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST,移除ROS_LOCALHOST_ONLY=1影响与注意事项