Skip to content

Maintenance/tracking_and_acomms_test.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
#   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 trackingAndAcomms {
  """
  This mission tests sending acomms data if selected while also acoustically tracking an asset.
  DO NOT use at sea unless you know exactly what you're doing.
  """

  arguments {
    # Mission-wide settings

    MissionTimeout = 1 hour
      """
      Maximum duration of mission
      """

    NeedCommsTime = 45 minute
      """
      Elapsed time after previous surface communications when vehicle will
      begin to ascend for additional surface communications
      """

    # You probably need to change these.

    SendVehicleData = false
      """
      Whether to send data or just leave it at tracking.
      """

    ContactDepth = NaN meter
      """
      The asset's depth to be tracked
      """

    AcousticContactTimeout = 4 hour
      """
      If the vehicle does not receive an acoustic signal for more than this
      length of time, it will surface for communications with shore.
      """

    SendObsUpdatePeriod = 90 second
      """
      Time to wait after an a-comms data has been sent before sending new data.
      """

    #  You probably do not need to change these.


    NumberOfPings = 1 count
      """
      Number of return pings to request with each acoustic query (more than 1
      will activate oneway mode)
      """

    TrackingUpdatePeriod = 30 second
      """
      Internal variable to set how long to wait between updating internal tracking variables
      """

    ContactLabel = 3 count
      """
      This acoustic address of the asset to be tracked.
      """

    SendDataLabel = 3 count
      """
      The acoustic address of the asset to send data. Can be the same as the tracked asset.
      """
  }

  timeout duration=MissionTimeout

  insert Insert/AbortDrift.tl {
    redefineArg AcousticTimeout = AcousticContactTimeout
  }

  behavior Estimation:TrackAcousticContact {
    run in parallel

    set contactDepthSetting = ContactDepth
    set contactLabelSetting = ContactLabel
    set numberOfSamplesSetting = NumberOfPings
    set updatePeriodSetting = TrackingUpdatePeriod
  }

  insert id="NeedComms" Insert/NeedComms.tl

  assign in sequence NeedComms:DiveInterval = NeedCommsTime

  aggregate sendAcomms {
    run when ( SendVehicleData )

    syslog important "Sending temp:" + Sensor:Onboard.Temperature~celsius

    behavior Sensor:SendDirect {
      run in sequence

      set destType = "modem"
      set destId = SendDataLabel
      set destName = "_.temperature"
      set value = Sensor:Onboard.Temperature
      set unit = "celsius"
    }

    syslog important "Sending humidity:" + Sensor:Onboard.Humidity~percent

    behavior Sensor:SendDirect {
      run in sequence

      set destType = "modem"
      set destId = SendDataLabel
      set destName = "_.humidity"
      set value = Sensor:Onboard.Humidity
      set unit = "percent"
    }

    behavior Guidance:Wait {
      run in sequence

      set duration = SendObsUpdatePeriod
    }
  }

  behavior Guidance:Wait {
    run in sequence

    set duration = MissionTimeout
  }
}