Main Page
Namespaces
Classes
Files
File List
File Members
scripts
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
16
class
multi_keybroad_handle
():
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"
)
42
multi_keybroad_handle
()
43
print
"process done and quit"
44
except
rospy.ROSInterruptException:
45
rospy.loginfo(
"node terminated."
)
46
rotate.multi_keybroad_handle
Definition:
rotate.py:16
rotate.multi_keybroad_handle.cmd
cmd
Definition:
rotate.py:23
rotate.multi_keybroad_handle.__init__
def __init__(self)
Definition:
rotate.py:17
rotate.multi_keybroad_handle.pub
pub
Definition:
rotate.py:18
rotate.multi_keybroad_handle.old_settings
old_settings
Definition:
rotate.py:19
xbot_tools
Author(s):
autogenerated on Sat Oct 10 2020 03:28:22