ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

MultiThreadedExecutor with components

asked 2020-03-02 20:53:39 -0500

ghaggin gravatar image

I'm writing a driver for a camera that reads images and publishes them in a message. I'm writing this as a component node which gets loaded manually in a manual_composition program similar to the demo here. I would like to add many nodes to this and have it run multithreaded. In my code i change the SingleThreadExecutor to a MultiThreadExecutor. The program runs fine with the SingleThreadExecutor but when I run it with the MultiThreadExecutor the camera driver performs poorly and does not read the frames fast enough. I would appreciate any help tracing down what the issue is that is causing this. My system information is below, and I can provide any additional information that will help. Thanks.

  • Ros Distro: Eloquent
  • Package: rclcpp
  • OS: Ubuntu 18.04
  • Kernel: 5.3.0-40-generic
  • Architecture: x86_64
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2021-07-10 09:14:22 -0500

Jaron gravatar image

Multithreaded hardware access usually performs poorly as each thread is frequently caught in the middle of sending a hardware signal when another thread tries to act on another event. I assume that you are trying to run several nodes at the same time, not all of which are hardware access nodes. If you are not, running multiple threads on a hardware access node only provides disadvantages as the hardware access signals will not be in sync (and if they were, there's no advantage to having it in one thread which will keep them in sync). If you are running several nodes at the same time and just want the camera node to participate, look at this answer that seem very similar: https://answers.ros.org/question/3138...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-03-02 20:53:39 -0500

Seen: 378 times

Last updated: Mar 02 '20