Herowaree

print_odom

Aug 22nd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #! /usr/bin/env python
  2. import rospy
  3.  
  4. from nav_msgs.msg import Odometry
  5. from math import atan2
  6.  
  7. if __name__=='__main__':
  8. rospy.init_node('print_odom')
  9.  
  10. odom_info = rospy.wait_for_message('/tb2/odom', Odometry)
  11.  
  12. x = odom_info.pose.pose.position.x
  13. y = odom_info.pose.pose.position.y
  14. theta = 2 * atan2(odom_info.pose.pose.orientation.z, odom_info.pose.pose.orientation.w)
  15.  
  16. print("x: %.2f / y: %.2f / theta: %.2f"%(x, y, theta))
Advertisement
Add Comment
Please, Sign In to add comment