forked from zuiho-kai/rov-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimedController.py
More file actions
60 lines (47 loc) · 2.03 KB
/
Copy pathTimedController.py
File metadata and controls
60 lines (47 loc) · 2.03 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
import time
import threading
from LowController import LowController
class TimedController:
def __init__(self):
self.LowController = LowController()
def timedForwards(self, force, mS):
self.LowController.forwards(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedBackwards(self, force, mS):
self.LowController.backwards(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedTurnLeftByLeftWheel(self, force, mS):
self.LowController.turnLeftByLeftWheel(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedTurnRightByLeftWheel(self, force, mS):
self.LowController.turnRightByLeftWheel(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedTurnLeftByRightWheel(self, force, mS):
self.LowController.turnLeftByRightWheel(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedTurnRightByRightWheel(self, force, mS):
self.LowController.turnRightByRightWheel(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedRotateClockwise(self, force, mS):
self.LowController.rotateClockwise(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def timedRotateAntiClockwise(self, force, mS):
self.LowController.rotateAntiClockwise(force)
thread = threading.Thread(target = self.timedStop, args = [mS])
thread.start()
def rotate90Clockwise(self) :
#self.timedRotateClockwise(30, 230)
self.timedRotateClockwise(20, 280)
def rotate90AntiClockwise(self):
#self.timedRotateAntiClockwise(30, 230)
self.timedRotateAntiClockwise(20, 280)
def timedStop(self, mS):
time.sleep(mS/1000)
self.LowController.stop()