[ros-users] Recording multiple topics with rosbag python API

Tim Field tfield at willowgarage.com
Mon Dec 13 17:47:41 UTC 2010


Georg,

The rosbag API's aren't thread-safe.  A couple of options: wrap your
write()'s in a Lock, or stick your messages on a Queue and have a separate
thread write to the bag.

Tim

On Mon, Dec 13, 2010 at 1:15 AM, Arbeiter, Georg <
Georg.Arbeiter at ipa.fraunhofer.de> wrote:

> I try to record multiple topics using a python script and the rosbag
> python API. I have two callback methods, writing to the same bag file:
>
> bag = rosbag.Bag('filename', 'w')
>
> def callback1(data):
>     bag.write('topic_name',data)
>
> def callback2(data):
>     bag.write('topic_name',data)
>
>
> However, the bag file is corrupted after recording. Even reindexing
> doesn't fix it. It looks like the callbacks are not called sequentially.
> Could you please tell me how to record multiple topics using a script?
>
> Best regards,
> Georg
>
> --
> Dipl.-Ing. Georg Arbeiter, Fraunhofer IPA
> Robotersysteme
> Nobelstrasse 12, 70569 Stuttgart
> Telefon 0711-970-1299, Fax 0711-970-1008
> mailto:georg.arbeiter at ipa.fraunhofer.de
> http://ipa.fraunhofer.de
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20101213/8e65d14d/attachment-0003.html>


More information about the ros-users mailing list