ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Needed to import Odometry, which is where the /Pioneer3AT/base_link lies, and a few other changes. Code below for fix!!!

import roslib
import rospy
import tf
import sys, traceback
from nav_msgs.msg import Odometry

if __name__ == '__main__':
    rospy.init_node('tf_P3AT')
    listener = tf.TransformListener()
    rate = rospy.Rate(10.0)

while not rospy.is_shutdown():
    try:
        now = rospy.Time(0)
        (trans, rot) = listener.lookupTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now)
    except: (tf.LookupException, tf.ConnectivityException):
        continue

    print 'translation: ',trans
    print 'rotation: ', rot

    rate.sleep()

Needed to import Odometry, which is where the /Pioneer3AT/base_link lies, and a few other changes. Code below for fix!!!

import roslib
import rospy
import tf
import sys, traceback
from nav_msgs.msg import Odometry

if __name__ == '__main__':
    rospy.init_node('tf_P3AT')
    listener = tf.TransformListener()
    rate = rospy.Rate(10.0)

while not rospy.is_shutdown():
    try:
        now = rospy.Time(0)
        (trans, rot) = listener.lookupTransform("/Pioneer3AT/map", "/Pioneer3AT/base_link", now)
    except: (tf.LookupException, tf.ConnectivityException):
        continue

    print 'translation: ',trans
    print 'rotation: ', rot

    rate.sleep()