Skip to content

Commit bdd4e28

Browse files
committed
Update README.md to reflect changes
1 parent a86d5ea commit bdd4e28

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

ros_gz_bridge/README.md

+39-4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Now we start the ROS listener.
8686

8787
```
8888
# Shell B:
89-
. /opt/ros/galactic/setup.bash
89+
. /opt/ros/humble/setup.bash
9090
ros2 topic echo /chatter
9191
```
9292

@@ -118,7 +118,7 @@ Now we start the ROS talker.
118118

119119
```
120120
# Shell C:
121-
. /opt/ros/galactic/setup.bash
121+
. /opt/ros/humble/setup.bash
122122
ros2 topic pub /chatter std_msgs/msg/String "data: 'Hi'" --once
123123
```
124124

@@ -156,15 +156,15 @@ Now we start the ROS GUI:
156156

157157
```
158158
# Shell C:
159-
. /opt/ros/galactic/setup.bash
159+
. /opt/ros/humble/setup.bash
160160
ros2 run rqt_image_view rqt_image_view /rgbd_camera/image
161161
```
162162

163163
You should see the current images in `rqt_image_view` which are coming from
164164
Gazebo (published as Gazebo Msgs over Gazebo Transport).
165165

166166
The screenshot shows all the shell windows and their expected content
167-
(it was taken using ROS 2 Galactic and Gazebo Fortress):
167+
(it was taken using ROS 2 humble and Gazebo Fortress):
168168

169169
![Gazebo Transport images and ROS rqt](images/bridge_image_exchange.png)
170170

@@ -274,9 +274,44 @@ To run the bridge node with the above configuration:
274274
ros2 run ros_gz_bridge parameter_bridge --ros-args -p config_file:=$WORKSPACE/ros_gz/ros_gz_bridge/test/config/full.yaml
275275
```
276276

277+
## Example 6: Using ROS namespace with the Bridge
278+
279+
When spawning multiple robots inside the same ROS environment, it is convenient to use namespaces to avoid overlapping topic names.
280+
There are three main types of namespaces: relative, global (`/`) and private (`~/`). For more information, refer to ROS documentation.
281+
Namespaces are applied to Gazebo topic both when specified as `topic_name` as well as `gz_topic_name`.
282+
283+
By default, the Bridge will not apply ROS namespace on the Gazebo topics. To enable this feature, use parameter `expand_gz_topic_names`.
284+
Let's test our topic with namespace:
285+
286+
```
287+
# Shell A:
288+
. ~/bridge_ws/install/setup.bash
289+
ros2 run ros_gz_bridge parameter_bridge chatter@std_msgs/msg/String@ignition.msgs.StringMsg \
290+
--ros-args -p expand_gz_topic_names:=true -r __ns:=/demo
291+
```
292+
293+
Now we start the Gazebo Transport listener.
294+
295+
```
296+
# Shell B:
297+
ign topic -e -t /demo/chatter
298+
```
299+
300+
Now we start the ROS talker.
301+
302+
```
303+
# Shell C:
304+
. /opt/ros/humble/setup.bash
305+
ros2 topic pub /demo/chatter std_msgs/msg/String "data: 'Hi from inside of a namespace'" --once
306+
```
307+
308+
By changing `chatter` to `/chatter` or `~/chatter` you can obtain different results.
309+
310+
277311
## API
278312

279313
ROS 2 Parameters:
280314

281315
* `subscription_heartbeat` - Period at which the node checks for new subscribers for lazy bridges.
282316
* `config_file` - YAML file to be loaded as the bridge configuration
317+
* `expand_gz_topic_names` - Enable or disable ROS namespace applied on GZ topics.

0 commit comments

Comments
 (0)