Last active
August 8, 2016 09:10
-
-
Save jokla/2630f8dbbd4391d91ab28b2f3f76801a to your computer and use it in GitHub Desktop.
How to compute frame transformations with Tf (ROS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rospy | |
import math | |
import tf | |
if __name__ == '__main__': | |
rospy.init_node('look_up_pepper_tf') | |
listener = tf.TransformListener() | |
trans = [] | |
rot = [] | |
rate = rospy.Rate(10.0) | |
while not trans: | |
try: | |
(trans,rot) = listener.lookupTransform('/base_footprint', '/CameraTop_optical_frame', rospy.Time(0)) | |
except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException): | |
continue | |
rate.sleep() | |
print 'Translation: ' , trans | |
print 'Rotation: ' , rot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment