I got a rosbag with a number of topics being played.
I am interested in adding a Header (more specifically, a frame_id) to the message received so some 3d points in it are automatically displayed in RViz in the correct frame defined.
Is this possible? I know you can iterate a rosbag with the type of loop:
for topic, msg, t in inbag.read_messages():
if topic == "/desired_topic":
outbag.write(topic,msg.h,t)
if topic not in ["/desired_topic"]:
outbag.write(topic,msg,t)
outbag.close()
But I don't know how to add a field to the incoming message and save it in a new bag.
↧