-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (30 loc) · 823 Bytes
/
main.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
import stabilizeSwitch
import gyroSensor
import homePositionSwitch
import motor
import timer
import controller
def goHome():
while not((homePositionSwitch.isHome())):
motor.turnCCW()
def goToStartStabilizePosition():
print('go to stabilize position.')
motor.turnCW()
timer.delay(motor.timeToStartPosition)
def stabilize():
controller.Control(gyroSensor.rotation())
def main():
stabilizeSwitch.initialize()
gyroSensor.initialize()
homePositionSwitch.initialize()
motor.initialize()
timer.delay(500);
stabilizeState = stabilizeSwitch.position()
while 1:
while stabilizeSwitch.position() == stabilizeState:
pass
stabilizeState = stabilizeSwitch.position()
goHome()
if stabilizeState == stabilizeSwitch.on:
goToStartStabilizePosition()
stabilize()