Skip to content

Commit 81377db

Browse files
author
CUAUV
committed
Merge pull request #85 in SOF/subcode from pooltest to master
1 parent 8c5edd0 commit 81377db

File tree

161 files changed

+13690
-2869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+13690
-2869
lines changed

cave/gui/#cave.glade#

Lines changed: 0 additions & 742 deletions
This file was deleted.

conf/ajax.conf

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
{
22
// The below are highly dependent on trim
33
"center_of_buoyancy": [0.00012155, -0.000034256, -0.00089525],
4-
"buoyancy_force": 215, // FUDGED to assume postively buoyant sub - 187 with black batteries
4+
//"buoyancy_force": 208, // green: 215, black: 187 FUDGED to assume postively buoyant sub
5+
"buoyancy_force": 198, // green: 215, black: 187 FUDGED to assume postively buoyant sub
56
"gravity_force": 189.38,
67

78
// only used for partially submerged buoyancy force calculation, non critical
89
"sub_height": 0.50,
910

11+
// distance from dvl beam to axis of rotation used to offset velocity
12+
// to account for misaligned reference point and dvl position
13+
// for minisub, probably doesn't matter
14+
"dvl_offset": 0,
15+
1016
// Moments of inertia (kg * m^2) from solidworks.
1117
// In the model frame.
1218
"I": [[0.6149, -0.0054, -0.0662],
@@ -42,22 +48,22 @@
4248
"type": "T200",
4349
"pos": [-0.271, -0.201, -0.0204],
4450
"heading_pitch": [0, 90],
45-
"reversed": false
51+
"reversed": true
4652
},
4753
{
4854
"name": "sway_aft",
4955
"type": "T200",
5056
"pos": [-0.271, -0.006, 0.031],
5157
"heading_pitch": [90, 0],
5258
"min_neg_pwm": -2,
53-
"reversed": true
59+
"reversed": false
5460
},
5561
{
5662
"name": "aft_starboard",
5763
"type": "T200",
5864
"pos": [-0.271, 0.201, -0.0204],
5965
"heading_pitch": [0, 90],
60-
"reversed": false
66+
"reversed": true
6167
},
6268
{
6369
"name": "starboard",
@@ -79,20 +85,20 @@
7985
"pos": [0.280, -0.006, 0.031],
8086
"heading_pitch": [90, 0],
8187
"min_neg_pwm": -2,
82-
"reversed": true
88+
"reversed": false
8389
}
8490

8591
// "vector": [ [0, -1, 0], 360, "vector_status.position_port", "vector_desires.port", 61, false ] },
8692
// "vector": [ [0, -1, 0], 360, "vector_status.position_starboard", "vector_desires.starboard", 793, false ] },
8793
],
8894

8995
"control_settings": {
90-
"depth": { "kP": 6.00, "kI": 0.15, "kD": 15.00, "rD": 0.5, "ramp_speed": 0.5 },
91-
"pitch": { "kP": 0.10, "kI": 0.10, "kD": 11.00, "rD": 50.0 },
96+
"depth": { "kP": 7.00, "kI": 0.15, "kD": 15.00, "rD": 0.3, "ramp_speed": 0.5 },
97+
"pitch": { "kP": 0.10, "kI": 0.10, "kD": 11.00, "rD": 30.0 },
9298
"heading": { "kP": 0.24, "kI": 0.02, "kD": 13.50, "rD": 20.0 },
9399
"velx": { "kP": 5.00, "kI": 0.00, "kD": 0.00, "rD": 0.1547 },
94100
"vely": { "kP": 5.00, "kI": 0.00, "kD": 0.00, "rD": 0.5 },
95-
"roll": { "kP": 0.14, "kI": 0.00, "kD": 10.00, "rD": 50.0 },
101+
"roll": { "kP": 0.14, "kI": 0.01, "kD": 10.00, "rD": 30.0 },
96102
"quat": { "kP": 30.0, "kI": 0.00, "kD": 4.00 }
97103
},
98104
"quaternion_filtering": 1,
@@ -106,10 +112,10 @@
106112
"area": 0.0
107113
},
108114
{
109-
"pos": [-0.25, 0, 0],
115+
"pos": [-1, 0, 0],
110116
"normal": [0, 0, 1],
111117
"cD": 2.0,
112-
"area": 0.00
118+
"area": 0.0
113119
},
114120
// fore sway, produces drag when swaying and rolling
115121
{
@@ -218,16 +224,23 @@
218224
},
219225

