Bag: how to get relative transform using python
I have a bag with a minimal tf tree: Basically one parent and two children. My goal is now to get the tf from child1 to child 2. I followed this tutorial and this question but still it is somehow unclear to me, how I would do that. I am sure that someone already did this and I am wondering what the best way is to achieve this using python. Thx!
What I have so far:
tf_buffer = tf2.BufferCore(rospy.Duration(1000000))
bag = rosbag.Bag(path_to_bag)
for topic, msg, t in bag.read_messages(topics=['/tf', '/tf_static']):
for msg_tf in msg.transforms:
if topic == '/tf_static':
tf_buffer.set_transform_static(msg_tf, "default_authority")
else:
tf_buffer.set_transform(msg_tf, "default_authority")
tf_buffer.lookup_transform("child1", "child2")