Can TransformListener get the transformation of an indirect child
I am using a tf::TransformListener listener to get the transformation between two frame in my c++ program. My tf Tree is as follow Parent -> Child1 ->Child2 . I am using the following line to get the transformation between Parent to Child1:
listener.lookupTransform(frame_parent, frame_child1, ros::Time(0), transform);
When I am displaying the /tf topic with rostopic echo /tf, I can see a transformation for Parent -> Child1 and a transformation from Child1 -> Child2.
My question is, can I get the transformation from Parent -> Child2 ? Can the TransformListener return a combination of transformations ? I wrote something like this:
listener.lookupTransform(frame_parent, frame_child2, ros::Time(0), transform);