220226
"vision_modules": [
221-
{"name": "bicolor_gate", "capture_sources": ["forward"]},
227+
{"name": "gate", "capture_sources": ["forward"]},
228+
{"name": "vamp_buoy", "capture_sources": ["forward"]},
222229
// {"name": "torpedoes", "capture_sources": ["forward"]},
223230
{"name": "path", "capture_sources": ["downward"]},
231+
{"name": "bins_cover", "capture_sources": ["downward"]},
232+
{"name": "bins_image", "capture_sources": ["downward"]},
233+
{"name": "bins_lever", "capture_sources": ["downward"]},
224234
{"name": "record", "capture_sources": ["forward", "downward"]},
225-
{"name": "poster", "capture_sources": ["forward", "downward"]}
235+
{"name": "poster", "capture_sources": ["forward", "downward"]},
236+
{"name": "calibrate", "capture_sources": ["default"]}
226237
],
227238

228239
"actuators": {
229-
"top_torpedo": 5,
230-
"bottom_torpedo":4
240+
"left_marker": 2,
241+
"right_marker": 1
242+
//"top_torpedo": 5,
243+
//"bottom_torpedo":4
231244
// "left_marker": 4,
232245
// "left_torpedo" : 5,
233246
// "right_marker": 6,

conf/odysseus.conf

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
// The below are highly dependent on trim
33
"center_of_buoyancy": [-0.0005, -0.0025, -0.001],
4-
"buoyancy_force": 332.5, // green: 340.5 FUDGED to assume postively buoyant sub
4+
"buoyancy_force": 342.5, // black: 330, green: 342.5 FUDGED to assume postively buoyant sub
55
"gravity_force": 314.809539,
66

77
// only used for partially submerged buoyancy force calculation, non critical
88
"sub_height": 0.50,
99

10+
// distance from dvl beam to axis of rotation used to offset velocity
11+
// to account for misaligned reference point and dvl position
12+
// for minisub, probably doesn't matter
13+
"dvl_offset": -0.2286,
14+
1015
// Moments of inertia (kg * m^2) from solidworks.
1116
// In the model frame.
1217
"I": [[ 0.7570, -0.0193, -0.0157],
@@ -28,15 +33,15 @@
2833
"type": "T200",
2934
"pos": [0.3682922, -0.202912, -0.0352978],
3035
"heading_pitch": [0, 90],
31-
"reversed": true,
36+
"reversed": false,
3237
"broken": false
3338
},
3439
{
3540
"name": "port",
3641
"type": "T200",
3742
"pos": [0.062654, -0.3188122, -0.036898],
3843
"heading_pitch": [0, 0],
39-
"reversed": false,
44+
"reversed": true,
4045
"broken": false
4146
},
4247
{
@@ -53,7 +58,7 @@
5358
"type": "T200",
5459
"pos": [-0.3055542, 0.001685, -0.0289478],
5560
"heading_pitch": [90, 0],
56-
"reversed": true,
61+
"reversed": false,
5762
"broken": false
5863
},
5964
{
@@ -85,21 +90,31 @@
8590
"type": "T200",
8691
"pos": [0.5155614, 0.001685, -0.0289478],
8792
"heading_pitch": [90, 0],
88-
"reversed": false,
93+
"reversed": true,
8994
"broken": false
9095
}
9196

9297
// "vector": [ [0, -1, 0], 360, "vector_status.position_port", "vector_desires.port", 61, false ] },
9398
// "vector": [ [0, -1, 0], 360, "vector_status.position_starboard", "vector_desires.starboard", 793, false ] },
9499
],
95100

