Skip to content

Engineering/ballast_and_trim_hi_gain.tl

  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
#   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 ballast_and_trim_hi_gain {
  arguments {
    # The following arguments are input arguments

    # Wpt1 d=74m

    ApproachDepth = 20.0 meter

    BallastDepth = 25.0 meter

    WpLat = 36.819 degree

    WpLon = -121.876 degree

    NeedCommsTime = 140 minute

    HoldDuration = 25 minute

    Speed = 1 meter_per_second

    DepthDeadband = 4.0 meter

    BuoyPeriod = 5.0 second

    BuoyancyDefault = Control:VerticalControl.buoyancyDefault
  }

  # The timeout

  timeout duration=P90M

  # And now the mission

  assign in parallel Control:VerticalControl.elevDeadband = 0.01 degree

  assign in parallel Control:VerticalControl.massDeadband = 0.01 millimeter

  assign in parallel Control:VerticalControl.maxDiveAccel = 0.001 meter_per_second_squared

  assign in parallel Control:VerticalControl.kpPitchMass = 0.1 ratio

  assign in parallel Control:VerticalControl.kiPitchMass = 0.0007 reciprocal_second

  assign in parallel Control:VerticalControl.kdPitchMass = 0.2 second

  assign in parallel Control:VerticalControl.kiDepthOff = 0.2 meter_per_second

  behavior Guidance:AltitudeEnvelope {
    run in parallel

    set minAltitude = 7 meter
  }

  behavior Guidance:DepthEnvelope {
    run in parallel

    set maxDepth = 52 meter
  }

  behavior Guidance:OffshoreEnvelope {
    run in parallel

    set minOffshore = 2.0 kilometer
    set maxOffshore = 30.0 kilometer
  }

  insert id="SurfaceComms" Insert/Surface.tl

  # GPS Update.  Don't go too long w/o a GPS fix.

  aggregate NeedComms {
    run when (
      elapsed ( Universal:time_fix ) > NeedCommsTime
      or ( elapsed ( Universal:time_fix ) > 65 minute )
    )

    call refId="SurfaceComms"
  }

  behavior Guidance:SetSpeed {
    run while (
      Universal:platform_propeller_rotation_rate == 0 radian_per_second
    )

    set period = BuoyPeriod
  }

  aggregate Waypoint {
    run in sequence

    behavior Guidance:Pitch {
      run in parallel

      set depth = ApproachDepth
    }

    behavior Guidance:SetSpeed {
      run in parallel

      set speed = Speed
    }

    behavior Guidance:Waypoint id="WaypointW1" {
      run in sequence

      set latitude = WpLat
      set longitude = WpLon
    }

    call id="PHONEHOMEWPT" refId="SurfaceComms"
  }

  # If we're executing here or below, lets' get science data!

  insert Insert/Science.tl

  aggregate ballast {
    run in sequence

    behavior Guidance:SetSpeed {
      run in parallel

      set speed = 0 meter_per_second
    }

    assign in parallel Control:VerticalControl.depthDeadband = DepthDeadband

    behavior Guidance:Pitch {
      run in parallel

      set depth = BallastDepth
    }

    behavior Guidance:Wait {
      run in sequence

      set duration = HoldDuration
    }

    aggregate ReportPositions {
      run in sequence repeat=5

      syslog important "Buoyancy:" + Universal:platform_buoyancy_position~cubic_centimeter

      syslog important "Mass:" + Universal:platform_mass_position~centimeter

      syslog important "Pitch:" + Universal:platform_pitch_angle~degree

      behavior Guidance:Wait {
        run in sequence

        timeout duration=P1M
      }
    }

    aggregate Float_Up {
      run in sequence

      break if ( Universal:depth < 1 meter )

      behavior Guidance:SetSpeed {
        run in parallel

        set speed = 0 meter_per_second
      }

      behavior Guidance:Buoyancy {
        run in parallel

        set position = BuoyancyDefault
      }

      behavior Guidance:Wait {
        run in sequence

        timeout duration=P15M
      }
    }

    call id="PHONEHOME_drift" refId="SurfaceComms"
  }
}