odom2yaw.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # coding=utf-8
3 ######################################################################################
4 #> File Name: auto_rotate.py
5 #> Author:Rocwang
6 #> Mail: wangpeng@droid.ac.cn;
7 #> Github:https://github.com/yowlings
8 #> Created Time: 2018年06月14日 星期四 16时14分27秒
9 ######################################################################################
10 
11 
12 import rospy
13 import tf
14 from std_msgs.msg import Float64
15 from nav_msgs.msg import Odometry
16 
17 
18 alfa=0.1
19 beta=0.31415926/5
20 class Odom2Yaw(object):
21  """docstring for Odom2Yaw"""
22  def __init__(self):
23  self.help="""
24 
25  """
26  # if rospy.has_param("~cascPath"):
27  # self.cascPath = rospy.get_param("~cascPath")
28  # else:
29  # rospy.set_param("~cascPath","../scripts/haarcascade_frontalface_default.xml")
30  self.yaw_pub=rospy.Publisher('/yaw', Float64, queue_size = 1)
31  rospy.Subscriber("/odom",Odometry,self.odom_callback)
32  rospy.spin()
33 
34 
35 
36 
37  def odom_callback(self,odom):
38  yaw = Float64()
39  orie = odom.pose.pose.orientation
40  o=[orie.x,orie.y,orie.z,orie.w]
41 
42  rpy= tf.transformations.euler_from_quaternion(o)
43  yaw.data = rpy[2]*180/3.1415926
44  self.yaw_pub.publish(yaw)
45 
46 if __name__=='__main__':
47  rospy.init_node('odom2yaw')
48  try:
49  rospy.loginfo( "initialization system")
50  Odom2Yaw()
51  print "process done and quit"
52  except rospy.ROSInterruptException:
53  rospy.loginfo("node terminated.")
def __init__(self)
Definition: odom2yaw.py:22
def odom_callback(self, odom)
Definition: odom2yaw.py:37


xbot_tools
Author(s):
autogenerated on Sat Oct 10 2020 03:28:22