Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

add metadata to rosbag

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 : 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 = ""
    for param in rospy.get_param_names():
      record_args += str(param + ": " + str(rospy.get_param(param))+ " | ")["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():
      bag.write('/rosparam', dump, t-rospy.rostime.Duration(0, 1))

Thanks in advance.