-
Notifications
You must be signed in to change notification settings - Fork 0
/
COMP_GOATFINAL.py
285 lines (234 loc) · 16.2 KB
/
COMP_GOATFINAL.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase, GyroDriveBase
from pybricks.tools import wait, StopWatch
from pybricks.tools import hub_menu
#GLOBAL SETTINGS FOR GOATBOTv2 | OPTIMIZED FOR THE NEW ROBOT!!PLEASE CHECK
hub = PrimeHub()
left_motor = Motor(Port.C, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.D)
drive_base = GyroDriveBase(left_motor, right_motor, wheel_diameter=62.5, axle_track=136)
drive_base.settings(300,600,100,200)
Right_arm = Motor(Port.E, Direction.COUNTERCLOCKWISE, [24, 12, 12, 24])
Left_arm = Motor(Port.A, Direction.COUNTERCLOCKWISE, [24, 12, 12, 24])
speed = 400
#MENU FOR RUNS | Choose a letter Secrets Lie Here ----> Hey, don't look! Please, I'll give you -$0.02! There's nothing I'm telling you! Please, don't go any further! I'll ban you from the Earth!!! I'll call your mommy!!! I'll call MY mommy, my daddy, my uncles and aunties, all my weird relatives if it means keeping this secret from the likes of you!!! Okay, fine... Strawberries eat humans who disrespect pasta. How did you guess that that wasn't my real secret? Eh, I guess I made it easy enough... No WAY I'm telling you the real secret! That's all you're getting! OK, fine, I'll tell you the real secret... You're persistent, aren't you? OK, I'll stop stalling... You're a menace to society, you know? You ready for this????? What do you mean, obviously?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?! Here we go... Zero doesn't exist, because zero is nothing, but to speak of nothing is to speak of something. SHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DON'T TELL ANYONE!!!
selected = hub_menu("1","2", "3","4")
#Code Starts here!
def Sahas_Nik():
#Run 1 Code
drive_base.settings(400, 900, 100, 200)
# CODE from start position to move Orange Stop / M08 and M09 completion
Right_arm.run_angle(500, 550, wait=False)
Left_arm.run_angle(730, -1100, wait=False)
drive_base.straight(250)
drive_base.straight(50)
Right_arm.run_angle(900, -270)
drive_base.settings(90, 800, 100, 200)
drive_base.straight(-115)
drive_base.turn(-40)
drive_base.settings(400, 800, 100, 200)
# ORANGE STOP LIFTED(M08) and M09 COMPLETE
# START MOVING ROBOT TO EXECUTE M01
Left_arm.run_angle(500, 250)
Left_arm.run_angle(1000, 800, wait=False)
drive_base.turn(-65)
drive_base.straight(398)
wait(100)
drive_base.turn(-75)
drive_base.settings(100, 800, 100, 200)
# Parllel arm down with robot moving...risky but helps with speed
#Right_arm.run_angle(170, 520, wait=False)
drive_base.straight(100)
Right_arm.run_angle(1000, 590)
#Wait needed for parallel arm down
#wait(190)
#Right_arm.run_angle(400, 320)
drive_base.straight(-60)
Right_arm.run_angle(400, -270)
drive_base.settings(400, 800, 100, 200)
# M01 COMPLETE
# START MOVING ROBOT TO COLLECT SAM STAGE MANAGER AND EXECUTE M02
drive_base.straight(-70)
drive_base.turn(83)
Right_arm.run_angle(700, 300, wait=False)
drive_base.straight(283)
#Right_arm.run_angle(400, 400)
drive_base.settings(100, 800, 30, 200)
drive_base.turn(-15)
Right_arm.run_angle(380, -360)
drive_base.turn(-22)
drive_base.settings(200, 800, 100, 200)
drive_base.straight(90)
drive_base.straight(-100)
#STOP CODE HERE FOR PINK BALL
#CODE FOR ORANGE BALL
wait(200)
drive_base.straight(100)
drive_base.straight(-90)
# COMPLETE COLLECT SAM STAGE MANAGER AND EXECUTE M02
# HEAD TO M03 AND EXECUTE
drive_base.turn(100)
drive_base.settings(300, 800, 100, 200)
drive_base.straight(193)
drive_base.turn(38)
Left_arm.run_angle(1000, -1050)
drive_base.settings(60, 800, 20, 200)
drive_base.turn(-23)
Left_arm.dc(75)
Left_arm.run_angle(500, 1050, wait=False)
wait(400)
drive_base.straight(-70)
# COMPLETE M03
# HEAD TO M05 AND EXECUTE
drive_base.settings(600, 800, 200, 400)
drive_base.turn(15)
Left_arm.run_angle(900, -850, wait=False)
drive_base.straight(545)
drive_base.turn(-28)
drive_base.straight(83)
drive_base.settings(600, 800, 300, 400)
drive_base.turn(80)
# COMPLETE M05
# HEAD TO M06 and M07 AND EXECUTE
drive_base.settings(400, 600, 100, 200)
Left_arm.run_angle(500, 950, wait=False)
drive_base.straight(140)
#POSITIONING THE ROBOT FOR M06 and M07
drive_base.turn(-50)
drive_base.straight(480)
drive_base.turn(-41)
drive_base.settings(300, 400, 200, 400)
#COMMENTED CODE HERE TO TURN ON LEFT LEVER FOR SPEAKER
#drive_base.straight(-70)
#LOWERING THE ARM FOR FLIPPING THE LEFT SPEAKER LEVER
#Left_arm.run_angle(400, -1000)
#drive_base.straight(60)
#Left_arm.run_angle(400, 200)
#drive_base.turn(-25)
#drive_base.straight(-80)
#Left_arm.run_angle(1000, 600)
#drive_base.turn(25)
#CODE FOR M06 and RIGHT LEVER STARTS HERE
drive_base.straight(60)
Right_arm.run_angle(400, 90)
drive_base.turn(15)
drive_base.straight(-120)
drive_base.settings(800, 900, 200, 400)
drive_base.turn(100)
drive_base.straight(600)
#RUN1 ENDS AND ROBOT BACK IN EAST HOMEBASE
def A_M():
#Run 2 Code
#Code for Bot2 Starts here!
drive_base.curve(100, -35)
#Reach the girl
drive_base.straight(240)
#Pickup izzy girl No wait false. Not enough distance
Right_arm.run_target(575, -400)
drive_base.turn(-0.5)
#Reach Chicken gear
drive_base.straight(124)
#Moving the chicken
Left_arm.run_target(1000, 3000)
#Chicken done
#Aligning to lift the latch
drive_base.straight(-7)
drive_base.curve(-125,12)
#Raising latch and coming back
drive_base.straight(-57)
#unhook the latch and coming back
drive_base.straight(10)
drive_base.turn(22)
#move back
drive_base.straight(-100)
#Updating the speed to go faster (600, 600, 200,200)
drive_base.settings(600,600,200,200)
#Pickup Emily
drive_base.turn(-220)
#Get to the homezone
drive_base.straight(200)
#End of Run 2
def Aarush_Vihaan(): #Secrets Lie Here ----> Hey, don't look! Please, I'll give you -$0.02! There's nothing I'm telling you! Please, don't go any further! I'll ban you from the Earth!!! I'll call your mommy!!! I'll call MY mommy, my daddy, my uncles and aunties, all my weird relatives if it means keeping this secret from the likes of you!!! Okay, fine... Strawberries eat humans who disrespect pasta. How did you guess that that wasn't my real secret? Eh, I guess I made it easy enough... No WAY I'm telling you the real secret! That's all you're getting! OK, fine, I'll tell you the real secret... You're persistent, aren't you? OK, I'll stop stalling... You're a menace to society, you know? You ready for this????? What do you mean, obviously?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?! Here we go... Zero doesn't exist, because zero is nothing, but to speak of nothing is to speak of something. SHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DON'T TELL ANYONE!!!
#Code starts here!
drive_base.settings(800,800,100,200)
#Drive parallel to rolling camera
drive_base.straight(300)
#Lower left arm into the pocket next to the rolling camera
Left_arm.run_angle(500,-415)
#Drive forward, pushing the rolling camera and bringing the arm back up at the same time
drive_base.straight(135)
Left_arm.run_angle(500,415,wait=False)
#Push the boat
drive_base.straight(220)
#Come back from pushing the boat
drive_base.straight(-220)
#Turn
drive_base.curve(100,13)
#Move forward 320 mm
drive_base.straight(320)
#Curve to face exactly in front of the Light Show
drive_base.curve(100,77)
drive_base.curve(10,2.5)
#Drive closer to the light show
drive_base.straight(20)
#Increase duty cycle for more power and activate chopper arm; finish M11, drop expert and audience, and drop audience into light show area
Right_arm.dc(100)
Right_arm.run_angle(10000000,-3700)
Right_arm.run_angle(1000,20)
]#Move back and turn to face Noah the Sound Engineer
drive_base.straight(-150)
drive_base.turn(-45)
#Move to pick up Noah and turn full 180 to face home
drive_base.straight(235)
drive_base.turn(80)
drive_base.straight(-80)
drive_base.turn(60)
#Drive back really fast
drive_base.settings(1000,1000,100,200)
drive_base.straight(1100)
def Mahati_Aarush():
#Run 4 Code
#Drop off little experts and audience members #Yay
drive_base.straight(600)
drive_base.turn(-10)
drive_base.straight(195)
drive_base.turn(-35)
Right_arm.run_angle(200,225)
wait(10)
Right_arm.run_angle(300, -35, wait=False)
drive_base.straight(-70)
#Turn to avoid flower
drive_base.curve(45,-63)
drive_base.straight(235)
wait(10)
#drop off innovation
drive_base.curve(336,75) # New bot 1
Right_arm.run_angle(200,265)
#disconnect Anna the curator
drive_base.turn(-28)
#go back
drive_base.straight(-180)
#turn for next position
drive_base.turn(-40)
drive_base.straight(200)
drive_base.curve(695,31)
#IZZY dropoff
Right_arm.run_angle(200,206)
drive_base.turn(-28)
#the last expert Emily
Right_arm.run_angle(200,340,wait=False)
drive_base.straight(45)
drive_base.curve(200,-62)
wait(10000)
#The End!
#Based on Selection, run the program
if selected == "1":
Sahas_Nik()
elif selected == "2":
A_M()
elif selected== "3":
Aarush_Vihaan()
elif selected == "4":
Mahati_Aarush()