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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672 | # - Copyright (c) 2024 MBARI
# - MBARI Proprietary Information. Confidential. All Rights Reserved
# - Unauthorized copying or distribution of this file via any medium is strictly
# - prohibited.
# -
# - WARNING - This file contains information whose export is restricted by the
# - Export Administration Act of 1979 (Title 50, U.S.C., App. 2401 et seq.), as
# - amended. Violations of these export laws are subject to severe civil and/or
# - criminal penalties.
mission sci2_circle_hotspot {
arguments {
# Almost every mission should start with an overall timeout and a NeedCommsTime. Drift Missions will have an acoustic timeout instead of a NeedCommsTime.
# You probably need to change these.
MissionTimeout = 1 hour
"""
Maximum duration of mission
"""
NeedCommsTime = 30 minute
"""
On yo-yo transit to waypoint or yoyo-circling at the hotspot, how often to surface for commumications.
"""
Speed = 1.0 meter_per_second
"""
Vehicle speed when transiting or yoyo-circling at the hotspot.
"""
MaxDepth = 50 meter
"""
Maximum depth for the entire mission.
"""
RudderAngleYoyoCircle = 5 degree
YoYoMinDepth = 2 meter
"""
Minimum depth while performing the YoYo behavior.
"""
YoYoMaxDepth = 20 meter
"""
Maximum depth while performing the YoYo behavior.
"""
ValidLegDeepThresh = NaN meter
"""
Flip-to-ascent depth needs to be deeper than this threshold to be considered a valid leg for peak reporting.
"""
Lat[1..10] = NaN degree
"""
Latitude of waypoint {$}. If NaN, skipped.
"""
Lon[1..10] = NaN degree
"""
Longitude of waypoint {$}. If NaN, skipped.
"""
# debug
# </Description><Units:degree/><Value>36.803</Value></DefineArg>
# </Description><Units:degree/><Value>-121.83</Value></DefineArg>
# </Description><Units:degree/><Value>36.81</Value></DefineArg>
# </Description><Units:degree/><Value>-121.825</Value></DefineArg>
ModemIDDestination = 0 enum
"""
ID of destination modem to send acoustic messages to. Defaults to the same as ContactLabel
but doesn't have to be the same modem as that being tracked.
"""
NumProfilesAvgPeakDepth = 1 count
"""
Number of yoyo profiles for averaging the max-per-profile peak depths.
"""
PeakDetectChl = false
"""
Whether to enable peak chl detection on each yo-yo profile
"""
SendMessageTransitOrNot = true
"""
Whether to report this vehicle's maneuver mode (0 = spiral, 1 = transit) to the other LRAUV.
"""
MsgTransitOrNotPeriod = 10 minute
"""
Time interval of sending transit-or-not message to the other LRAUV.
"""
SendPeakDepthAvgProfilesChl = false
"""
Whether to report profiles-averaged max-per-profile depth of chlorophyll: _.peakdepth.
"""
ThreshChl = NaN microgram_per_liter
"""
Threshold for qualifying as a hotspot.
"""
PeakDetectPlanktivoreLMavgROI = false
"""
Whether to enable peak PlanktivoreLMavgROI detection on each yo-yo profile
"""
SendPeakDepthAvgProfilesPlanktivoreLMavgROI = false
"""
Whether to report profiles-averaged max-per-profile depth of PlanktivoreLMavgROI: _.peakdepth.
"""
ThreshPlanktivoreLMavgROI = 10 count_per_second
"""
Threshold for qualifying as a hotspot.
"""
ThreshHighSignalCounts = 1 count
"""
When in transit, if CountsHighSignal exceeds this threshold, exit transit to enter yoyo-circle.
"""
ThreshLowSignalCounts = 1 count
"""
When in yoyo-circle, if CountsLowSignal exceeds this threshold, exit yoyo-circle to run the transit.
"""
ListenToTerminateMissionMsg = false
"""
Whether to listen to the _.terminateMission acoustic message.
"""
# You probably do not need to change these.
IntervalRestartLogs = 24 hour
MinOffshore = 2 kilometer
"""
Minimum offshore distance for the entire mission.
"""
MinAltitude = 7 meter
"""
Minimum altitude for the entire mission.
"""
YoYoMinAltitude = 9 meter
"""
Minimum altitude while performing the YoYo behavior (for
bottom-terminated YoYos).
"""
YoYoUpPitch = 20 degree
"""
Vehicle up pitch while performing the YoYo behavior.
"""
YoYoDownPitch = -20 degree
"""
Vehicle down pitch while performing the YoYo behavior.
"""
LowPassWindowLengthVertical = 20 count
"""
Low-pass window length (based on depth sensor sampling interval 0.4
second) for low-pass filtering.
"""
MaxNumLaps = 20 count
"""
Maximum number of laps.
"""
}
output {
PeakDepthAvgOverProfiles = 0 meter
"""
The peak signal depth averaged over NumProfilesAvgPeakDepth of profiles.
"""
InTransit = true
"""
Initialized to true
"""
InYoyoCircle = false
"""
Initialized to false
"""
CountsHighSignal = 0 count
CountsLowSignal = 0 count
WaypointReached[1..10] = false
"""
Initialized to false
"""
ElapsedSinceLastMsgTransitOrNot = 0 hour
}
# Missions should almost always start with a timeout and a NeedComms aggregate. Drift missions will not use NeedComms.
timeout duration=MissionTimeout
insert id="NeedComms" Insert/NeedComms.tl
assign in sequence NeedComms:DiveInterval = NeedCommsTime
# Missions should almost always start with standard safety envelopes
insert Insert/StandardEnvelopes.tl
assign in sequence StandardEnvelopes:MinAltitude = MinAltitude
assign in sequence StandardEnvelopes:MaxDepth = MaxDepth
assign in sequence StandardEnvelopes:MinOffshore = MinOffshore
# Power the Backseat payload.
insert Insert/BackseatDriver.tl
insert Insert/PowerOnly.tl
insert Insert/TerminateMissionByMsg.tl
assign in sequence TerminateMissionByMsg:ListenToMsgTerminateMission = ListenToTerminateMissionMsg
insert id="Science" Insert/Science.tl {
redefineArg PeakDetectChlActive = PeakDetectChl
redefineArg PeakDepthAvgProfilesChlActive = SendPeakDepthAvgProfilesChl
redefineArg PeakDetectPlanktivoreLMavgROIActive = PeakDetectPlanktivoreLMavgROI
redefineArg PeakDepthAvgProfilesPlanktivoreLMavgROIActive = SendPeakDepthAvgProfilesPlanktivoreLMavgROI
redefineArg LowPassWindowLength = LowPassWindowLengthVertical
redefineArg FilterWidthHorizontal = NumProfilesAvgPeakDepth
redefineArg ShallowBound = YoYoMinDepth
redefineArg DeepBound = YoYoMaxDepth
redefineArg DeepThreshValidLeg = ValidLegDeepThresh
}
aggregate SendSignalOfPeakDepthChl {
run when (
( SendPeakDepthAvgProfilesChl
and (
not ( isNaN ( Science:PeakChlDepthAvgProfiles ) )
and (
( Science:PeakChlDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakChlDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
)
)
)
assign in sequence PeakDepthAvgOverProfiles = Science:PeakChlDepthAvgProfiles
aggregate PeakDepthSignalChl {
run in sequence
break if ( Science:PeakChlAvgProfiles < ThreshChl )
behavior Sensor:SendDirect {
run in sequence
set destType = "modem"
set destId = ModemIDDestination
set destName = "_.peakdepth"
set value = Science:PeakChlDepthAvgProfiles
set unit = "meter"
}
syslog info "Set _.peakdepth to " + Science:PeakChlDepthAvgProfiles~meter
}
aggregate PeakSignalChl {
run in sequence
behavior Sensor:SendDirect {
run in sequence
set destType = "modem"
set destId = ModemIDDestination
set destName = "_.peakChl"
set value = Science:PeakChlAvgProfiles
set unit = "microgram_per_liter"
}
syslog info "Set _.peakChl to " + Science:PeakChlAvgProfiles~microgram_per_liter
}
}
aggregate SendSignalOfPeakDepthPlanktivoreLMavgROI {
run when (
( SendPeakDepthAvgProfilesPlanktivoreLMavgROI
and (
not ( isNaN ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles ) )
and (
( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
)
)
)
assign in sequence PeakDepthAvgOverProfiles = Science:PeakPlanktivoreLMavgROIDepthAvgProfiles
aggregate PeakDepthSignalPlanktivoreLMavgROI {
run in sequence
break if (
Science:PeakPlanktivoreLMavgROIAvgProfiles >= ThreshPlanktivoreLMavgROI
)
behavior Sensor:SendDirect {
run in sequence
set destType = "modem"
set destId = ModemIDDestination
set destName = "_.peakdepth"
set value = Science:PeakPlanktivoreLMavgROIDepthAvgProfiles
set unit = "meter"
}
syslog info "Set _.peakdepth to " + Science:PeakPlanktivoreLMavgROIDepthAvgProfiles~meter
}
aggregate PeakSignalPlanktivoreLMavgROI {
run in sequence
behavior Sensor:SendDirect {
run in sequence
set destType = "modem"
set destId = ModemIDDestination
set destName = "_.peakPlanktivoreLM"
set value = Science:PeakPlanktivoreLMavgROIAvgProfiles
set unit = "count_per_second"
}
syslog info "Set _.peakPlanktivoreLM to "
+ Science:PeakPlanktivoreLMavgROIAvgProfiles~count_per_second
}
}
aggregate IncrementCounterHighSignal {
run when (
( SendPeakDepthAvgProfilesChl
and (
( Science:PeakChlDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakChlDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
not ( isNaN ( Science:PeakChlAvgProfiles ) )
and ( Science:PeakChlAvgProfiles >= ThreshChl )
)
)
or (
SendPeakDepthAvgProfilesPlanktivoreLMavgROI
and (
( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
not ( isNaN ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles ) )
and ( Science:PeakPlanktivoreLMavgROIAvgProfiles >= ThreshPlanktivoreLMavgROI )
)
)
)
assign in sequence CountsHighSignal = CountsHighSignal + 1 count
syslog info "CountsHighSignal = " + CountsHighSignal~count
}
aggregate ResetCounterHighSignal {
run when (
( CountsHighSignal >= 1 count )
and (
( SendPeakDepthAvgProfilesChl
and (
( Science:PeakChlDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakChlDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
isNaN ( Science:PeakChlAvgProfiles )
or ( Science:PeakChlAvgProfiles < ThreshChl )
)
)
or (
SendPeakDepthAvgProfilesPlanktivoreLMavgROI
and (
( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
isNaN ( Science:PeakPlanktivoreLMavgROIAvgProfiles )
or ( Science:PeakPlanktivoreLMavgROIAvgProfiles < ThreshPlanktivoreLMavgROI )
)
)
)
)
assign in sequence CountsHighSignal = 0 count
syslog info "CountsHighSignal = " + CountsHighSignal~count
}
aggregate IncrementCounterLowSignal {
run when (
( SendPeakDepthAvgProfilesChl
and (
( Science:PeakChlDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakChlDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
isNaN ( Science:PeakChlAvgProfiles )
or ( Science:PeakChlAvgProfiles < ThreshChl )
)
)
or (
SendPeakDepthAvgProfilesPlanktivoreLMavgROI
and (
( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
isNaN ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles )
or ( Science:PeakPlanktivoreLMavgROIAvgProfiles < ThreshPlanktivoreLMavgROI )
)
)
)
assign in sequence CountsLowSignal = CountsLowSignal + 1 count
syslog info "CountsLowSignal = " + CountsLowSignal~count
}
aggregate ResetCounterLowSignal {
run when (
( CountsLowSignal >= 1 count )
and (
( SendPeakDepthAvgProfilesChl
and (
( Science:PeakChlDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakChlDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
not ( isNaN ( Science:PeakChlAvgProfiles ) )
and ( Science:PeakChlAvgProfiles >= ThreshChl )
)
)
or (
SendPeakDepthAvgProfilesPlanktivoreLMavgROI
and (
( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles > PeakDepthAvgOverProfiles )
or ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles < PeakDepthAvgOverProfiles )
)
and (
not ( isNaN ( Science:PeakPlanktivoreLMavgROIDepthAvgProfiles ) )
and ( Science:PeakPlanktivoreLMavgROIAvgProfiles >= ThreshPlanktivoreLMavgROI )
)
)
)
)
assign in sequence CountsLowSignal = 0 count
syslog info "CountsLowSignal = " + CountsLowSignal~count
}
behavior Guidance:Pitch {
run in parallel
set massPosition = Control:VerticalControl.massDefault
}
behavior Guidance:DepthEnvelope {
run in parallel
set minDepth = YoYoMinDepth
set maxDepth = YoYoMaxDepth
set downPitch = YoYoDownPitch
set upPitch = YoYoUpPitch
}
behavior Guidance:AltitudeEnvelope {
"""
Another altitude envelope for the YoYo behavior. This envelope
should fall within the limits of the standard safety envelopes in
Insert/StandardEnvelopes.tl in order to avoid commanding high pitch
angles for bottom-terminated YoYos.
"""
run in parallel
set minAltitude = YoYoMinAltitude
}
aggregate SendTransitOrNotMessage {
run when ( called )
behavior Sensor:SendDirect {
run in sequence
set destType = "modem"
set destId = ModemIDDestination
set destName = "_.transitOrNot"
set value = InTransit
set unit = "bool"
}
syslog important "Set _.transitOrNot to " + InTransit~bool + "."
}
# Automatically restart logs
aggregate CycleLogs {
run in parallel
aggregate {
run in sequence
behavior Guidance:Wait {
run in sequence
set duration = IntervalRestartLogs
}
syslog important "Restarting logs."
behavior Guidance:Execute {
run in sequence
set command = "restart logs"
}
}
}
aggregate MissionStart {
run in sequence
call id="MissionStartComms" priorityHere=false refId="NeedComms"
}
aggregate Lap {
run in sequence repeat=MaxNumLaps
macro $i = 1..10 {
aggregate Wpt$i {
run in sequence
break if (
isNaN ( Lat[$i] )
or ( isNaN ( Lon[$i] ) )
or ( WaypointReached[$i] )
or (
InYoyoCircle
and ( CountsLowSignal < ThreshLowSignalCounts )
)
or (
InTransit
and ( CountsHighSignal >= ThreshHighSignalCounts )
)
)
assign in sequence InTransit = true
assign in sequence InYoyoCircle = false
syslog important "Transit."
behavior Guidance:Buoyancy {
run in parallel
set position = Control:VerticalControl.buoyancyNeutral
}
behavior Guidance:SetSpeed {
run in parallel
set speed = Speed
}
behavior Guidance:YoYo {
run in parallel
set downPitch = YoYoDownPitch
set upPitch = YoYoUpPitch
}
aggregate Transit {
run in sequence
behavior Guidance:Waypoint {
run in sequence
set latitude = Lat[$i]
set longitude = Lon[$i]
}
}
assign in sequence WaypointReached[$i] = true
}
}
aggregate YoyoCircleHotspot {
run in sequence
break if (
( InYoyoCircle
and ( CountsLowSignal >= ThreshLowSignalCounts )
)
or (
InTransit
and ( CountsHighSignal < ThreshHighSignalCounts )
)
)
assign in sequence InTransit = false
assign in sequence InYoyoCircle = true
syslog important "Yoyo-circle."
behavior Guidance:Buoyancy {
run in parallel
set position = Control:VerticalControl.buoyancyNeutral
}
behavior Guidance:SetSpeed {
run in parallel
set speed = Speed
}
behavior Guidance:YoYo {
run in parallel
set downPitch = YoYoDownPitch
set upPitch = YoYoUpPitch
}
behavior Guidance:Point {
run in parallel
set rudderAngle = RudderAngleYoyoCircle
}
behavior Guidance:Wait {
run in sequence
set duration = MissionTimeout
}
}
aggregate SendMsgTransitOrNot {
run when (
elapsed ( ElapsedSinceLastMsgTransitOrNot ) > MsgTransitOrNotPeriod
)
break if ( not ( SendMessageTransitOrNot ) )
call id="SendTransitOrNotMsg" priorityHere=false refId="SendTransitOrNotMessage"
assign in sequence ElapsedSinceLastMsgTransitOrNot = 0 hour
}
}
}
|