TransformListener has unconnected trees
I have multiple tf frames which some of are dynamically published by the robot_state_publisher and some are static transformations.
When using the tf.TransformListener i get the error message that there are two or more unconnected trees. Running rosrun tf view_frames also shows the unconnected trees.
However, rosrun rqt_tf_tree rqt_tf_tree shows the correct tf tree, rviz can show the correct tf tree and even rosrun tf tf_echo source_frame destination_frame returns the transformation values.
What am I doing wrong?
EDIT1:
rosrun tf tf_monitor source_frame target_frame returns the correct chain, however every frame is published by "unknown publisher" and the only broadcaster node is called "unknown". Could this be the reason why view_frames or the TransformListener are failing?
EDIT2:
TF2 can do the transformation with the following piece of code:
tf_buffer = tf2_ros.Buffer()
tf2_listener = tf2_ros.TransformListener(tf_buffer)
tf_buffer.lookup_transform('world', 'halcon_camera', rospy.Time())
I can't be sure, but this sounds like something that could happen with a mixed TF1 / TF2 setup (static transforms, etc). perhaps @tfoote can help here?
You could be right because tf2 can do the transformation. I've added this to the question.
I don't want to suggest using some workaround when it's not necessary, but can you see whether setting
use_tf_static
(private param ofrobot_state_publisher
) toFalse
makes things work again? see wiki/robot_state_publisher.