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


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