101+
// "control_settings": {
102+
// "depth": { "kP": 2.50, "kI": 0.03, "kD": 4.00, "rD": 0.30, "ramp_speed": 0.5 },
103+
// "pitch": { "kP": 0.16, "kI": 0.02, "kD": 5.0, "rD": 30.0 },
104+
// "heading": { "kP": 0.20, "kI": 0.004, "kD": 15.00, "rD": 20.0 }, // Who would ever set an I term on heading?! .25, 0, 1.5
105+
// "velx": { "kP": 9.50, "kI": 0.12, "kD": 0.50, "rD": 0.1547 },
106+
// "vely": { "kP": 10.00, "kI": 0.20, "kD": 0.50, "rD": 0.5 },
107+
// "roll": { "kP": 0.17, "kI": 0.02, "kD": 10.00, "rD": 30.0 },
108+
// "quat": { "kP": 30.0, "kI": 0.00, "kD": 4.00 }
109+
// },
110+
96111
"control_settings": {
97-
"depth": { "kP": 2.50, "kI": 0.03, "kD": 3.00, "rD": 0.30, "ramp_speed": 0.5 },
98-
"pitch": { "kP": 0.16, "kI": 0.02, "kD": 5.0, "rD": 30.0 },
99-
"heading": { "kP": 0.20, "kI": 0.002, "kD": 15.00, "rD": 20.0 }, // Who would ever set an I term on heading?! .25, 0, 1.5
112+
"depth": { "kP": 2.50, "kI": 0.03, "kD": 4.00, "rD": 0.30, "ramp_speed": 0.5 },
113+
"pitch": { "kP": 0.16, "kI": 0.02, "kD": 3.50, "rD": 30.0 },
114+
"heading": { "kP": 0.40, "kI": 0.004, "kD": 20.00, "rD": 20.0 }, // Who would ever set an I term on heading?! .25, 0, 1.5
100115
"velx": { "kP": 9.50, "kI": 0.12, "kD": 0.50, "rD": 0.1547 },
101116
"vely": { "kP": 10.00, "kI": 0.20, "kD": 0.50, "rD": 0.5 },
102-
"roll": { "kP": 0.17, "kI": 0.02, "kD": 10.00, "rD": 30.0 },
117+
"roll": { "kP": 0.2, "kI": 0.05, "kD": 7.00, "rD": 30.0 },
103118
"quat": { "kP": 30.0, "kI": 0.00, "kD": 4.00 }
104119
},
105120
"quaternion_filtering": 1,
@@ -264,28 +279,25 @@
264279
},
265280

266281
"vision_modules": [
267-
{"name": "bicolor_gate", "capture_sources": ["forward"]},
282+
{"name": "gate", "capture_sources": ["forward"]},
283+
{"name": "stake", "capture_sources": ["forward"]},
268284
//{"name": "dice", "capture_sources": ["forward"]},
269-
// {"name": "torpedoes", "capture_sources": ["forward"]},
270-
{"name": "path", "capture_sources": ["downward"]},
285+
// {"name": "paul_path", "capture_sources": ["downward"]},
286+
{"name": "vampire", "capture_sources": ["downward"]},
287+
{"name": "crucifix", "capture_sources": ["downward"]},
271288
//{"name": "roulette", "capture_sources": ["downward"]},
272289
//{"name": "cash_in_forward", "capture_sources": ["forward"]},
273290
//{"name": "cash_in_downward", "capture_sources": ["downward"]},
274291
{"name": "record", "capture_sources": ["forward", "downward"]},
275-
{"name": "poster", "capture_sources": ["forward", "downward"]}
292+
{"name": "poster", "capture_sources": ["forward", "downward"]},
293+
{"name": "calibrate", "capture_sources": ["default"]}
276294
],
277295

278296
"actuators": {
279-
"bottom_torpedo": 4,
280-
"top_torpedo": 5
281-
// "left_marker": 4,
282-
// "left_torpedo" : 5,
283-
// "right_marker": 6,
284-
// "right_torpedo" : 7,
285-
// "left_piston_extend" : 10,
286-
// "left_piston_retract" : 11,
287-
// "right_piston_extend" : 8,
288-
// "right_piston_retract" : 9
297+
"bottom_torpedo": 8,
298+
"top_torpedo": 4,
299+
"manipulator_grab": 9,
300+
"manipulator_release": 2
289301
}
290302
}
291303
// vim: set filetype=javascript expandtab :

conf/pollux.conf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,16 @@
216216
},
217217

