On Wed, Sep 1, 2010 at 7:58 AM, Armin Hornung <span dir="ltr"><<a href="mailto:HornungA@informatik.uni-freiburg.de">HornungA@informatik.uni-freiburg.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

This looks like rosbag plays back the messages just as they are stored<br>
in the bag file, and rviz displays things immedately as they arrive,<br>
regardless of eventual timestamps in the messages.</blockquote><div><br></div><div>That's correct.  rosbag plays messages back according to the time they were received.  That may be very different to when they were published over an unreliable/slow link.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Is there a<br>
postprocessing step, playback option or similar I could try to get a<br>
smooth linear close-to-realtime visualization?</blockquote><div><br></div><div>Unfortunately, no.  The time at which a message was published isn't available to the subscriber.  If the ROS communications protocol were to send that information, then rosbag could publish at that time instead.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I tried "rosrun rosbag<br>
bagsort.py" to at least sort the messages, but that currently results in<br>
a python error (cturtle, used to work in boxturtle):<br></blockquote><div><br></div><div>Thanks for raising that - bagsort.py is vestigial and needs to be deleted.  There's no need to sort bags (either in Boxturtle or C Turtle) as an index is used to randomly access the messages.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Maybe there's already a tool available which buffers a few messages and<br>
sends them out at the correct frequency by their timestamp in the<br>
header? If not, then that's probably what I need to hack up ;)<br></blockquote><div><br></div><div>Sure.  It may be easier to just use rosbag play on a bag in which the message timestamps have been rewritten to their header timestamp (if available), i.e.</div>

<div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">import roslib; roslib.load_manifest('rosbag')</font></div>

</div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">import sys, rosbag</font></div></div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">outbag = rosbag.Bag(sys.argv[2], 'w')</font></div>

</div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">try:</font></div></div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">    for topic, msg, t in rosbag.Bag(sys.argv[1]).read_messages():</font></div>

</div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">        outbag.write(topic, msg, msg.header.stamp if msg._has_header else t)</font></div></div><div class="gmail_quote">

<div><font class="Apple-style-span" face="'courier new', monospace">finally:</font></div></div><div class="gmail_quote"><div><font class="Apple-style-span" face="'courier new', monospace">    outbag.close()</font></div>

</div></blockquote><div class="gmail_quote"><div><br></div><div>Tim</div><div><br></div></div>