Skip to content

Commit 71ca9be

Browse files
committed
Update commands from host machine testing
1 parent c51cee3 commit 71ca9be

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed

README.md

+30-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This package has been tested in Ubuntu 18.04 with
99
A Dockerfile with the prerequisites is provided.
1010

1111

12-
# Basic bridge usage
12+
# Bridge a custom message type
1313

1414
This example demonstrates basic communication between publisher and subscriber across ROS 1 and ROS 2.
1515

@@ -36,6 +36,14 @@ colcon build --packages-select bridge_msgs
3636
python3 src/bridge_msgs/src/ros2_pub.py
3737
```
3838

39+
The publisher will produce output like this:
40+
```
41+
Published joint_command
42+
Published joint_command
43+
Published joint_command
44+
Published joint_command
45+
```
46+
3947
Shell 3, check out and compile `ros1_bridge` from source to recognize the custom message we just compiled above:
4048
```
4149
mkdir -p ros1_bridge_sandbox/bridge_ws/src
@@ -49,10 +57,9 @@ cd ..
4957
. ~/ros1_bridge_sandbox/ros2_msgs_ws/install/local_setup.bash
5058
# Compile ros1_bridge and source it
5159
colcon build --packages-select ros1_bridge --cmake-force-configure
52-
. install/setup.bash
60+
. install/local_setup.bash
5361
# This should print: - 'bridge_msgs/JointCommand' (ROS 2) <=> 'bridge_msgs/JointCommand' (ROS 1)
5462
ros2 run ros1_bridge dynamic_bridge --print-pairs | grep bridge
55-
- 'bridge_msgs/msg/JointCommand' (ROS 2) <=> 'bridge_msgs/JointCommand' (ROS 1)
5663
```
5764

5865
If the `grep` does not print anything, verify that the ROS 1 and ROS 2 messages are both recognized in this shell:
@@ -73,25 +80,39 @@ Run the bridge, which will carry messages across ROS 1 and 2:
7380
ros2 run ros1_bridge dynamic_bridge
7481
```
7582

76-
Shell 1, test subscribing to ROS 2 messages in ROS 1:
83+
Shell 1, test subscribing to ROS 2 messages in ROS 1.
84+
You should see printouts on the screen:
7785
```
78-
rosrun bridge_msgs ros1_sub.py
86+
$ rosrun bridge_msgs ros1_sub.py
87+
[INFO] [1571738769.812788]: 0.703536987438
88+
[INFO] [1571738769.866240]: 0.620796272812
89+
[INFO] [1571738769.919718]: 0.615485199642
90+
[INFO] [1571738769.972993]: 0.556240315522
7991
```
80-
You should see printouts on the screen.
8192

8293
If the executable is not found, make sure you have sourced the package:
8394
```
8495
. devel_isolated/setup.bash
8596
```
8697

87-
In the other direction, test subscribing to ROS 1 messages in ROS 2:
98+
Keeping the bridge running in Shell 3, try the other direction, subscribing to
99+
ROS 1 messages in ROS 2.
100+
88101
Shell 1:
89102
```
90-
rosrun bridge_msgs ros1_pub.py
103+
$ rosrun bridge_msgs ros1_pub.py
104+
published joint_command 0.337332
105+
published joint_command 0.004804
106+
published joint_command 0.022121
107+
published joint_command 0.100489
91108
```
92109
Shell 2:
93110
```
94-
ros2 run bridge_msgs ros2_sub.py
111+
$ python3 src/bridge_msgs/src/ros2_sub.py
112+
received joint_command 0.337332
113+
received joint_command 0.004804
114+
received joint_command 0.022121
115+
received joint_command 0.100489
95116
```
96117

97118

docker/run.bash

+1
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ docker run -it \
9696
--rm \
9797
--runtime=nvidia \
9898
--security-opt seccomp=unconfined \
99+
--network host \
99100
$DOCKER_OPTS \
100101
$IMG

ros1_msgs_ws/src/bridge_msgs/src/bridge_msgs/ros1_pub.py

100644100755
File mode changed.

ros1_msgs_ws/src/bridge_msgs/src/bridge_msgs/ros1_pub_builtin.py

100644100755
File mode changed.

ros2_msgs_ws/src/bridge_msgs/CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ find_package(rosidl_default_generators REQUIRED)
1616
find_package(std_msgs REQUIRED)
1717

1818
rosidl_generate_interfaces(bridge_msgs
19-
msg/JointCommand.msg
19+
msg/JointCommand.msg
2020
DEPENDENCIES
21-
geometry_msgs
22-
std_msgs
21+
geometry_msgs
22+
std_msgs
2323
)
2424

25+
install(DIRECTORY src
26+
DESTINATION lib/${PROJECT_NAME})
27+
2528
ament_export_dependencies(rosidl_default_runtime)
2629

2730
ament_package()

0 commit comments

Comments
 (0)