17 """A simple tool to remove leading slashes from frame names.""" 25 argument_parser = argparse.ArgumentParser(
26 description=
"Removes leading slashes from frame names.")
27 argument_parser.add_argument(
"input", type=str, help=
"Input bag")
28 return argument_parser.parse_args()
32 if hasattr(msg,
"header"):
33 if msg.header.frame_id.startswith(
"/"):
34 msg.header.frame_id = msg.header.frame_id[1:]
35 if hasattr(msg,
"child_frame_id"):
36 if msg.child_frame_id.startswith(
"/"):
37 msg.child_frame_id = msg.child_frame_id[1:]
38 if hasattr(msg,
"transforms"):
39 for transform_msg
in msg.transforms:
45 with
rosbag.Bag(os.path.splitext(options.input)[0] +
".filtered.bag",
47 for topic, msg, t
in rosbag.Bag(options.input).read_messages():
49 outbag.write(topic, msg, msg.header.stamp
if msg._has_header
else t)
52 if __name__ ==
"__main__":