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

Armin Hornung HornungA at informatik.uni-freiburg.de
Wed Sep 1 16:31:07 UTC 2010


On 09/01/2010 05:49 PM, Tim Field wrote:
> 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()
>

Great, thanks Tim! That's exactly the postprocessing that I was looking 
for (and I wasn't even aware of that nice Python rosbag API)!

I just had to filter out "rosout" because a few messages from way in the 
past delayed the real messages for too long, but otherwise all looks 
fine at a first glance.

Is that worth adding as a full script to rosbag, or at least to mention 
it in the wiki somewhere? I will definitely use that more often to get 
better screencaptures in RViz from bagfiles.

Cheers,
Armin

-- 
Armin Hornung                              Albert-Ludwigs-Universität
www.informatik.uni-freiburg.de/~hornunga   Dept. of Computer Science
HornungA at informatik.uni-freiburg.de        Humanoid Robots Lab
Tel.: +49 (0)761-203-8010                  Georges-Köhler-Allee 79
Fax : +49 (0)761-203-8007                  D-79110 Freiburg, Germany

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


More information about the ros-users mailing list