[ros-users] ROS performance - strange behaviour?

Peter Müller grandmastermt2000 at yahoo.de
Wed Aug 4 19:46:09 UTC 2010


Hi,

I observed some behaviour, which seemed strange to me. I have written a simple publisher and a simple subscriber. The job of the subscriber is to receive the data packet of the publisher, and save the timestamp of the data packet and the time of arrival in a vector for later analysis.
The publisher simply generates the timestamp and publishes the packet at a rate of 20hz.

Now I made 2 test runs with a volume of 10.000 messages each run. I computed the latency (t_arrival - t_sent) and plotted it using matlab. Everything looked good.
However when I change the setup slightly, the data gets distorted heavily. The only thing I changed was the way the publisher works.
The publisher now sends 2 packets at a rate of 20hz. This was achieved by a simple for-loop.
Pseudocode:
repeat 10000 times:
for (i = 1 until 2)
  generate timestamp for packet
  node.publish(packet)
end
sleep


Here is a plot of the example, which seemed to work (one packet at 20hz)
http://img580.imageshack.us/img580/4402/matlabros1.png

Now when I do a burst of 2 messages at 20hz I get this:
http://img38.imageshack.us/img38/70/matlabros2.png

I further looked at the data to try to find out what happens. Since I save every timestamp I plotted them with switching between red/blue as a color.
This is a plot of the first 50 messages/timestamps with red being the entry i and blue being the entry i+1 in the vector (i being the index going from 1 to 50 in this plot). 
To clarify here is a snippet of the matlab code:
for i = 1:2:50
    plot(i, ros_burst(i), '*', 'Color', 'r');
    plot(i+1, ros_burst(i+1), '*', 'Color', 'b');
end
This means the red star should be the first message of the burst.
Here is the corresponding plot:
http://img704.imageshack.us/img704/994/matlabros3.png

I also plotted the whole data set with this color scheme:
http://img827.imageshack.us/img827/3715/matlabros4.png


I did not expect something like this to happen and unfortunately I can't explain this on my own.
Is anyone familiar with this? The ros code I have written is extremely simple and if requested I can post the relevant parts.







More information about the ros-users mailing list