odom_baselink_tf.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import roslib
3 import rospy
4 import tf
5 from nav_msgs.msg import Odometry
6 
7 # Transform from /odom to /base_link
8 
9 def poseCallback(msg):
10 
11  odomBroadcaster = tf.TransformBroadcaster()
12 
13  o = Odometry()
14  position = (msg.pose.pose.position.x / 1000.0,
15  msg.pose.pose.position.y / 1000.0,
16  msg.pose.pose.position.z / 1000.0)
17  orientation = ( msg.pose.pose.orientation.x,
18  msg.pose.pose.orientation.y,
19  msg.pose.pose.orientation.z,
20  msg.pose.pose.orientation.w)
21 
22  odomBroadcaster.sendTransform( position,
23  orientation,
24  rospy.Time.now(),
25  "/base_link",
26  "/odom")
27 
28 if __name__ == '__main__':
29 
30  rospy.init_node('odom_baselink_tf')
31 
32  rate = rospy.Rate(20.0)
33 
34  rospy.Subscriber('/pose', Odometry, poseCallback)
35 
36  rospy.spin()


pioneer_bringup
Author(s): Amine BENDAHMANE
autogenerated on Fri Oct 11 2019 03:33:02