Re: [ros-users] Bag file recording / playback asynchronous i…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Armin Hornung
Date:  
To: ros-users
Subject: Re: [ros-users] Bag file recording / playback asynchronous in RViz
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
        Humanoid Robots Lab
Tel.: +49 (0)761-203-8010                  Georges-Köhler-Allee 79
Fax : +49 (0)761-203-8007                  D-79110 Freiburg, Germany