-
Notifications
You must be signed in to change notification settings - Fork 0
/
cybot_demo.py
59 lines (56 loc) · 1.72 KB
/
cybot_demo.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
#!/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><Y>20000</Y>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<X>30000</X><Y>-20000</Y><Z>-20000</Z>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E2>5000</E2><E1>-20000</E1><X>-30000</X><Z>20000</Z><E0>20000</E0><Y>-5000</Y>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E2>-10000</E2><E1>20000</E1><E0>-20000</E0><Y>5000</Y>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E2>5000</E2><E0>-20000</E0>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<E0>20000</E0><Y>40000</Y><X>-30000</X><Z>40000</Z><E1>-20000</E1>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
hello_str = "MOVE<Y>-40000</Y><X>30000</X><Z>-40000</Z><E1>20000</E1>"
rospy.loginfo(hello_str)
pub.publish(hello_str)
rate.sleep()
time.sleep(timeSleep)
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass