Nodelet - Two threads?

asked 2020-05-18 17:45:18 -0600

soulslicer gravatar image

updated 2020-05-19 02:08:03 -0600

gvdhoorn gravatar image

I have a nodelet that I am running through the multithreaded nodelet manager. In my nodelet I launched two threads. One to publish, and I have another one subscribing.

The thread that publishes works, but the one that subscribes, throws this error:

[ERROR] [1589842000.764874218]: SingleThreadedSpinner: Attempt to spin a callback queue from two spinners, one of them being single-threaded.
In the future this will throw an exception! You might want to use a MultiThreadedSpinner instead.

I tried using MultiThreadedSpinner and I get

Attempt to spin a callback queue from two spinners, one of them being single-threaded

Also:

recvfrom: Resource temporarily unavailable
edit retag flag offensive close merge delete

Comments

Observation: MultiThreadedSpinner does not deal with threads you create. It will internally use multiple threads to service the callback queues associated with Publishers and Subscribers, but all of that is invisible to user-level code.

Also: you typically don't create spinners yourself in nodelets. That's all taken care of for you by the manager (which you already refer to).

It would be good to show code as we can then see whether you are doing something unsupported.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-19 02:09:25 -0600 )edit