Difference between python and cpp publisher/subscriber

asked 2020-01-15 17:01:14 -0600

thompson104 gravatar image

updated 2020-01-15 17:02:56 -0600

Hello all,

I know it looks like a naive question. However, I have been using ROS for about 4 years...Our question is if there is some underlying difference between the cpp and python ROS publisher? If not, I wonder if anyone perhaps can share some thoughts on this matter? Thank you.

We are sending a float number (that's all) to an industry servo to control its current position. The float number is increasing in each time step by a fixed number, for example, 10->10.1->10.2... When we are publishing this incremental number to the servo control node (written with cpp) with cpp publisher, the motion is quite jerky. However, when we use python to write exactly the same thing to publish this incremental number to the same servo control node with the same frequency, the motion is much smoother. We can tell the motion is much smoother just by my eyes, so there is a quite noticeable difference.

edit retag flag offensive close merge delete


We are using ROS kinetic on Ubuntu 16.04

thompson104 gravatar imagethompson104 ( 2020-01-15 17:01:27 -0600 )edit

Could you share the publishing code segments for both cpp and python?

Namal Senarathne gravatar imageNamal Senarathne ( 2020-01-15 20:33:51 -0600 )edit

We'd need to see the code. It's not really a fair comparison if we don't understand the loops running and their rates with the settings on the publishers.

stevemacenski gravatar imagestevemacenski ( 2020-01-16 13:06:19 -0600 )edit