Skip to content

Improve develop scripts#45

Merged
creeper5820 merged 1 commit into
mainfrom
feat/new-dev-scripts
Feb 7, 2026
Merged

Improve develop scripts#45
creeper5820 merged 1 commit into
mainfrom
feat/new-dev-scripts

Conversation

@creeper5820

@creeper5820 creeper5820 commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

PR 45 摘要:改进开发脚本

概述

此 PR 增强了开发环境脚本:新增用于启动 Foxglove Bridge 的脚本,并调整 ROS 环境变量以改变自动发现行为。

变更内容

新增文件

  • .script/foxglove (+5 行)
    • 新增 Bash 脚本以启动 Foxglove Bridge
    • 源加载环境配置文件(env_setup.bash)
    • 使用 ros2 launch 启动 foxglove_bridge_launch.xml,指定端口 port:=8765
    • 控制流程简单:先 source 环境,再执行 launch,未加入错误处理或额外逻辑

修改的文件

  • .script/template/env_setup.bash (+1/−1)

    • 将原来的导出变量 ROS_LOCALHOST_ONLY=1 替换为 ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST
    • 意图从单一的“仅本地”限制改为使用自动发现范围的配置项
  • .script/template/env_setup.zsh (+2/−2)

    • 将脚本改为 zsh(shebang 改为 /bin/zsh)
    • 同步添加 ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST,移除 ROS_LOCALHOST_ONLY=1

影响与注意事项

  • 改动主要影响本地开发环境的 ROS 网络发现配置与一个便捷的 Foxglove 启动脚本。
  • 新增脚本没有添加错误处理;环境变量替换可能改变节点发现行为,需在多主机或网络复杂环境下验证。

@coderabbitai

coderabbitai Bot commented Feb 7, 2026

Copy link
Copy Markdown

Walkthrough

新增一个用于启动 Foxglove 的 Bash 脚本,并在模板 shell 配置中将 ROS 环境变量从 ROS_LOCALHOST_ONLY=1 替换为 ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST,脚本先加载环境配置再执行 ros2 launch 启动桥接服务。

Changes

Cohort / File(s) Summary
Foxglove 启动脚本
.script/foxglove
新增 Bash 脚本,包含 shebang、source 环境加载(env_setup.bash),执行 ros2 launch ... foxglove_bridge_launch.xml port:=8765。无额外错误处理。
Bash 环境模板
.script/template/env_setup.bash
将导出变量从 ROS_LOCALHOST_ONLY=1 更改为 ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST(仅变量替换,无其他逻辑改动)。
Zsh 环境模板
.script/template/env_setup.zsh
shebang 改为 /bin/zsh(已存在),添加 ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST 并移除 ROS_LOCALHOST_ONLY=1

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 分钟

诗歌

🐇 新脚本轻跳跃,端口八七六五迎接夜,
环境换名更明晰,localhost 默然相依,
兔子鼓掌称奇异,桥梁连通星与地。

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive 标题"Improve develop scripts"过于宽泛且缺乏具体性。虽然与变更相关,但没有清晰说明主要改动,如添加foxglove脚本或更新ROS环境变量。 建议更具体的标题如"Add foxglove launch script and update ROS discovery settings"或"Add foxglove bridge launcher and update ROS environment variables"。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/new-dev-scripts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Comment thread .script/template/env_setup.zsh Outdated
@creeper5820 creeper5820 merged commit e05085a into main Feb 7, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in RMCS Feb 7, 2026
@creeper5820 creeper5820 deleted the feat/new-dev-scripts branch February 7, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant