Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bridge mapping rule for action_tutorials_interfaces #525

Conversation

ruffsl
Copy link
Member

@ruffsl ruffsl commented Jun 17, 2021

Depends: ros2/ros1_bridge#256 (comment)

CC @ipa-hsd

Signed-off-by: ruffsl <roxfoxpox@gmail.com>
@ruffsl ruffsl force-pushed the ruffsl/master/bridge_action_tutorials_interfaces branch from 227004b to 199f76b Compare June 17, 2021 16:13
@hsd-dev
Copy link

hsd-dev commented Jun 17, 2021

@ruffsl are you able to create the fibonacci bridge now?

@ruffsl
Copy link
Member Author

ruffsl commented Jun 17, 2021

With ruffsl/ros1_bridge@29ad938 from ruffsl/ros1_bridge#1 I was succesfully able to call the fibonacci servier in ROS1 from a client in ROS2.

root@28ee5068d3a9:/opt/overlay_ws# source install/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# ros2 run ros1_bridge action_bridge ros1 actionlib_tutorials Fibonacci fibonacci
ros1 actionlib_tutorials Fibonacci fibonacci
created action factory
[INFO] [1623951849.948650309] [ros_bridge]: Sending goal
[ INFO] [1623951849.950380734]: Goal [ACTIVE]
[ INFO] [1623951859.950501871]: Goal [WAITING_FOR_RESULT]
[ INFO] [1623951859.950583091]: Goal [DONE]
[ INFO] [1623951859.950804457]: Goal [SUCCEEDED]
root@28ee5068d3a9:/opt/overlay_ws# source /opt/ros/noetic/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# rosrun actionlib_tutorials fibonacci_server
[ INFO] [1623951849.950133947]: fibonacci: Executing, creating fibonacci sequence of order 10 with seeds 0, 1
[ INFO] [1623951859.950070762]: fibonacci: Succeeded

---

root@28ee5068d3a9:/opt/overlay_ws# source /opt/ros/galactic/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# ros2 run action_tutorials_cpp fibonacci_action_client 20
[INFO] [1623951849.946866153] [fibonacci_action_client]: Sending goal
[INFO] [1623951849.948485627] [fibonacci_action_client]: Goal accepted by server, waiting for result
[INFO] [1623951849.954644920] [fibonacci_action_client]: Next number in sequence received: 0 1 1 
[INFO] [1623951850.950359132] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 
[INFO] [1623951851.950389403] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 
[INFO] [1623951852.950415877] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 
[INFO] [1623951853.950375553] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 
[INFO] [1623951854.950354216] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 13 
[INFO] [1623951855.950416551] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 13 21 
[INFO] [1623951856.950422523] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 13 21 34 
[INFO] [1623951857.950401101] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 13 21 34 55 
[INFO] [1623951858.950428270] [fibonacci_action_client]: Next number in sequence received: 0 1 1 2 3 5 8 13 21 34 55 89 
[INFO] [1623951859.951256988] [fibonacci_action_client]: Result received: 0 1 1 2 3 5 8 13 21 34 55 89 

However, I was not able to go the other way, I.E calling the fibonacci servier in ROS2 from a client in ROS1. I tried restarting roscore and ros_bridge before repeating the test, but no such luck.

root@28ee5068d3a9:/opt/overlay_ws# source install/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# ros2 run ros1_bridge action_bridge ros2 action_tutorials_interfaces Fibonacci fibonacci
ros2 action_tutorials_interfaces Fibonacci fibonacci
Failed to create a factory
root@28ee5068d3a9:/opt/overlay_ws# source /opt/ros/galactic/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# ros2 run action_tutorials_cpp fibonacci_action_server 

---

root@28ee5068d3a9:/opt/overlay_ws# source /opt/ros/noetic/setup.bash 
root@28ee5068d3a9:/opt/overlay_ws# rosrun actionlib_tutorials fibonacci_client 20
[ INFO] [1623952141.722515008]: Waiting for action server to start.

@aefrank
Copy link

aefrank commented Jun 17, 2021

@ruffsl Just a note, using your Docker image I had to source /opt/overlay_ws/install/setup.bash to run ros2 run ros1_bridge action_bridge ros1 actionlib_tutorials Fibonacci fibonacci.

Just sourcing the noetic setup as you've shown gave me errors finding ros2, and sourcing the galactic setup and trying again gave me No executable found. Perhaps you had sourced the overlay install earlier in that shell so the command worked for you then. If that was your original shell in the container it was probably sourced by the entrypoint file.

@ruffsl
Copy link
Member Author

ruffsl commented Jun 17, 2021

If that was your original shell in the container it was probably sourced by the entrypoint file.

Yep, I've corrected my above comment.

@hsd-dev
Copy link

hsd-dev commented Jun 18, 2021

The command would be

ros2 run ros1_bridge action_bridge ros2 action_tutorials_interfaces action/Fibonacci fibonacci

The type strings can be found in bridge_ws/build/ros1_bridge/generated/.

@ruffsl
Copy link
Member Author

ruffsl commented Jun 18, 2021

The command would be

Oh, great, looks like this works both ways as well, just needed the correct type string.

The type strings can be found in bridge_ws/build/ros1_bridge/generated/.

I now see it's listed within the generated file, but it's not yet obvious why it's namespaced with action/

root@4e6f29d330e9:/opt/overlay_ws/build/ros1_bridge/generated# cat action_tutorials_interfaces__action__Fibonacci__factories.cpp | grep -I "action/Fibonacci"
      action_name == "action/Fibonacci"

@hsd-dev
Copy link

hsd-dev commented Jun 21, 2021

You could also use --print-pairs option for dynamic_bridge to get the supported actions

$ ros2 run ros1_bridge dynamic_bridge --print-pairs

Supported ROS 2 <=> ROS 1 action type conversion pairs:
  - 'action_tutorials_interfaces/action/Fibonacci' (ROS 2) <=> 'actionlib_tutorials/Fibonacci' (ROS 1)
  - 'tf2_msgs/action/LookupTransform' (ROS 2) <=> 'tf2_msgs/LookupTransform' (ROS 1)

Copy link
Member

@audrow audrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me once ros2/ros1_bridge#256 is merged in.

@clalancette
Copy link
Contributor

Given that we've now removed action_tutorials_interfaces, I'm going to go ahead and close this one.

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.

5 participants