/
Movement.py
88 lines (64 loc) · 1.62 KB
/
Movement.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
# Class to control the movement of the AUV
import time
import SerialCom
# Submerge the AUV to the desired depth
def submerge(depth):
print("submerging to: " + depth)
SerialCom.send(depth)
# Surface de desired feet
def surface(depth):
print("going up: " + depth + " feet")
SerialCom.send(depth)
# Move forward at a base 40% speed
def forward(seconds):
print("moving at: 40%")
# SerialCom.write0()
# SerialCom.write1()
count = 0
while count < seconds:
time.sleep(1)
align()
count += 1
# Move forward at the desired speed
def forward_at(speed, seconds):
print("moving at: " + speed)
count = 0
while count < seconds:
time.sleep(1)
align()
count += 1
# Move backward at a base 40% speed
def backward(seconds):
print("Backing up at: 40%")
# SerialCom.write0()
# SerialCom.write1()
count = 0
while count < seconds:
time.sleep(1)
align()
count += 1
# Move backward at the desired speed speed
def backward_at(speed, seconds):
print("Backing up at: " + speed)
count = 0
while count < seconds:
time.sleep(1)
align()
count += 1
# Rotates the entered angles COUNTER-CLOCKWISE
def left(angle):
print("moving left " + str(angle) + " degrees")
# Rotates the entered angles CLOCKWISE
def right(angle):
print("moving right " + str(angle) + " degrees")
# Stop AUV
def stop():
print("stopping")
seconds = 10
count = 0
while count < seconds:
time.sleep(1)
count += 1
# Get depth from the pressure sensor
def get_depth():
return 4.0