218218
"vision_modules": [
219-
{"name": "bicolor_gate", "capture_sources": ["forward"]},
220-
{"name": "dice", "capture_sources": ["forward"]},
219+
{"name": "gate", "capture_sources": ["forward"]},
220+
{"name": "vamp_buoy", "capture_sources": ["forward"]},
221221
// {"name": "torpedoes", "capture_sources": ["forward"]},
222-
{"name": "path", "capture_sources": ["downward"]},
223-
{"name": "roulette", "capture_sources": ["downward"]},
224-
{"name": "cash_in_forward", "capture_sources": ["forward"]},
225-
{"name": "cash_in_downward", "capture_sources": ["downward"]},
222+
{"name": "paul_path", "capture_sources": ["downward"]},
223+
{"name": "bins_cover", "capture_sources": ["downward"]},
224+
{"name": "bins_image", "capture_sources": ["downward"]},
225+
{"name": "bins_lever", "capture_sources": ["downward"]},
226+
{"name": "garlic", "capture_sources": ["downward"]},
227+
// {"name": "cash_in_forward", "capture_sources": ["forward"]},
228+
// {"name": "cash_in_downward", "capture_sources": ["downward"]},
226229
{"name": "record", "capture_sources": ["forward", "downward"]},
227230
{"name": "poster", "capture_sources": ["forward", "downward"]}
228231
],

conf/vehicle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
buoyancy_force = d['buoyancy_force']
3333
gravity_force = d['gravity_force']
3434
sub_height = d['sub_height']
35+
dvl_offset = d['dvl_offset'] # TODO
3536
I = np.array(d['I'])
3637
thrusters = d['thrusters']
3738
sensors = d['sensors']

control/optimizer.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ def get_thrusters(self):
4646
# bounds is an array of min, max pairs for each thruster
4747
self.bounds = []
4848
for i, t in enumerate(got_thrusters):
49-
current_max_thrust, current_max_neg_thrust = t.current_max_thrusts()
50-
self.constraints.append(lambda x, m=current_max_thrust, i=i: m-x[i])
51-
self.constraints.append(lambda x, mn=current_max_neg_thrust, i=i: x[i]-mn)
52-
self.bounds.append((current_max_neg_thrust, current_max_thrust))
49+
self.constraints.append(lambda x, m=t.max_thrust, i=i: m-x[i])
50+
self.constraints.append(lambda x, mn=t.max_neg_thrust, i=i: x[i]-mn)
51+
self.bounds.append((t.max_neg_thrust, t.max_thrust))
5352

5453
# calculate some "starting step" guesses for the optimization algorithm
5554
# by using 1/4 of the average max thrust
5655
# good start guesses are important and make the algorithm run faster
57-
self.rhobeg = 0.25 * sum([current_max_thrust - current_max_neg_thrust \
58-
for (current_max_thrust, current_max_neg_thrust) in \
59-
[t.current_max_thrusts() for t in got_thrusters]]) / (len(got_thrusters) * 2)
56+
self.rhobeg = 0.25 * sum([t.max_thrust - t.max_neg_thrust \
57+
for t in got_thrusters]) / (len(got_thrusters) * 2)
6058

6159
# initial guess for optimizing function, currently static; 0 on all
6260
self.initial_guess = np.array((0,) * len(got_thrusters))
@@ -237,11 +235,10 @@ def set_motors(self, tm, ft_passive_s):
237235
# this only happens when desires are wild and slsqp fails
238236
# at that point we don't really care about accuracy and just
239237
# truncate for safety.
240-
current_max_thrust, current_max_neg_thrust = t.current_max_thrusts()
241-
if x[i] < current_max_neg_thrust:
242-
x[i] = current_max_neg_thrust
243-
elif x[i] > current_max_thrust:
244-
x[i] = current_max_thrust
238+
if x[i] < t.max_neg_thrust:
239+
x[i] = t.max_neg_thrust
240+
elif x[i] > t.max_thrust:
241+
x[i] = t.max_thrust
245242

246243
out[i] = t.thrust_to_pwm(x[i])
247244
if t.reversed_polarity:

control/thruster_manager.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ def max_forces(self, axis, torque=False):
6464
forces = [0, 0]
6565
f = lambda t: t.torque_about if torque else t.thrust_in
6666
for thruster in self.get_thrusters():
67-
current_max_thrust, current_max_neg_thrust = thruster.current_max_thrusts()
68-
max_t = (f(thruster))(axis, current_max_thrust)
69-
min_t = (f(thruster))(axis, current_max_neg_thrust)
67+
max_t = (f(thruster))(axis, thruster.max_thrust)
68+
min_t = (f(thruster))(axis, thruster.max_neg_thrust)
7069
forces[0] += min(max_t, min_t)
7170
forces[1] += max(max_t, min_t)
7271

