Skip to content

Engineering/lab_test_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
#   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 lab_test_optim {
  arguments {
    MissionTimeout = 15 minute
      """
      Backseat will stay on for this duration, independent of Optim state
      """

    RecordTime = 1 minute
      """
      How long to record after startup sequence (hopefully) turns on Optim camera
      """

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

    LightMode = 2 count
      """
      Mode for Multiray lights. 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
      """
  }

  output {
    RecordingEnabled = false

    LightsEnabled = false
  }

  timeout duration=MissionTimeout

  insert Insert/BackseatDriver.tl
  assign in parallel BackseatDriver:EnableBackseat = true

  readData strategy="MinError" {
    while ( RecordingEnabled )

    Sensor:PowerOnly.sampleLoad1
  }

  readData strategy="MinError" {
    while ( LightsEnabled )

    Sensor:MultiRay.lightModeLog
  }

  aggregate Startup {
    run in sequence

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

    behavior Guidance:Wait {
      run in sequence

      set duration = BackseatWait
    }
  }

  aggregate Run {
    run in sequence

    syslog important "Trying to run Optim and Multiray forreal"

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

    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
    }

    syslog important "Recording for " + RecordTime~min

    behavior Guidance:Wait {
      run in sequence

      set duration = RecordTime
    }
  }

  behavior Guidance:Wait {
    run in sequence

    set duration = MissionTimeout
  }
}