rotate.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 import rospy, sys, termios, tty
12 import time
13 from geometry_msgs.msg import Twist
14 
15 
17  def __init__(self):
18  self.pub = rospy.Publisher('/cmd_vel_mux/input/teleop', Twist, queue_size = 1)
19  self.old_settings = termios.tcgetattr(sys.stdin)
20  r=rospy.Rate(20)
21  try:
22  while not rospy.is_shutdown():
23  self.cmd = Twist()
24  self.cmd.angular.z = 3.1415926*30/180
25  self.pub.publish(self.cmd)
26  r.sleep()
27 
28  except :
29  print 'error'
30 
31  finally:
32  self.pub.publishf(self.cmd)
33 
34 
35 
36 
37 
38 if __name__=='__main__':
39  rospy.init_node('xbot_auto_control')
40  try:
41  rospy.loginfo( "initialization system")
43  print "process done and quit"
44  except rospy.ROSInterruptException:
45  rospy.loginfo("node terminated.")
46 


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