odom_baselink_tf.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib
00003 import rospy
00004 import tf
00005 from nav_msgs.msg import Odometry
00006 
00007 # Transform from /odom to /base_link
00008 
00009 def poseCallback(msg):
00010 
00011     odomBroadcaster = tf.TransformBroadcaster()
00012 
00013     o = Odometry()
00014     position = (msg.pose.pose.position.x / 1000.0,
00015                 msg.pose.pose.position.y / 1000.0,
00016                 msg.pose.pose.position.z / 1000.0)
00017     orientation = ( msg.pose.pose.orientation.x,
00018                     msg.pose.pose.orientation.y,
00019                     msg.pose.pose.orientation.z,
00020                     msg.pose.pose.orientation.w)
00021 
00022     odomBroadcaster.sendTransform(  position, 
00023                                     orientation, 
00024                                     rospy.Time.now(), 
00025                                     "/base_link",
00026                                     "/odom")
00027 
00028 if __name__ == '__main__':
00029 
00030     rospy.init_node('odom_baselink_tf')
00031 
00032     rate = rospy.Rate(20.0)
00033 
00034     rospy.Subscriber('/pose', Odometry, poseCallback)
00035 
00036     rospy.spin()


pioneer_bringup
Author(s): Amine BENDAHMANE
autogenerated on Sat Jun 8 2019 20:59:00