odom_to_pose_rpy.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from std_msgs.msg import String
5 from nav_msgs.msg import Odometry
6 import tf
7 import math
8 
9 def callback(data):
10  r,p,y = tf.transformations.euler_from_quaternion([data.pose.pose.orientation.x, data.pose.pose.orientation.y, data.pose.pose.orientation.z, data.pose.pose.orientation.w])
11  rospy.loginfo("x,y,z: %.3lf, %.3lf, %.3lf - rpy: %.3lf, %.3lf, %.3lf(%.3lf deg)", data.pose.pose.position.x, data.pose.pose.position.y, data.pose.pose.position.z, r, p, y, math.degrees(y))
12 
13 def listener():
14 
15  rospy.init_node('quat_to_rpy', anonymous=True)
16 
17  rospy.Subscriber("robotnik_base_control/odom", Odometry, callback)
18 
19  # spin() simply keeps python from exiting until this node is stopped
20  rospy.spin()
21 
22 if __name__ == '__main__':
23  listener()
24 


summit_xl_localization
Author(s):
autogenerated on Tue Apr 27 2021 03:07:09