Skip to content

Insert/Optim.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
#   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.

# Power lights and camera when recording enabled
aggregate Optim {
  arguments {
    RunOptim = false
      """
      Run Optim camera and Multiray lights if true
      """

    LightMode = 2 count
      """
      Mode for MultiRay lights at depth. 0 is off, 1 is red, 2 is white
      """

    BrightnessWhite = 100 none_int
      """
      White MultiRay LED brightness, 0-100
      """

    BrightnessRed = 100 none_int
      """
      Red MultiRay LED brightness, 0-100
      """

    BackseatWait = 30 second
      """
      How long to wait for the backseat to power up before attempting to power the Optim
      """

    InitialSampleTime = 1 second
      """
      PowerOnly sample time for initial record. Will go back to continuous after startup.
      """
  }

  output {
    RecordingEnabled = false
      """
      Mission variable (don't change). Reflects intended recording state.
      """

    LightsEnabled = false
      """
      Mission variable (dont' chage). Reflects intended light state.
      """
  }

  run in parallel

  break if ( not RunOptim )

  readData strategy="MinError" {
    while ( RecordingEnabled )

    Sensor:PowerOnly.sampleLoad1
  }

  readData strategy="MinError" {
    while ( LightsEnabled )

    Sensor:MultiRay.lightModeLog
  }

  aggregate OptimStartup {
    run in sequence

    syslog info "Waiting " + BackseatWait~s + " for backseat to start up..."

    behavior Guidance:Wait {
      run in sequence

      set duration = BackseatWait
    }

    # Power-cycle Optim with some rather specific timing requirements to start up
    aggregate UseMission {
      run in sequence

      assign in parallel Sensor:PowerOnly.sampleTime1 = InitialSampleTime

      assign in sequence RecordingEnabled = true

      syslog info "Disabling Optim recording after " + InitialSampleTime~s
      assign in sequence RecordingEnabled = false

      behavior Guidance:Wait {
        run in sequence

        set duration = InitialSampleTime
      }

      assign in sequence RecordingEnabled = true
      syslog info "Powering up Optim to try to tide over gap to handoff..."
    }

    assign in sequence RecordingEnabled = true
    assign in sequence LightsEnabled = true
    assign in sequence Sensor:MultiRay.lightModeCommand = LightMode

    syslog important "Enabling backseat, camera, and multiray"

    aggregate setRed {
      run in sequence

      break if ( LightMode != 1 count )

      assign in sequence Sensor:MultiRay.brightnessRed = BrightnessRed
      syslog info "Setting multiray red brightness to" + BrightnessRed~count
    }

    aggregate setWhite {
      run in sequence

      break if ( LightMode != 2 count )

      assign in sequence Sensor:MultiRay.brightnessWhite = BrightnessWhite
      syslog info "Setting muliray white brightness to" + BrightnessWhite~count
    }
  }

  behavior Guidance:Wait {
    run in sequence

    set duration = 9999 hour
  }
}