[ros-users] Bag file recording / playback asynchronous in RViz

Tim Field tfield at willowgarage.com
Wed Sep 1 15:49:36 UTC 2010


On Wed, Sep 1, 2010 at 7:58 AM, Armin Hornung <
HornungA at informatik.uni-freiburg.de> wrote:

> This looks like rosbag plays back the messages just as they are stored
> in the bag file, and rviz displays things immedately as they arrive,
> regardless of eventual timestamps in the messages.


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.

Is there a
> postprocessing step, playback option or similar I could try to get a
> smooth linear close-to-realtime visualization?


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.

I tried "rosrun rosbag
> bagsort.py" to at least sort the messages, but that currently results in
> a python error (cturtle, used to work in boxturtle):
>

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.

Maybe there's already a tool available which buffers a few messages and
> sends them out at the correct frequency by their timestamp in the
> header? If not, then that's probably what I need to hack up ;)
>

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.

import roslib; roslib.load_manifest('rosbag')
import sys, rosbag
outbag = rosbag.Bag(sys.argv[2], 'w')
try:
    for topic, msg, t in rosbag.Bag(sys.argv[1]).read_messages():
        outbag.write(topic, msg, msg.header.stamp if msg._has_header else t)
finally:
    outbag.close()


Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100901/9ce5a12d/attachment-0003.html>


More information about the ros-users mailing list