What language?  Actual code is always helpful as well.<div><br></div><div>Josh<br><br><div class="gmail_quote">On Wed, Aug 4, 2010 at 12:46 PM, Peter Müller <span dir="ltr"><<a href="mailto:grandmastermt2000@yahoo.de">grandmastermt2000@yahoo.de</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
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.<br>


The publisher simply generates the timestamp and publishes the packet at a rate of 20hz.<br>
<br>
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.<br>
However when I change the setup slightly, the data gets distorted heavily. The only thing I changed was the way the publisher works.<br>
The publisher now sends 2 packets at a rate of 20hz. This was achieved by a simple for-loop.<br>
Pseudocode:<br>
repeat 10000 times:<br>
for (i = 1 until 2)<br>
  generate timestamp for packet<br>
  node.publish(packet)<br>
end<br>
sleep<br>
<br>
<br>
Here is a plot of the example, which seemed to work (one packet at 20hz)<br>
<a href="http://img580.imageshack.us/img580/4402/matlabros1.png" target="_blank">http://img580.imageshack.us/img580/4402/matlabros1.png</a><br>
<br>
Now when I do a burst of 2 messages at 20hz I get this:<br>
<a href="http://img38.imageshack.us/img38/70/matlabros2.png" target="_blank">http://img38.imageshack.us/img38/70/matlabros2.png</a><br>
<br>
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.<br>
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).<br>
To clarify here is a snippet of the matlab code:<br>
for i = 1:2:50<br>
    plot(i, ros_burst(i), '*', 'Color', 'r');<br>
    plot(i+1, ros_burst(i+1), '*', 'Color', 'b');<br>
end<br>
This means the red star should be the first message of the burst.<br>
Here is the corresponding plot:<br>
<a href="http://img704.imageshack.us/img704/994/matlabros3.png" target="_blank">http://img704.imageshack.us/img704/994/matlabros3.png</a><br>
<br>
I also plotted the whole data set with this color scheme:<br>
<a href="http://img827.imageshack.us/img827/3715/matlabros4.png" target="_blank">http://img827.imageshack.us/img827/3715/matlabros4.png</a><br>
<br>
<br>
I did not expect something like this to happen and unfortunately I can't explain this on my own.<br>
Is anyone familiar with this? The ros code I have written is extremely simple and if requested I can post the relevant parts.<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br></div>