Relation between Multithreaded Executors, Nodes, Callback Groups and Threads in ROS2 Dashing Ubuntu 18.04

asked 2020-09-14 04:22:38 -0500

Andreas Vorwald gravatar image

Hello ROS2 Team,

to beginn this, first a middle long background explaination :)

We have a device having multiple sensors and actuators. The communication between this device and others are estabilished using ROS2. In our understanding we have multiple options to implement the system. One way is to implement everything as a dedicated node having a default callback group. Here one can use an single threaded executor.

But the problem is, that sensors and actuators sometimes sharing the same device and thus it might be good to have everything running on one system process using a multithreaded executor.

I think here are also multiple options. One way is to have one node with multiple callback groups spinned in a multithreaded executor.

Another way is to have multiple nodes using one or more callback groups spinned in a multithreaded executor.

First we tried out to leave everything running one node. This node has multiple walltimers polling for sensor data. Each timer is having a different callback group. Later one we integrated a camera and now have have undeterministic time bahavior for instance high latency on controlling actuators. After several tries we found out, that running the camera on a different node but on the same multithreaded executor solved the problem. We think that some threads are blocked so that the executor cannot be on time.

But for now we are completly confused about executors, nodes, callback groups and threads. Is each queue of each callback group are not working in one dedicated thread when they are in one node? Or the other way around: Is each queue of each callback group are just processed concurrent when they are in different nodes.

Thanks for you help.

Best regards

edit retag flag offensive close merge delete

Comments

Hi, Did you find out the answer. I am in same situation. I have three functions. 1. A call back function to subscribe to msg 2. A timer function to process the received messages every 30ms 3. A function to command the actuator and wait for response from actuator typically it waits for 1.5 seconds Timer function and actuator function shares a data in list.

While my subscriber callback function works fine. My timer function gets stuck for when i command the actuator. The only solution i found that it works is using a another node and communicating using messages between two nodes for timer and actuator function.

The multi threading is not working as expected it gets stuck as i share the data between timer function and actuator function. What is the best way to have timer function and actuator function in same node but still have timer ...(more)

Malz gravatar image Malz  ( 2020-09-27 13:48:19 -0500 )edit