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@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@ipa.fraunhofer.de > http://ipa.fraunhofer.de > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users >