-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathexample_multi_robot.py
More file actions
71 lines (47 loc) · 1.33 KB
/
example_multi_robot.py
File metadata and controls
71 lines (47 loc) · 1.33 KB
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
# uArm Swift Pro - Python Library Example
# Created by: Richard Garsthagen - the.anykey@gmail.com
# V0.3 - June 2018 - Still under development
#
# Use Python 2.x!
import uArmRobot
import time
bots = 2
#Configure Serial Port
myRobot = []
myRobot.append(uArmRobot.robot("com3",0)) # user 0 for firmware < v4 and use 1 for firmware v4
myRobot.append(uArmRobot.robot("com4",0)) # user 0 for firmware < v4 and use 1 for firmware v4
# Enable / Disable debug output on screen, by default disabled
#uArmRobot.robot.debug = True
# Connect to all the robots
for b in range(0,bots):
myRobot[b].connect()
myRobot[b].mode(0)
time.sleep(1)
# Move robot one by one
print ("Move 1")
for b in range(0,bots):
myRobot[b].goto(200,0,100,6000)
# Move all robots at same time
print ("Move 2")
for b in range(0,bots):
myRobot[b].async_goto(200,-150,250,6000)
moving = True
while moving:
moving = False
for b in range(0,bots):
if myRobot[b].moving: moving=True
time.sleep(0.1)
print ("Move 3")
for b in range(0,bots):
myRobot[b].async_goto(200,150,50,6000)
moving = True
while moving:
moving = False
for b in range(0,bots):
if myRobot[b].moving: moving=True
time.sleep(0.1)
print ("all done")
time.sleep(5)
#Disconnect serial connection
for b in range(0,bots):
myRobot[b].disconnect()