Skip to content

Engineering/tritoncam_run_backseat_on_surface_hockey_stop.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
#   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.

# SURFACE BENCH TEST for the adaptive backseat (strategy 2 = hockey_stop)

mission run_backseat_on_surface_hockey_stop {
  arguments {
    ElapsedSinceMissionStarted = 0 minute

    # --- Backseat mission-driven config ---
    # published to the slate as _.bs_* for the backseat to read once at startup
    PublishPeriod = 2 second
      """Re-publish period for the _.bs_* config below."""

    MinDepth = 10 meter
      """Absolute min of the frontseat-owned safety/search band. Published to the
         backseat as _.bs_min_depth_limit (cosmetic here — no diving on surface)."""

    MaxDepth = 60 meter
      """Absolute max of the frontseat-owned safety/search band. Published to the
         backseat as _.bs_max_depth_limit (cosmetic here — no diving on surface)."""

    Strategy = 2 count
      """Backseat strategy id (STRATEGY_IDS): 2=hockey_stop."""

    BsDetectionThreshold = 1 count
      """hockey_stop detection_threshold: cumulative counts to trigger a hockey-stop."""

    BsDetectionMaxGapSec = 30 second
      """hockey_stop detection_max_gap_sec: max quiet gap before the detection cluster resets."""

    BsPostDetectionPattern = 1 count
      """hockey_stop post_detection_pattern: 0=straight, 1=circle, 2=spiral."""

    BsLegTimeoutNoDetectionSec = 30 second
      """hockey_stop leg_timeout_no_detection_sec: exit the leg after this long with no detection."""

    BsSpiralGrowthMinutes = 5 count
      """hockey_stop spiral_growth_minutes (raw minutes): spiral rudder decay window."""

    BsMaxLegMinutes = 0 count
      """hockey_stop max_leg_minutes (raw minutes): hard cap on the leg; 0 = no cap."""
  }

  # Power the science payload.

  insert id="Science" Insert/Science.tl

  # Power the Backseat payload.

  insert Insert/BackseatDriver.tl

  assign in sequence BackseatDriver:EnableBackseat = true

  insert Insert/PowerOnly.tl

  # Run the backseat guidance so it processes on-surface.

  behavior Guidance:BackseatDriver {
    run in parallel
  }

  # --- Publish mission-driven config to the backseat (read once at startup) ---
  # Needs BackseatComponent. fullSlateAccess=1 on the frontseat.
  aggregate PublishBackseatParams {
    run when ( elapsed ( customUri "_.bs_strategy" ) > PublishPeriod )

    assign in sequence customUri "_.bs_strategy"                     = Strategy
    assign in sequence customUri "_.bs_min_depth_limit"              = MinDepth
    assign in sequence customUri "_.bs_max_depth_limit"              = MaxDepth
    assign in sequence customUri "_.bs_detection_threshold"          = BsDetectionThreshold
    assign in sequence customUri "_.bs_detection_max_gap_sec"        = BsDetectionMaxGapSec
    assign in sequence customUri "_.bs_post_detection_pattern"       = BsPostDetectionPattern
    assign in sequence customUri "_.bs_leg_timeout_no_detection_sec" = BsLegTimeoutNoDetectionSec
    assign in sequence customUri "_.bs_spiral_growth_minutes"        = BsSpiralGrowthMinutes
    assign in sequence customUri "_.bs_max_leg_minutes"              = BsMaxLegMinutes
  }

  behavior Guidance:GoToSurface {
    run in progression
  }

  aggregate CheckIn {
    run in sequence repeat=288

    readDatum id="Read_GPS" {
      timeout duration=P5M

      Universal:time_fix
    }

    readDatum id="Read_Iridium" {
      timeout duration=P2H {
        behavior Guidance:Execute {
          run in sequence

          set command = "Burn on"
        }

        syslog critical "Dropped weight due to communications timeout."
      }

      Universal:platform_communications
    }

    behavior Guidance:Wait {
      run in sequence

      set duration = 5 minute
    }

    assign in sequence ElapsedSinceMissionStarted = elapsed ( Universal:mission_started )

    syslog important "run_backseat_on_surface mission has been running for "
         + ElapsedSinceMissionStarted~minute
  }

  syslog important "Restarting logs and run_backseat_on_surface_hockey_stop mission."

  behavior Guidance:Execute {
    run in sequence

    set command = "restart logs"
  }
}