Transforming in combined tree
I have a task of using a static ur5 manipulator to detect and point at a mobile turtlebot. I am a beginner and I'm told transforms is the solution I want. (Please comment if you disagree).
I have a ur5 and a turtlebot3 spawned into a an empty gazebo world.
I have a static transform publisher, shown below, in my launch file which I use to combine the tf trees of both robots.
<node pkg='tf2_ros' type='static_transform_publisher' name='ur5_turtlebot3_transform' args='0 0 0 0 0 0 1 world odom'/>
So the merged tf tree is as follows:
The green bordered section on the right of the image is the turtlebot3 tf tree. Everything else is the ur5 tf tree. As my static transform code shows, I attached the turtlebot tree to the ur5 tree at the world node.
Further down the ur5 tree I highlighted in red the wrist_3_link node which is the node of origin for my attempted transform. The destination node is the base_footprint node, the second and last node on the turtlebot3 side of the tree.
However, my can_transform attempts at return 0 (false). So as you would expect lookup_transforms errors:
def __init__(self):
# declarations
self.robot = moveit_commander.RobotCommander()
self.scene = moveit_commander.PlanningSceneInterface()
self.manipulator = moveit_commander.MoveGroupCommander('ur5_bot')
self.tf_buffer = tf2_ros.Buffer()
self.tf_listener = tf2_ros.TransformListener(self.tf_buffer)
try:
# transform_stamped = tf_buffer.lookup_transform('wrist_3_link', 'base_footprint', rospy.Time())
transform_stamped = self.tf_buffer.can_transform('wrist_3_link', 'base_footprint', rospy.Time())
rospy.loginfo(transform_stamped)
except (tf2_ros.LookupException, tf2_ros.ConnectivityException, tf2_ros.ExtrapolationException) as e:
rospy.logerr(e)
And, just to test, I tried a can_transform between nodes entirely on the ur5 side of the tree, i:e base_link to world, but still the result was false.
I'm not sure what I'm missing and/or doing wrong. I would appreciate some help.