tf listener cant look up transform frame
I run tf tf_echo /Pioneer3AT/map /Pioneer3AT/base_link
and compute exact data needed (so, everything is looking good so far):
...
At time 1407419581.729
- Translation: [-8.999, -22.000, 0.000]
- Rotation: in Quaternion [-0.000, 0.000, 0.850. 0.526]
in RPY [0.000. -0.000, 2.034]
...
Working through the tutorials I come up with the following script for a tf listener:
import roslib
import rospy
import tf
import sys, traceback
if __name__ == '__main__':
rospy.init_node('tf_P3AT')
listener = tf.TransformListener()
rate = rospy.Rate(10.0)
try:
now = rospy.Time(0)
(trans, rot) = listener.lookupTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now)
except:
traceback.print_exc(file=sys.stdout)
The error I receive is as follows:
Traceback (most recent call last): File "/ros/hydro/catkin/src/ros-pioneer3at/scripts/tf_listener.py", Line 15, in <module> (trans, rot) = listener.lookupTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now) LookupException: "Pioneer3AT/map" passed to lookupTransform argument target_frame does not exist
Have also tried the following bit of code using the tf and time tutorial:
import roslib
import rospy
import tf
import sys, traceback
if __name__ == '__main__':
rospy.init_node('tf_P3AT')
listener = tf.TransformListener()
listener.waitForTransform("/Pioneer3AT/map", "Pioneer3AT/base_link", rospy.Time(), rospy.Duration(4.0)
rate = rospy.Rate(10.0)
try:
now = rospy.Time.now()
listener.waitForTransform("/Pioneer3AT/map", "Pioneer3AT/base_link", now, rospy.Duration(4.0)
(trans, rot) = listener.lookupTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now)
except:
traceback.print_exc(file=sys.stdout)
This throws the following error:
Traceback (most recent call last): File "/ros/hydro/catkin/src/ros-pioneer3at/scripts/tf_listener.py", line 16, in <module> lisener.waitForTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now, rospy.Duration(4.0)) Exception: lookup would require extrapolation into the past. Requested time 1407508275.045120001 but the earliest data is at time 1407508275.084692717, when looking up transform from frame [Pioneer3AT/base_link] to frame [Pioneer3AT/map]
Anyone have tips on where to start next?
edit 1:
Output from roswtf produces:
Loaded plugin tf.tfwtf
No package or stack in context
Static checks summary:
No errors or warnings
Beginning tests of your ROS graph. These may take awhile... analyzing graph... ... done analyzing graph running graph rules... ... done running graph rules running tf checks, this will take a second... ... tf checks complete
Online checks summary:
Found 1 warning(s). Warnings are things that may be just fine, but are sometimes at fault
WARNING The following node subscriptions are unconnected: * /nodelet_manager: * /Pioneer3AT/ps3joy/cmd_vel * /Pioneer3AT_gmapping: * /Pioneer3AT/laserscan * /tf_static * /Pioneer3AT_move_base: * /Pioneer3AT/move_base_simple/goal * /tf_static
edit 2:
Image result of rosrun rqt_tf_tree rqt_tf_tree
Here is an online link of pic: link text and here link text
edit 3:
Solution
Using the launch/core/urdf.launch listed here: https://github.com/dawonn/ros-pioneer... on git. A user needs to Look at line 6: This puts a prefix on published transforms from this node. Removing it or changing value to "", takes out undesired "Pioneer3AT".
A possible second fix, modify xacro file listed here: https://github.com/dawonn/ros-pioneer... on line 12, chassis link already has Pioneer3AT in its name. Try renaming it just ...
Not sure if syntax is same for python, but pulled from the tf listener tutorial: "The time at which we want to transform. Providing ros::Time(0) will just get us the latest available transform." Try doing at time 0 so you dont have a delay and just grab the latest transform. Maybe thatll help
I used
now = rospy.Time(0)
in my first bit of code above, from the tf listener tutorial, throwing back the first error. Then followed the tf time tutorial, producing the second bit of code.rospy.Time.now()
does not accept arguments. Retriedrospy.Time(0)
in second bit code. Same error.once everything is running, run roswtf and tell me if it gives you any errors.