-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy_start.py
84 lines (64 loc) · 1.62 KB
/
strategy_start.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
79
80
81
82
83
84
from math import *
from class_robot import *
from strategy import *
from color import *
class StrategyStart(Strategy):
done = 0
def run(self):
if self.done:
return True
print ("StrategyStart")
robot=self.robot
table=self.table
robot.goFast()
robot.distanceHard()
robot.rotationHard()
# robot.activateUltrasounds()
print(robot.getX())
print(robot.getY())
print(robot.getAngle())
robot.openFrontGrip()
robot.activateUltrasounds()
#go take the 1st cup
robot.distanceVeryHard()
robot.goSlow()
robot.goto(table.cups[0].x+10, table.cups[0].y+90, autocolor=True)
# sleep(2)
robot.closeFrontGrip()
table.cups[0].isAvailable = False
sleep(1)
# robot.goFast()
# robot.distanceHard()
robot.goto(1040,605,0, autocolor=True)
robot.deactivateUltrasounds()
robot.rotateTo(-pi/3, autocolor=True)
robot.rotateTo(-pi/2, autocolor=True)
robot.rotateTo(-pi, autocolor=True)
robot.distanceSoft()
robot.moveBackward(300)
# robot.distanceHard()
robot.closeBackGrip()
robot.moveBackward(250)
sleep(1)
sleep(20)
robot.activateUltrasounds()
robot.goto(1000, 800, pi/2, autocolor=True)
robot.goto(1000, 1200, autocolor=True)
robot.openFrontGrip()
robot.deactivateUltrasounds()
sleep(1)
robot.moveBackward(200)
robot.rotateTo(-pi/2, autocolor=True)
robot.moveForward(80)
sleep(1)
robot.openBallGrip()
sleep(1)
robot.openBackGrip()
sleep(1)
robot.moveForward(140)
robot.rotateTo(-pi/2, autocolor=True)
print(robot.getX())
print(robot.getY())
print(robot.getAngle())
self.done=1
return True