control/thrusters.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020

2121
MODEL_DIR = os.path.join(os.environ['CUAUV_SOFTWARE'], 'control', 'bollard',
2222
'2015-06-03')
23-
NEAR_SURFACE_THRESHOLD = 0.5 # Meters depth
23+
# NEAR_SURFACE_THRESHOLD = 0.0 # Meters depth
24+
# DEPTH_THRUSTER_NAMES = ['fore_port', 'fore_starboard', 'aft_port', 'aft_starboard']
25+
# SURGE_THRUSTER_NAMES = ['port', 'starboard']
26+
# SWAY_THRUSTER_NAMES = ['sway_aft', 'sway_fore']
27+
# THRUSTER_NAMES = DEPTH_THRUSTER_NAMES + SURGE_THRUSTER_NAMES + SWAY_THRUSTER_NAMES
28+
NEAR_SURFACE_THRESHOLD = 0.1 # Meters depth
2429
DEPTH_THRUSTER_NAMES = ['fore_port', 'fore_starboard', 'aft_port', 'aft_starboard']
2530
SURGE_THRUSTER_NAMES = ['port', 'starboard']
2631
SWAY_THRUSTER_NAMES = ['sway_aft', 'sway_fore']
@@ -200,14 +205,8 @@ def __init__(self, yaw, pitch, position, min_neg_pwm, min_pos_pwm, drag=1.0, lin
200205
self.min_pos_pwm = min_pos_pwm
201206
self.min_neg_pwm = min_neg_pwm
202207

203-
if self.name in DEPTH_THRUSTER_NAMES:
204-
self.max_thrust = self.pwm_to_thrust(self.max_pwm * 3 / 4)
205-
self.max_neg_thrust = self.pwm_to_thrust(-self.max_pwm * 3 / 4)
206-
else:
207-
self.max_thrust = self.pwm_to_thrust(self.max_pwm)
208-
self.max_neg_thrust = self.pwm_to_thrust(-self.max_pwm)
209-
self.max_thrust_near_surface = self.pwm_to_thrust(self.max_pwm / 2)
210-
self.max_neg_thrust_near_surface = self.pwm_to_thrust(-self.max_pwm / 2)
208+
self.max_thrust = self.pwm_to_thrust(self.max_pwm)
209+
self.max_neg_thrust = self.pwm_to_thrust(-self.max_pwm)
211210

212211
self.min_thrust = self.pwm_to_thrust(self.min_pos_pwm)
213212
self.min_neg_thrust = self.pwm_to_thrust(self.min_neg_pwm)
@@ -366,15 +365,6 @@ def parse_model(self, filename):
366365
# else:
367366
# log("No model for %s thruster, defaulting to VideoRay!" % self.name)
368367

369-
def current_max_thrusts(self):
370-
"""
371-
Returns the maximum positive and negative thrusts given the current sub position
372-
"""
373-
if shm.kalman.depth.get() > NEAR_SURFACE_THRESHOLD:
374-
return self.max_thrust, self.max_neg_thrust
375-
else:
376-
return self.max_thrust_near_surface, self.max_neg_thrust_near_surface
377-
378368
class VideoRay(GenericThruster):
379369
max_pwm = 255
380370
min_pwm = 26

fishbowl/cw-he-calc/main.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import math
88
import numpy as np
99
from control.thruster_manager import ThrusterManager
10-
import shm
1110

1211
# average magnitude
1312
def amag(pair):
@@ -34,10 +33,6 @@ def calculate():
3433
# axis as [min, max]. We average |min| and |max| so we can treat it as
3534
# the major axis length in that direction.
3635

37-
# Set depth to well below surface of the water so that thruster maximums are computed
38-
# without any artificial throttling based on depth
39-
shm.kalman.depth.set(2.0)
40-
4136
fx = tm.max_forces(np.array([1, 0, 0]), torque=False)
4237
fy = tm.max_forces(np.array([0, 1, 0]), torque=False)
4338
fz = tm.max_forces(np.array([0, 0, 1]), torque=False)

0 commit comments

Comments
 (0)