<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 09/01/2010 05:49 PM, Tim Field wrote:<br>
<blockquote
cite="mid:AANLkTinawTUpEBAUpL2hX_LKrPjTiMeAAJesqf=aAGYW@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<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="border: medium none ; margin: 0pt 0pt 0pt 40px; 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>
</blockquote>
<br>
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)!<br>
<br>
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.<br>
<br>
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.<br>
<br>
Cheers,<br>
Armin<br>
<pre class="moz-signature" cols="72">--
Armin Hornung Albert-Ludwigs-Universität
<a class="moz-txt-link-abbreviated" href="http://www.informatik.uni-freiburg.de/~hornunga">www.informatik.uni-freiburg.de/~hornunga</a> Dept. of Computer Science
<a class="moz-txt-link-abbreviated" href="mailto:HornungA@informatik.uni-freiburg.de">HornungA@informatik.uni-freiburg.de</a> Humanoid Robots Lab
Tel.: +49 (0)761-203-8010 Georges-Köhler-Allee 79
Fax : +49 (0)761-203-8007 D-79110 Freiburg, Germany
</pre>
</body>
</html>