canTransform is always returing False

asked 2018-07-25 12:13:35 -0500

Sai Krishna gravatar image

updated 2018-07-25 12:23:56 -0500

jayess gravatar image

Hi, In the below code canTransform api is always returning False. Please let me know where I am wrong in the below code.

Python Code:

#! /usr/bin/env python
import rospy
import tf
rospy.init_node('can_trans')
tl = tf.TransformListener()
t = tf.Transformer(True, rospy.Duration(10.0))
tm=rospy.Time.now()-rospy.Duration(2)
while not t.canTransform("/world", "/servo", rospy.Time.now()):
    pass
print "Transform Exist" 
print tl.lookupTransform("/world", "/servo", rospy.Time.now())

URDF File:

<?xml version="1.0"?>
  <robot name="second_bot" xmlns:xacro="http://ros.org/wiki/xacro">

   <link name="world"/>

   <joint name="joint1" type="prismatic">
      <parent link="world"/>
      <child link="servo"/>
      <limit effort="1000.0" lower="0" upper="0.2" velocity="0.5"/>
      <origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
   </joint>  

   <link name="servo"/>

</robot>

tf_echo from world frame to servo frame:

ubuntu@ubuntu:~$ rosrun tf tf_echo 'world' 'servo'
At time 1532538600.522
- Translation: [0.000, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
            in RPY (radian) [0.000, -0.000, 0.000]
            in RPY (degree) [0.000, -0.000, 0.000]
edit retag flag offensive close merge delete

Comments

Hi @Sai Krishna, Did you solve the problem!!

rayane gravatar image rayane  ( 2019-09-04 12:16:27 -0500 )edit