-
Notifications
You must be signed in to change notification settings - Fork 299
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
ROS1 Bridge doesn't work with Multithreaded Executor on a ROS2 service #314
Comments
Do you expect that a service created by a node running on a multithreaded executor of ros2 can deal with multiple requests from ros1 at the same time? Or two more different services created by a node or nodes? I just want to make sure you make the right code (IIRC, the flag of Callback group, exclusive, will be checked inside if you use the default callback group only in one node) in ROS2. About
BTW: could you provide an example and more detailed steps to reproduce what you expect? |
Could you use |
@iuhilnehc-ynos Thank you for your response. My use case is a scenario where you have a long-running blocking service that depends on other threads updating a member variable before returning the response. It is a single service per node but the node will have other callbacks from topics that need to be processed concurrently. You have also pointed very correctly to the locations I thought would need updating to support this. I would update the Issue with more detailed steps to reproduce as well. With respect to the ros version I'm thinking it may be easy to merge the PR in both branches (including dashing). |
I am sorry, item 1 pointed before is the bridge for ros1_bridge/include/ros1_bridge/factory.hpp Line 331 in 5d77ce0
|
Thank you for sharing this. At least you didn't use the same callback group (because of creating a service per node) for service callback, so we expect that the service callback can run on separate threads when using MultiThreadedExecutor. |
And use ros1_bridge/src/dynamic_bridge.cpp Line 787 in 5d77ce0
|
I might need a bit of clarity on how this works. I thought the Multithreading/Callback setup would be setup on the ROS2 service ? |
In your case, you just cared about the ros2 service callback that can run on separate threads, so we just need to make sure the ros1 spin with multiple threads which can call ros1_service_callback in Could you just confirm if updating |
Yes @iuhilnehc-ynos I can confirm updating https://github.com/ros2/ros1_bridge/blob/dashing/src/dynamic_bridge.cpp#L778 |
@joelbudu , Thank you for your confirmation. Before creating a PR for this feature, I'll go deep to check if it introduces some potential problems. |
Hi, @joelbudu, I found the example you updated on #314 (comment), ** Actual behavior ** |
Actually, there is also a geometry_msgs::msg::Vector3Stamped publisher and subscriber running in different callback groups. So there is a shared variable that is being updated by the subscriber and the value of that variable is checked in the blocking while loop of the service |
@iuhilnehc-ynos I've been following the PR request linked to this issue. I just wanted to confirm if for my scenario only changing the ros::AsyncSpinner async_spinner(2) would still suffice or is there any other change you would advice to change? Thanks |
If you just implemented a demo or a trial, I think the answer is
|
Bug report
Required Info:
Steps to reproduce issue
Only a single thread runs on the service
Expected behaviour
Multithreaded executor should run multiple nodes in separate threads.
Actual behavior
ROS2 service is run in a single thread
Additional information
Feature request
ros1_bridge should support nodes with the Multithreaded executor
The text was updated successfully, but these errors were encountered: