TommyChangUMD / ros-humble-ros1-bridge-builder

Create a ros-humble-ros1-bridge package that can be used directly in ROS2 Humble
MIT License
52 stars 12 forks source link

Action support #4

Closed LucasLabarussiat closed 6 months ago

LucasLabarussiat commented 9 months ago

Hello,

First of all thanks for your work, it helped a lot in understanding how this works, and I have been looking around quite some time to find a ros1_bridge between Noetic and Humble. By any chance, have you tried to add support for actions ? I did try fiddling around with your base and the work from ipa-hsd (here are his action_bridge branch and the original issue on ros1_bridge ) but couldn't get it to work, still tyring to figure out why.

By the way, is there a reason to spit a tarball ? Would something like that work:

Cheers, Lucas

TommyChangUMD commented 9 months ago

Hi Lucas,

You are correct that the builder does something to the apt database. It's a workaround for the catkin issue. You can read more about this issue here: https://docs.ros.org/en/iron/How-To-Guides/Using-ros1_bridge-Jammy-upstream.html#ros-2-via-debian-packages

As for the ros1_bridge fork from ipa-hsd, I also ran into compilation issues: /ros-humble-ros1-bridge/src/ros1_bridge/include/ros1_bridge/action_factory.hpp:148:44: error: no match for ‘operator=’ (operand types are ‘rclcpp_action::Client<tf2_msgs::action::LookupTransform>::GoalResponseCallback’ {aka ‘std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<tf2_msgs::action::LookupTransform> >)>’} and ‘ros1_bridge::ActionFactory_1_2<tf2_msgs::LookupTransformAction_<std::allocator<void> >, tf2_msgs::action::LookupTransform>::GoalHandler::handle()::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<tf2_msgs::action::LookupTransform> > >)>’)

I will try to investigate these compilation errors..

LucasLabarussiat commented 9 months ago

Hi Thomas,

Thank you for your quick answer. I will also try to investigate, though I am not sure I am fully capable when it comes to this. If I find something I will let you know.

smith-doug commented 8 months ago

The signature goal_response_callback wants changed to (const ROS2GoalHandle & gh2). https://github.com/smith-doug/ros1_bridge/commit/1611633d47fdc33b299dbd7e066f3642812c7a4d#

TommyChangUMD commented 8 months ago

Thanks, Douglas!
I have updated the Dockerfile to use your fork of action_bridge (action_bridge_humble branch).

Lucas - could you try the latest Dockefile and see if actions support works for you?

LucasLabarussiat commented 8 months ago

Hi,

Thanks for the help ! The bridge did build properly with your Dockerfile, though I haven't tried it and jumped right into trying to add my own dependencies. Especially this package here: industrial_robot_client

This is why I needed the bridge in the first place: I have an action server (control_msgs/msg/FollowJointTrajectory) running for my robot based on the ROS1 package industrial_robot_client and want to bridge this to an action client running with ROS2.

I added ros-humble-control-msgs. If I get it right, I need to add git clone instructions for the ROS1 package and its dependencies and successfully build them using colcon. Working on this at the moment, hope I can get all dependencies. Using the command :

rosdep resolve `grep -RhI -e "^ *<[a-z,A-Z,_]*depend>" ~/ros_ws/src/industrial_core | sed -e "s/.*>\(.*\)<.*/\1/" | sort -r | uniq | tr "\n" " "` 2>/dev/null | sed -e "s/^#.*//" | tr "\n" " " | sed -e "s/  */ /g" -e "s/  *//" |  (echo -n "sudo apt-get install " && cat); echo ""

I got the following package dependencies :

ros-noetic-urdf
ros-noetic-trajectory-msgs
ros-noetic-std-msgs
ros-noetic-simple-message
ros-noetic-sensor-msgs
ros-noetic-rosunit
ros-noetic-rospy
ros-noetic-roslaunch
ros-noetic-roscpp
ros-noetic-robot-state-publisher
ros-noetic-pluginlib
ros-noetic-moveit-ros-planning
ros-noetic-moveit-core
ros-noetic-message-runtime
ros-noetic-message-generation
ros-noetic-industrial-utils
ros-noetic-industrial-trajectory-filters
ros-noetic-industrial-robot-simulator
ros-noetic-industrial-robot-client
ros-noetic-industrial-msgs
ros-noetic-industrial-deprecated
ros-noetic-control-msgs
ros-noetic-class-loader
ros-noetic-catkin
ros-noetic-actionlib-msgs
ros-noetic-actionlib

If I can build the dependencies and then source the resulting setup.bash before building the bridge again, I should be able to use:

ros2 run ros1_bridge action_bridge ros1 industrial_robot_client FollowJointTrajectory joint_trajectory_action

Am I right ?

Thanks again, Lucas

smith-doug commented 8 months ago

I have run Motoman's ros1 industrial robot client based driver from Humble with the bridge in Noetic. I used ros noetic in Conda that was build for python 3.10. You'll need this mapping package in your ros2 workspace. There is a version of the ros industrial core repo that will give you the messages in ros2.

My fork is not in a finished state so use it at your own risk. It did run well enough to run the ros industrial scan n plan workshop demo.

I have not tried this Docker version. I made a separate package for mappings before discovering the incompatibilities with noetic/humble messages are more than just mappings. It might work with the mapping package in the ros2 /ros-humble-ros1-bridge/src folder.

LucasLabarussiat commented 6 months ago

Hi, sorry for the delay. Just wanted to let you know that everything works great now. My setup is as follows:

I want to contribute back somehow, but I first have to do some paperwork to have my company's approval.

Thanks a lot for your help.

TommyChangUMD commented 6 months ago

Thanks for the feedback! And feel free to contribute and make improvements. :)