From 9a91fd61fb77a0d2048424585e3029da7b3d60a6 Mon Sep 17 00:00:00 2001 From: Not-NeoN-sup Date: Sun, 29 Mar 2026 02:39:09 +0530 Subject: [PATCH 1/4] docs: add ROS2 + Gazebo Docker bridge setup guide for harmonic, ionic, jetty, garden Signed-off-by: Not-NeoN-sup --- garden/ros2_gz_docker_bridge.md | 174 ++++++++++++++++++++++++++++++ garden/tutorials.md | 1 + harmonic/ros2_gz_docker_bridge.md | 174 ++++++++++++++++++++++++++++++ harmonic/tutorials.md | 2 +- ionic/ros2_gz_docker_bridge.md | 174 ++++++++++++++++++++++++++++++ ionic/tutorials.md | 1 + jetty/ros2_gz_docker_bridge.md | 174 ++++++++++++++++++++++++++++++ jetty/tutorials.md | 1 + 8 files changed, 700 insertions(+), 1 deletion(-) create mode 100644 garden/ros2_gz_docker_bridge.md create mode 100644 harmonic/ros2_gz_docker_bridge.md create mode 100644 ionic/ros2_gz_docker_bridge.md create mode 100644 jetty/ros2_gz_docker_bridge.md diff --git a/garden/ros2_gz_docker_bridge.md b/garden/ros2_gz_docker_bridge.md new file mode 100644 index 0000000000..911a594d67 --- /dev/null +++ b/garden/ros2_gz_docker_bridge.md @@ -0,0 +1,174 @@ +# ROS2 + Gazebo Docker Bridge + +A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them + +--- + +## Compatibility + +| ROS2 | Gazebo | +|---|---| +| Rolling | Jetty | +| Kilted | Ionic | +| Jazzy | Harmonic | +| Iron | Harmonic | +| Humble | Fortress | + +--- + +## Prerequisites + +- Docker installed and running +- Both images built: + - `gazebo` — from `dockerfile.gazebo` + - `ros2` — from your ROS2 Dockerfile +- `ros-gz-bridge` installed + +--- + +## Setup + +### 1. Create the Docker Network + +```bash +docker network create ros-link +``` + +### 2. Start Containers + +```bash +docker run -it -d --name gazebo-container --network ros-link gazebo sleep infinity +docker run -it -d --name ros2-container --network ros-link ros2 sleep infinity +``` + +### 3. Check Container IPs + + +```bash +docker network inspect ros-link +``` + +Example output: +```json +[ + { + "Name": "ros-link", + "Driver": "bridge", + "IPAM": { + "Config": [{ "Subnet": "172.21.0.0/16", "Gateway": "172.21.0.1" }] + }, + "Containers": { + "281b3cbfba6a...": { + "Name": "ros2-container", + "IPv4Address": "172.21.0.3/16" // + }, + "c2410d610249...": { + "Name": "gazebo-container", + "IPv4Address": "172.21.0.2/16" // + } + } + } +] +``` + +--- + +### 4. Configure Environment Variables + +**In `gazebo-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +``` + +**In `ros2-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +source /opt/ros//setup.bash +``` + +> Add these to `~/.bashrc` in each container to be available across sessions. + +--- + +### 5. Install the Bridge + +```bash +apt-get update && apt-get install -y ros--ros-gz-bridge +``` + +--- + +## Using a Config File (optional) + +if you have a `bridge.yaml` config file, you can use it instead of passing topics as arguments: + +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` + +a typical `bridge.yaml` looks like this: + +```yaml +- ros_topic_name: /clock + gz_topic_name: /clock + ros_type_name: rosgraph_msgs/msg/Clock + gz_type_name: gz.msgs.Clock + direction: GZ_TO_ROS +``` + +--- + +## Running the Bridge + +### Terminal 1 — Start Gazebo sim + +```bash +docker exec -it gazebo-container bash +gz sim shapes.sdf +``` + +### Terminal 2 — Start the bridge + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock +``` + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 topic echo /clock +``` +if you see something like this :- +```bash +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +``` +then the connection between the two docker containers is succesfull + +--- + +## Final Network Info + +| Container | IP | Role | +|---|---|---| +| `gazebo-container` | `` | Runs Gazebo simulation | +| `ros2-container` | `` | Runs ROS2 + bridge | + +Network name: `ros-link` \ No newline at end of file diff --git a/garden/tutorials.md b/garden/tutorials.md index 29ae7d42ad..6a88a241f5 100644 --- a/garden/tutorials.md +++ b/garden/tutorials.md @@ -23,6 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) +* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials diff --git a/harmonic/ros2_gz_docker_bridge.md b/harmonic/ros2_gz_docker_bridge.md new file mode 100644 index 0000000000..911a594d67 --- /dev/null +++ b/harmonic/ros2_gz_docker_bridge.md @@ -0,0 +1,174 @@ +# ROS2 + Gazebo Docker Bridge + +A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them + +--- + +## Compatibility + +| ROS2 | Gazebo | +|---|---| +| Rolling | Jetty | +| Kilted | Ionic | +| Jazzy | Harmonic | +| Iron | Harmonic | +| Humble | Fortress | + +--- + +## Prerequisites + +- Docker installed and running +- Both images built: + - `gazebo` — from `dockerfile.gazebo` + - `ros2` — from your ROS2 Dockerfile +- `ros-gz-bridge` installed + +--- + +## Setup + +### 1. Create the Docker Network + +```bash +docker network create ros-link +``` + +### 2. Start Containers + +```bash +docker run -it -d --name gazebo-container --network ros-link gazebo sleep infinity +docker run -it -d --name ros2-container --network ros-link ros2 sleep infinity +``` + +### 3. Check Container IPs + + +```bash +docker network inspect ros-link +``` + +Example output: +```json +[ + { + "Name": "ros-link", + "Driver": "bridge", + "IPAM": { + "Config": [{ "Subnet": "172.21.0.0/16", "Gateway": "172.21.0.1" }] + }, + "Containers": { + "281b3cbfba6a...": { + "Name": "ros2-container", + "IPv4Address": "172.21.0.3/16" // + }, + "c2410d610249...": { + "Name": "gazebo-container", + "IPv4Address": "172.21.0.2/16" // + } + } + } +] +``` + +--- + +### 4. Configure Environment Variables + +**In `gazebo-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +``` + +**In `ros2-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +source /opt/ros//setup.bash +``` + +> Add these to `~/.bashrc` in each container to be available across sessions. + +--- + +### 5. Install the Bridge + +```bash +apt-get update && apt-get install -y ros--ros-gz-bridge +``` + +--- + +## Using a Config File (optional) + +if you have a `bridge.yaml` config file, you can use it instead of passing topics as arguments: + +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` + +a typical `bridge.yaml` looks like this: + +```yaml +- ros_topic_name: /clock + gz_topic_name: /clock + ros_type_name: rosgraph_msgs/msg/Clock + gz_type_name: gz.msgs.Clock + direction: GZ_TO_ROS +``` + +--- + +## Running the Bridge + +### Terminal 1 — Start Gazebo sim + +```bash +docker exec -it gazebo-container bash +gz sim shapes.sdf +``` + +### Terminal 2 — Start the bridge + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock +``` + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 topic echo /clock +``` +if you see something like this :- +```bash +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +``` +then the connection between the two docker containers is succesfull + +--- + +## Final Network Info + +| Container | IP | Role | +|---|---|---| +| `gazebo-container` | `` | Runs Gazebo simulation | +| `ros2-container` | `` | Runs ROS2 + bridge | + +Network name: `ros-link` \ No newline at end of file diff --git a/harmonic/tutorials.md b/harmonic/tutorials.md index facda5b02c..0805a915ab 100644 --- a/harmonic/tutorials.md +++ b/harmonic/tutorials.md @@ -23,7 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) - +* [ROS 2 Docker Bridge Setup](ros_docker_gz_integration) ## Per-library tutorials See the *API & Tutorials* sections on the [Libraries page](/libs){.external} page for more specific content correlating to each Gazebo library. diff --git a/ionic/ros2_gz_docker_bridge.md b/ionic/ros2_gz_docker_bridge.md new file mode 100644 index 0000000000..911a594d67 --- /dev/null +++ b/ionic/ros2_gz_docker_bridge.md @@ -0,0 +1,174 @@ +# ROS2 + Gazebo Docker Bridge + +A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them + +--- + +## Compatibility + +| ROS2 | Gazebo | +|---|---| +| Rolling | Jetty | +| Kilted | Ionic | +| Jazzy | Harmonic | +| Iron | Harmonic | +| Humble | Fortress | + +--- + +## Prerequisites + +- Docker installed and running +- Both images built: + - `gazebo` — from `dockerfile.gazebo` + - `ros2` — from your ROS2 Dockerfile +- `ros-gz-bridge` installed + +--- + +## Setup + +### 1. Create the Docker Network + +```bash +docker network create ros-link +``` + +### 2. Start Containers + +```bash +docker run -it -d --name gazebo-container --network ros-link gazebo sleep infinity +docker run -it -d --name ros2-container --network ros-link ros2 sleep infinity +``` + +### 3. Check Container IPs + + +```bash +docker network inspect ros-link +``` + +Example output: +```json +[ + { + "Name": "ros-link", + "Driver": "bridge", + "IPAM": { + "Config": [{ "Subnet": "172.21.0.0/16", "Gateway": "172.21.0.1" }] + }, + "Containers": { + "281b3cbfba6a...": { + "Name": "ros2-container", + "IPv4Address": "172.21.0.3/16" // + }, + "c2410d610249...": { + "Name": "gazebo-container", + "IPv4Address": "172.21.0.2/16" // + } + } + } +] +``` + +--- + +### 4. Configure Environment Variables + +**In `gazebo-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +``` + +**In `ros2-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +source /opt/ros//setup.bash +``` + +> Add these to `~/.bashrc` in each container to be available across sessions. + +--- + +### 5. Install the Bridge + +```bash +apt-get update && apt-get install -y ros--ros-gz-bridge +``` + +--- + +## Using a Config File (optional) + +if you have a `bridge.yaml` config file, you can use it instead of passing topics as arguments: + +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` + +a typical `bridge.yaml` looks like this: + +```yaml +- ros_topic_name: /clock + gz_topic_name: /clock + ros_type_name: rosgraph_msgs/msg/Clock + gz_type_name: gz.msgs.Clock + direction: GZ_TO_ROS +``` + +--- + +## Running the Bridge + +### Terminal 1 — Start Gazebo sim + +```bash +docker exec -it gazebo-container bash +gz sim shapes.sdf +``` + +### Terminal 2 — Start the bridge + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock +``` + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 topic echo /clock +``` +if you see something like this :- +```bash +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +``` +then the connection between the two docker containers is succesfull + +--- + +## Final Network Info + +| Container | IP | Role | +|---|---|---| +| `gazebo-container` | `` | Runs Gazebo simulation | +| `ros2-container` | `` | Runs ROS2 + bridge | + +Network name: `ros-link` \ No newline at end of file diff --git a/ionic/tutorials.md b/ionic/tutorials.md index facda5b02c..fd3930f8b7 100644 --- a/ionic/tutorials.md +++ b/ionic/tutorials.md @@ -23,6 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) +* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials diff --git a/jetty/ros2_gz_docker_bridge.md b/jetty/ros2_gz_docker_bridge.md new file mode 100644 index 0000000000..911a594d67 --- /dev/null +++ b/jetty/ros2_gz_docker_bridge.md @@ -0,0 +1,174 @@ +# ROS2 + Gazebo Docker Bridge + +A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them + +--- + +## Compatibility + +| ROS2 | Gazebo | +|---|---| +| Rolling | Jetty | +| Kilted | Ionic | +| Jazzy | Harmonic | +| Iron | Harmonic | +| Humble | Fortress | + +--- + +## Prerequisites + +- Docker installed and running +- Both images built: + - `gazebo` — from `dockerfile.gazebo` + - `ros2` — from your ROS2 Dockerfile +- `ros-gz-bridge` installed + +--- + +## Setup + +### 1. Create the Docker Network + +```bash +docker network create ros-link +``` + +### 2. Start Containers + +```bash +docker run -it -d --name gazebo-container --network ros-link gazebo sleep infinity +docker run -it -d --name ros2-container --network ros-link ros2 sleep infinity +``` + +### 3. Check Container IPs + + +```bash +docker network inspect ros-link +``` + +Example output: +```json +[ + { + "Name": "ros-link", + "Driver": "bridge", + "IPAM": { + "Config": [{ "Subnet": "172.21.0.0/16", "Gateway": "172.21.0.1" }] + }, + "Containers": { + "281b3cbfba6a...": { + "Name": "ros2-container", + "IPv4Address": "172.21.0.3/16" // + }, + "c2410d610249...": { + "Name": "gazebo-container", + "IPv4Address": "172.21.0.2/16" // + } + } + } +] +``` + +--- + +### 4. Configure Environment Variables + +**In `gazebo-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +``` + +**In `ros2-container`:** +```bash +export GZ_IP= +export GZ_PARTITION=gazebo-container +source /opt/ros//setup.bash +``` + +> Add these to `~/.bashrc` in each container to be available across sessions. + +--- + +### 5. Install the Bridge + +```bash +apt-get update && apt-get install -y ros--ros-gz-bridge +``` + +--- + +## Using a Config File (optional) + +if you have a `bridge.yaml` config file, you can use it instead of passing topics as arguments: + +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` + +a typical `bridge.yaml` looks like this: + +```yaml +- ros_topic_name: /clock + gz_topic_name: /clock + ros_type_name: rosgraph_msgs/msg/Clock + gz_type_name: gz.msgs.Clock + direction: GZ_TO_ROS +``` + +--- + +## Running the Bridge + +### Terminal 1 — Start Gazebo sim + +```bash +docker exec -it gazebo-container bash +gz sim shapes.sdf +``` + +### Terminal 2 — Start the bridge + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock +``` + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash +ros2 topic echo /clock +``` +if you see something like this :- +```bash +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +clock: + sec: 0 + nanosec: 0 +--- +``` +then the connection between the two docker containers is succesfull + +--- + +## Final Network Info + +| Container | IP | Role | +|---|---|---| +| `gazebo-container` | `` | Runs Gazebo simulation | +| `ros2-container` | `` | Runs ROS2 + bridge | + +Network name: `ros-link` \ No newline at end of file diff --git a/jetty/tutorials.md b/jetty/tutorials.md index 6b5d9913bd..b30c7d1ad1 100644 --- a/jetty/tutorials.md +++ b/jetty/tutorials.md @@ -23,6 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) +* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials From cff2d60afb78ec94bd33584c64fea66fff2ca6fe Mon Sep 17 00:00:00 2001 From: Not-NeoN-sup Date: Wed, 6 May 2026 13:11:19 +0000 Subject: [PATCH 2/4] changes addressed --- garden/ros2_gz_docker_bridge.md | 69 ++++++++++++++++-------------- garden/tutorials.md | 2 +- harmonic/ros2_gz_docker_bridge.md | 71 +++++++++++++++---------------- harmonic/tutorials.md | 2 +- ionic/ros2_gz_docker_bridge.md | 69 ++++++++++++++++-------------- ionic/tutorials.md | 2 +- jetty/ros2_gz_docker_bridge.md | 69 ++++++++++++++++-------------- jetty/tutorials.md | 2 +- 8 files changed, 153 insertions(+), 133 deletions(-) diff --git a/garden/ros2_gz_docker_bridge.md b/garden/ros2_gz_docker_bridge.md index 911a594d67..86457f6c24 100644 --- a/garden/ros2_gz_docker_bridge.md +++ b/garden/ros2_gz_docker_bridge.md @@ -1,12 +1,12 @@ -# ROS2 + Gazebo Docker Bridge +# ROS 2 + Gazebo Docker Bridge -A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them +A two-container Docker setup for running Gazebo and ROS 2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them --- ## Compatibility -| ROS2 | Gazebo | +| ROS 2 | Gazebo | |---|---| | Rolling | Jetty | | Kilted | Ionic | @@ -20,8 +20,8 @@ A two-container Docker setup for running Gazebo and ROS2 as separate services co - Docker installed and running - Both images built: - - `gazebo` — from `dockerfile.gazebo` - - `ros2` — from your ROS2 Dockerfile + - `gazebo` — from your Gazebo Dockerfile + - `ros2` — from your ROS 2 Dockerfile - `ros-gz-bridge` installed --- @@ -87,8 +87,20 @@ export GZ_IP= export GZ_PARTITION=gazebo-container source /opt/ros//setup.bash ``` - -> Add these to `~/.bashrc` in each container to be available across sessions. + +:::{important} +Add these to `~/.bashrc` in each container to be available across sessions. +::: + +:::{note} +When setting `GZ_IP`, use only the IP address without the subnet mask. For example: + +```bash +export GZ_IP=172.21.0.3 +``` + +Do not include `/16`. +::: --- @@ -108,15 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -a typical `bridge.yaml` looks like this: - -```yaml -- ros_topic_name: /clock - gz_topic_name: /clock - ros_type_name: rosgraph_msgs/msg/Clock - gz_type_name: gz.msgs.Clock - direction: GZ_TO_ROS -``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. --- @@ -134,15 +138,28 @@ gz sim shapes.sdf ```bash docker exec -it ros2-container bash source /opt/ros//setup.bash +``` + +#### Option 1: Single topic (basic) +```bash ros2 run ros_gz_bridge parameter_bridge \ /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock ``` - -### Terminal 3 — Verify - + +#### Option 2: Multiple topics ```bash -docker exec -it ros2-container bash -source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock \ + /world/default/model/vehicle/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist \ + /world/default/model/vehicle/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry +``` + +#### Option 3: Using config file +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. + ros2 topic echo /clock ``` if you see something like this :- @@ -162,13 +179,3 @@ clock: ``` then the connection between the two docker containers is succesfull ---- - -## Final Network Info - -| Container | IP | Role | -|---|---|---| -| `gazebo-container` | `` | Runs Gazebo simulation | -| `ros2-container` | `` | Runs ROS2 + bridge | - -Network name: `ros-link` \ No newline at end of file diff --git a/garden/tutorials.md b/garden/tutorials.md index 6a88a241f5..a268af4dfa 100644 --- a/garden/tutorials.md +++ b/garden/tutorials.md @@ -23,7 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) -* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) +* [ROS 2 Cross Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials diff --git a/harmonic/ros2_gz_docker_bridge.md b/harmonic/ros2_gz_docker_bridge.md index 911a594d67..9ce6d5bc96 100644 --- a/harmonic/ros2_gz_docker_bridge.md +++ b/harmonic/ros2_gz_docker_bridge.md @@ -1,12 +1,12 @@ -# ROS2 + Gazebo Docker Bridge +# ROS 2 + Gazebo Docker Bridge -A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them +A two-container Docker setup for running Gazebo and ROS 2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them --- ## Compatibility -| ROS2 | Gazebo | +| ROS 2 | Gazebo | |---|---| | Rolling | Jetty | | Kilted | Ionic | @@ -20,8 +20,8 @@ A two-container Docker setup for running Gazebo and ROS2 as separate services co - Docker installed and running - Both images built: - - `gazebo` — from `dockerfile.gazebo` - - `ros2` — from your ROS2 Dockerfile + - `gazebo` — from your Gazebo Dockerfile + - `ros2` — from your ROS 2 Dockerfile - `ros-gz-bridge` installed --- @@ -87,35 +87,27 @@ export GZ_IP= export GZ_PARTITION=gazebo-container source /opt/ros//setup.bash ``` - -> Add these to `~/.bashrc` in each container to be available across sessions. ---- +:::{important} +Add these to `~/.bashrc` in each container to be available across sessions. +::: -### 5. Install the Bridge +:::{note} +When setting `GZ_IP`, use only the IP address without the subnet mask. For example: ```bash -apt-get update && apt-get install -y ros--ros-gz-bridge +export GZ_IP=172.21.0.3 ``` ---- +Do not include `/16`. +::: -## Using a Config File (optional) +--- -if you have a `bridge.yaml` config file, you can use it instead of passing topics as arguments: +### 5. Install the Bridge ```bash -ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml -``` - -a typical `bridge.yaml` looks like this: - -```yaml -- ros_topic_name: /clock - gz_topic_name: /clock - ros_type_name: rosgraph_msgs/msg/Clock - gz_type_name: gz.msgs.Clock - direction: GZ_TO_ROS +apt-get update && apt-get install -y ros--ros-gz-bridge ``` --- @@ -134,9 +126,27 @@ gz sim shapes.sdf ```bash docker exec -it ros2-container bash source /opt/ros//setup.bash +``` + +#### Option 1: Single topic (basic) +```bash ros2 run ros_gz_bridge parameter_bridge \ /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock ``` + +#### Option 2: Multiple topics +```bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock \ + /world/default/model/vehicle/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist \ + /world/default/model/vehicle/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry +``` + +#### Option 3: Using config file +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. ### Terminal 3 — Verify @@ -160,15 +170,4 @@ clock: nanosec: 0 --- ``` -then the connection between the two docker containers is succesfull - ---- - -## Final Network Info - -| Container | IP | Role | -|---|---|---| -| `gazebo-container` | `` | Runs Gazebo simulation | -| `ros2-container` | `` | Runs ROS2 + bridge | - -Network name: `ros-link` \ No newline at end of file +then the connection between the two docker containers is succesfull \ No newline at end of file diff --git a/harmonic/tutorials.md b/harmonic/tutorials.md index 0805a915ab..8c433fc0e2 100644 --- a/harmonic/tutorials.md +++ b/harmonic/tutorials.md @@ -23,7 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) -* [ROS 2 Docker Bridge Setup](ros_docker_gz_integration) +* [ROS 2 Cross Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials See the *API & Tutorials* sections on the [Libraries page](/libs){.external} page for more specific content correlating to each Gazebo library. diff --git a/ionic/ros2_gz_docker_bridge.md b/ionic/ros2_gz_docker_bridge.md index 911a594d67..86457f6c24 100644 --- a/ionic/ros2_gz_docker_bridge.md +++ b/ionic/ros2_gz_docker_bridge.md @@ -1,12 +1,12 @@ -# ROS2 + Gazebo Docker Bridge +# ROS 2 + Gazebo Docker Bridge -A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them +A two-container Docker setup for running Gazebo and ROS 2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them --- ## Compatibility -| ROS2 | Gazebo | +| ROS 2 | Gazebo | |---|---| | Rolling | Jetty | | Kilted | Ionic | @@ -20,8 +20,8 @@ A two-container Docker setup for running Gazebo and ROS2 as separate services co - Docker installed and running - Both images built: - - `gazebo` — from `dockerfile.gazebo` - - `ros2` — from your ROS2 Dockerfile + - `gazebo` — from your Gazebo Dockerfile + - `ros2` — from your ROS 2 Dockerfile - `ros-gz-bridge` installed --- @@ -87,8 +87,20 @@ export GZ_IP= export GZ_PARTITION=gazebo-container source /opt/ros//setup.bash ``` - -> Add these to `~/.bashrc` in each container to be available across sessions. + +:::{important} +Add these to `~/.bashrc` in each container to be available across sessions. +::: + +:::{note} +When setting `GZ_IP`, use only the IP address without the subnet mask. For example: + +```bash +export GZ_IP=172.21.0.3 +``` + +Do not include `/16`. +::: --- @@ -108,15 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -a typical `bridge.yaml` looks like this: - -```yaml -- ros_topic_name: /clock - gz_topic_name: /clock - ros_type_name: rosgraph_msgs/msg/Clock - gz_type_name: gz.msgs.Clock - direction: GZ_TO_ROS -``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. --- @@ -134,15 +138,28 @@ gz sim shapes.sdf ```bash docker exec -it ros2-container bash source /opt/ros//setup.bash +``` + +#### Option 1: Single topic (basic) +```bash ros2 run ros_gz_bridge parameter_bridge \ /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock ``` - -### Terminal 3 — Verify - + +#### Option 2: Multiple topics ```bash -docker exec -it ros2-container bash -source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock \ + /world/default/model/vehicle/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist \ + /world/default/model/vehicle/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry +``` + +#### Option 3: Using config file +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. + ros2 topic echo /clock ``` if you see something like this :- @@ -162,13 +179,3 @@ clock: ``` then the connection between the two docker containers is succesfull ---- - -## Final Network Info - -| Container | IP | Role | -|---|---|---| -| `gazebo-container` | `` | Runs Gazebo simulation | -| `ros2-container` | `` | Runs ROS2 + bridge | - -Network name: `ros-link` \ No newline at end of file diff --git a/ionic/tutorials.md b/ionic/tutorials.md index fd3930f8b7..62aef10e84 100644 --- a/ionic/tutorials.md +++ b/ionic/tutorials.md @@ -23,7 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) -* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) +* [ROS 2 Cross Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials diff --git a/jetty/ros2_gz_docker_bridge.md b/jetty/ros2_gz_docker_bridge.md index 911a594d67..86457f6c24 100644 --- a/jetty/ros2_gz_docker_bridge.md +++ b/jetty/ros2_gz_docker_bridge.md @@ -1,12 +1,12 @@ -# ROS2 + Gazebo Docker Bridge +# ROS 2 + Gazebo Docker Bridge -A two-container Docker setup for running Gazebo and ROS2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them +A two-container Docker setup for running Gazebo and ROS 2 as separate services connected over a custom Docker network, with the ros_gz_bridge handling topic communication between them --- ## Compatibility -| ROS2 | Gazebo | +| ROS 2 | Gazebo | |---|---| | Rolling | Jetty | | Kilted | Ionic | @@ -20,8 +20,8 @@ A two-container Docker setup for running Gazebo and ROS2 as separate services co - Docker installed and running - Both images built: - - `gazebo` — from `dockerfile.gazebo` - - `ros2` — from your ROS2 Dockerfile + - `gazebo` — from your Gazebo Dockerfile + - `ros2` — from your ROS 2 Dockerfile - `ros-gz-bridge` installed --- @@ -87,8 +87,20 @@ export GZ_IP= export GZ_PARTITION=gazebo-container source /opt/ros//setup.bash ``` - -> Add these to `~/.bashrc` in each container to be available across sessions. + +:::{important} +Add these to `~/.bashrc` in each container to be available across sessions. +::: + +:::{note} +When setting `GZ_IP`, use only the IP address without the subnet mask. For example: + +```bash +export GZ_IP=172.21.0.3 +``` + +Do not include `/16`. +::: --- @@ -108,15 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -a typical `bridge.yaml` looks like this: - -```yaml -- ros_topic_name: /clock - gz_topic_name: /clock - ros_type_name: rosgraph_msgs/msg/Clock - gz_type_name: gz.msgs.Clock - direction: GZ_TO_ROS -``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. --- @@ -134,15 +138,28 @@ gz sim shapes.sdf ```bash docker exec -it ros2-container bash source /opt/ros//setup.bash +``` + +#### Option 1: Single topic (basic) +```bash ros2 run ros_gz_bridge parameter_bridge \ /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock ``` - -### Terminal 3 — Verify - + +#### Option 2: Multiple topics ```bash -docker exec -it ros2-container bash -source /opt/ros//setup.bash +ros2 run ros_gz_bridge parameter_bridge \ + /clock@rosgraph_msgs/msg/Clock@gz.msgs.Clock \ + /world/default/model/vehicle/cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist \ + /world/default/model/vehicle/odometry@nav_msgs/msg/Odometry@gz.msgs.Odometry +``` + +#### Option 3: Using config file +```bash +ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml +``` +See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. + ros2 topic echo /clock ``` if you see something like this :- @@ -162,13 +179,3 @@ clock: ``` then the connection between the two docker containers is succesfull ---- - -## Final Network Info - -| Container | IP | Role | -|---|---|---| -| `gazebo-container` | `` | Runs Gazebo simulation | -| `ros2-container` | `` | Runs ROS2 + bridge | - -Network name: `ros-link` \ No newline at end of file diff --git a/jetty/tutorials.md b/jetty/tutorials.md index b30c7d1ad1..185b19d3ff 100644 --- a/jetty/tutorials.md +++ b/jetty/tutorials.md @@ -23,7 +23,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Integration via Bridge](ros2_integration) * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) -* [ROS 2 Docker Bridge Setup](ros2_gz_docker_bridge) +* [ROS 2 Cross Docker Bridge Setup](ros2_gz_docker_bridge) ## Per-library tutorials From 9a0f984362d0b29725d584f57d36a61f38689ed7 Mon Sep 17 00:00:00 2001 From: Not-NeoN-sup Date: Wed, 6 May 2026 17:03:45 +0000 Subject: [PATCH 3/4] accidently deleted some stuff --- garden/ros2_gz_docker_bridge.md | 5 +++++ ionic/ros2_gz_docker_bridge.md | 7 ++++++- jetty/ros2_gz_docker_bridge.md | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/garden/ros2_gz_docker_bridge.md b/garden/ros2_gz_docker_bridge.md index 86457f6c24..e571733cb6 100644 --- a/garden/ros2_gz_docker_bridge.md +++ b/garden/ros2_gz_docker_bridge.md @@ -159,7 +159,12 @@ ros2 run ros_gz_bridge parameter_bridge \ ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. + +### Terminal 3 — Verify +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash ros2 topic echo /clock ``` if you see something like this :- diff --git a/ionic/ros2_gz_docker_bridge.md b/ionic/ros2_gz_docker_bridge.md index 86457f6c24..0fad5dbfbb 100644 --- a/ionic/ros2_gz_docker_bridge.md +++ b/ionic/ros2_gz_docker_bridge.md @@ -159,7 +159,12 @@ ros2 run ros_gz_bridge parameter_bridge \ ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. - + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash ros2 topic echo /clock ``` if you see something like this :- diff --git a/jetty/ros2_gz_docker_bridge.md b/jetty/ros2_gz_docker_bridge.md index 86457f6c24..0fad5dbfbb 100644 --- a/jetty/ros2_gz_docker_bridge.md +++ b/jetty/ros2_gz_docker_bridge.md @@ -159,7 +159,12 @@ ros2 run ros_gz_bridge parameter_bridge \ ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. - + +### Terminal 3 — Verify + +```bash +docker exec -it ros2-container bash +source /opt/ros//setup.bash ros2 topic echo /clock ``` if you see something like this :- From 60a2667ad12e19d3dfe6995326c7e8246ce2753a Mon Sep 17 00:00:00 2001 From: Not-NeoN-sup Date: Sat, 16 May 2026 08:14:54 +0000 Subject: [PATCH 4/4] minor changes --- garden/ros2_gz_docker_bridge.md | 4 ++-- harmonic/ros2_gz_docker_bridge.md | 2 +- harmonic/tutorials.md | 1 + ionic/ros2_gz_docker_bridge.md | 4 ++-- jetty/ros2_gz_docker_bridge.md | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/garden/ros2_gz_docker_bridge.md b/garden/ros2_gz_docker_bridge.md index e571733cb6..925ea3f014 100644 --- a/garden/ros2_gz_docker_bridge.md +++ b/garden/ros2_gz_docker_bridge.md @@ -120,7 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. --- @@ -158,7 +158,7 @@ ros2 run ros_gz_bridge parameter_bridge \ ```bash ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. ### Terminal 3 — Verify diff --git a/harmonic/ros2_gz_docker_bridge.md b/harmonic/ros2_gz_docker_bridge.md index 9ce6d5bc96..d928019f6a 100644 --- a/harmonic/ros2_gz_docker_bridge.md +++ b/harmonic/ros2_gz_docker_bridge.md @@ -146,7 +146,7 @@ ros2 run ros_gz_bridge parameter_bridge \ ```bash ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. ### Terminal 3 — Verify diff --git a/harmonic/tutorials.md b/harmonic/tutorials.md index 8c433fc0e2..62aef10e84 100644 --- a/harmonic/tutorials.md +++ b/harmonic/tutorials.md @@ -24,6 +24,7 @@ These tutorials cover general concepts to help get you started with Gazebo. * [ROS 2 Interoperability](ros2_interop) * [ROS 2 Integration Template](ros_gz_project_template_guide) * [ROS 2 Cross Docker Bridge Setup](ros2_gz_docker_bridge) + ## Per-library tutorials See the *API & Tutorials* sections on the [Libraries page](/libs){.external} page for more specific content correlating to each Gazebo library. diff --git a/ionic/ros2_gz_docker_bridge.md b/ionic/ros2_gz_docker_bridge.md index 0fad5dbfbb..727e2b8889 100644 --- a/ionic/ros2_gz_docker_bridge.md +++ b/ionic/ros2_gz_docker_bridge.md @@ -120,7 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. --- @@ -158,7 +158,7 @@ ros2 run ros_gz_bridge parameter_bridge \ ```bash ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. ### Terminal 3 — Verify diff --git a/jetty/ros2_gz_docker_bridge.md b/jetty/ros2_gz_docker_bridge.md index 0fad5dbfbb..727e2b8889 100644 --- a/jetty/ros2_gz_docker_bridge.md +++ b/jetty/ros2_gz_docker_bridge.md @@ -120,7 +120,7 @@ if you have a `bridge.yaml` config file, you can use it instead of passing topic ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. --- @@ -158,7 +158,7 @@ ros2 run ros_gz_bridge parameter_bridge \ ```bash ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=/path/to/bridge.yaml ``` -See the [ros_gz_bridge examples](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge/examples) for sample configuration files. +See the [ros_gz_bridge](https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge) documentation for configuration options. ### Terminal 3 — Verify