ros2 / ros1_bridge

ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Apache License 2.0
425 stars 275 forks source link

to correct Examples 4 #357

Closed xlla closed 2 years ago

xlla commented 2 years ago

I have tested it.

terminal 1

ros2 run ros1_bridge parameter_bridge
Trying to create bidirectional bridge for topic '/chatter' with ROS 2 type 'std_msgs/msg/String'
[INFO] [1651472131.323351466] [ros_bridge]: create bidirectional bridge for topic /chatter
The parameter 'services_1_to_2' either doesn't exist or isn't an array
Trying to create bridge for ROS 1 service '/add_two_ints' with type 'roscpp_tutorials/TwoInts'
Created 2 to 1 bridge for service /add_two_ints
[INFO] [1651472131.772500582] [ros_bridge]: Passing message from ROS 1 std_msgs/String to ROS 2 std_msgs/msg/String (showing msg only once per type)

terminal 2

$ rosrun roscpp_tutorials add_two_ints_server
[ INFO] [1651472257.007540349]: request: x=1, y=2
[ INFO] [1651472257.010445376]:   sending back response: [3]

terminal 3

$ ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 1, b: 2}"
requester: making request: example_interfaces.srv.AddTwoInts_Request(a=1, b=2)

response:
example_interfaces.srv.AddTwoInts_Response(sum=3)