Skip to content

feat: 2-terminal demo scripts for ROS 1 <-> ROS 2 bridge#26

Merged
ycpss91255 merged 2 commits intomainfrom
feat/demo-bridge-scripts
Apr 24, 2026
Merged

feat: 2-terminal demo scripts for ROS 1 <-> ROS 2 bridge#26
ycpss91255 merged 2 commits intomainfrom
feat/demo-bridge-scripts

Conversation

@ycpss91255
Copy link
Copy Markdown
Contributor

@ycpss91255 ycpss91255 commented Apr 24, 2026

Summary

  • Add four demo helpers — script/ros{1,2}_{server,client}.sh — that drive an end-to-end std_msgs/String bridge across two terminals. Server side self-bootstraps roscore + parameter_bridge (loads /demo_bridge.yaml) and publishes; client side just subscribes. Each step is logged explicitly ([ros1_server] step N/4: ...) so the user can see when roscore and the bridge are up.
  • Bake config/demo_bridge.yaml into the image as /demo_bridge.yaml so the demo scripts pick it up without env overrides. Switch Dockerfile COPY script/... to a directory glob so future helpers are picked up automatically.
  • Each command in the server scripts runs in its own subshell that sources only the ROS env it needs (ROS 1, ROS 2, or both for parameter_bridge). This avoids the ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' failure that happens when both distros are sourced into one shell — roscore is a Python script and sys.path resolves rosgraph_msgs to ROS 2's copy (which lacks Log). The fix is split across two commits in this PR so the failure mode stays in the history.
  • Tests: 28 → 37 (9 new smoke tests covering existence + executability + -h Usage for each demo helper, plus /demo_bridge.yaml presence). doc/test/TEST.md, doc/changelog/CHANGELOG.md, and all four READMEs (en / zh-TW / zh-CN / ja) updated.

Test plan

  • Local ./build.sh test — 37/37 bats green, ShellCheck and Hadolint clean
  • Jetson (arm64) end-to-end:
    • Demo A: ./exec.sh /ros1_server.sh + ./exec.sh /ros2_client.sh — ROS 2 client receives hello from ROS 1
    • Demo B: ./exec.sh /ros2_server.sh + ./exec.sh /ros1_client.sh — ROS 1 client receives hello from ROS 2
    • Server Ctrl+C tears down parameter_bridge + roscore; client EOFs
  • CI build-worker green on amd64 (run #24881216285)
  • CI build-worker green on arm64 — blocked on ci: enable arm64 in build matrix (linux/amd64,linux/arm64) #27 (this PR's main.yaml does not yet opt in to the arm64 matrix). After ci: enable arm64 in build matrix (linux/amd64,linux/arm64) #27 merges, this PR will be rebased onto main and re-tested.

…yaml)

Symmetric server/client pair that runs an end-to-end std_msgs/String
bridge demo across two terminals. Server scripts self-bootstrap roscore
+ parameter_bridge with explicit step-by-step logs ([ros1_server] step
N/5: ...); client scripts only source the relevant distro and subscribe.

- script/ros1_server.sh + ros2_client.sh: Demo A (ROS 1 -> ROS 2)
- script/ros2_server.sh + ros1_client.sh: Demo B (ROS 2 -> ROS 1)
- config/demo_bridge.yaml -> /demo_bridge.yaml in image (no env override needed)
- Dockerfile COPY script/ glob picks up the four new helpers automatically
- 9 new smoke tests (28 -> 37): exists+executable + -h prints Usage for
  each script, plus /demo_bridge.yaml exists
…shells

Sourcing both ROS 1 (noetic) and ROS 2 (foxy) into the same shell breaks
roscore: it's a Python script that imports rosgraph_msgs.msg.Log, but
sys.path resolves rosgraph_msgs to ROS 2's copy (which lacks Log) when
ROS 2 is sourced last. Result on Jetson:

  ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg'

Restructure ros{1,2}_server.sh so the main shell never sources either
distro; each command runs in a subshell that sources only what it needs:

  - roscore / rostopic / rosparam  -> ROS 1 only
  - parameter_bridge               -> ROS 1 + ROS 2
  - ros2 topic pub/echo            -> ROS 2 only

Subshells use `( ros1_env; exec <cmd> )` so $! captures the actual
command PID (not a wrapper), keeping the trap cleanup correct.

Verified end-to-end on Jetson (arm64): both Demo A (ROS 1 -> ROS 2) and
Demo B (ROS 2 -> ROS 1) pub/echo across the bridge as expected.
@ycpss91255 ycpss91255 force-pushed the feat/demo-bridge-scripts branch from 142bce6 to 058b25d Compare April 24, 2026 12:11
@ycpss91255 ycpss91255 merged commit 5b626e6 into main Apr 24, 2026
5 checks passed
@ycpss91255 ycpss91255 deleted the feat/demo-bridge-scripts branch April 24, 2026 12:15
@ycpss91255 ycpss91255 mentioned this pull request Apr 24, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant