Low frame rate when publishing image messages in ros2

asked 2022-03-10 00:48:56 -0500

shankk gravatar image

updated 2022-03-10 01:04:17 -0500

Hi all,

I have a ROS node that gets image frames from a camera sensor and publishes image messages to a topic of type sensor_msgs::image. I run a ros2 executable which deploys the node. I notice that the rate at which the camera sensor provides the frames is 30 fps but the frame rate returned by "ros2 topic hz" is comparatively quite low, that is, around 10 Hz. I verified this using the output of "ros2 topic echo" wherein only around 10 messages were published with the same "sec" (second) value. So, it seems that a large overhead is involved in the topic publishing mechanism. Most likely, entire image frames are being copied which is causing low fps. I would like to confirm whether this is indeed the case, that is, does ros2 copies the entire message while publishing to a topic? And if yes, what are the workarounds to that? It seems that using intra process communication (using components) might be a workaround. But note that I am only deploying one node and publishing messages to a topic from it, that is to say, there is no second node which is consuming those messages yet.

edit retag flag offensive close merge delete


I've found that tuning DDS seems to help with publishing large messages, though that needs some trial&error. Also, refering to specific DDS vendor documentation is a good idea.

Serafadam gravatar image Serafadam  ( 2022-03-10 18:01:49 -0500 )edit