# Revision history [back]

Hello everybody,

I am trying to add ros parameters to a bag file just after the record is done.

I am writing a python script to do that and I have followed this link : http://wiki.ros.org/rosbag/Cookbook. But I didn't manage to make it work.

Nothing is added to the bag file and I have no error message .....

There is my code :

  record_args = ""
try:
for param in rospy.get_param_names():
record_args += str(param + ": " + str(rospy.get_param(param))+ " | ")
subprocess.call(["rosbag", "record", "-a", "-O", "test"])
except KeyboardInterrupt:
with rosbag.Bag('test.bag','a') as bag:
dump = String(data = record_args)
for _, _, t in bag.read_messages():
break
bag.write('/rosparam', dump, t-rospy.rostime.Duration(0, 1))
finally:
bag.close()