Multiple nodes subscribed to a topic make the topic slower

asked 2014-11-21 04:54:39 -0500

narcispr gravatar image

Hi, I have a python node that is subscribed to an Odometry msg (queue = 1). In the subscription callback, this node only fills another message (custom Odometry msg) and publishes it (queue = 1). There are 8 nodes, in the same computer, subscribed to this new topic (all of them with queue = 1). Despite the original Odometry msg is published at 30Hz (checked using rostopic hz command) the custom odometry message is only published at 5-6Hz. However, every time that I kill one of the nodes subscribed to this custom odometry msg the publish rate increases. It seems like when there are to many nodes subscribed to a topic they make the topic publication slower loosing lots of messages. Have any one faced before this problem? Am I doing something wrong with the queues?

Thank you!

edit retag flag offensive close merge delete


After more trials I've measured that the callback function takes around 0.2s with the publisher queue=1 (asynchronous). However, if I remove the queue, making the node synchronous, the function only takes 0.005s and publishes at 30Hz as desired! Are not asynchronous nodes better than synchronous?

narcispr gravatar image narcispr  ( 2014-11-21 05:22:14 -0500 )edit