-
Notifications
You must be signed in to change notification settings - Fork 0
/
cybot_test.py
78 lines (76 loc) · 2.01 KB
/
cybot_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# license removed for brevity
import rospy
import time
from std_msgs.msg import String
timeSleep = 1
def talker():
pub = rospy.Publisher('/cybot_btt_cmd', String, queue_size=10)
rospy.init_node('serial_node', anonymous=True)
time.sleep(timeSleep)
rate = rospy.Rate(10) # 10hz
hello_str = "MOVE<X>20000</X>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<X>-20000</X>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<Y>20000</Y>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<Y>-20000</Y>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<Z>5000</Z>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<Z>-5000</Z>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E0>20000</E0>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E0>-20000</E0>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E1>-20000</E1>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E1>20000</E1>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E2>5000</E2>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E2>-5000</E2>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass