Homing pursuit.xml

Page auto-generated from XML file.

Failure

The generated TethysL source could not be parsed, likely due to source XML not being well-formed.

Below is the compile error at the TethysL level, as well as the source XML.

The TethysL file name shown below does not necessarily indicate the file exists, but hints about the actual corresponding .xml file.

Syntax error:
    --> lrauv-application/Missions/Engineering/Homing_pursuit.xml:189:5
     | 
 185 |     break if (
 186 |       Sensor:DAT.range < MinRange
 187 |     )
 188 | 
 189 |     timeout duration=ClosePursuitTimeout
     |     ^^^^^^^
 190 | 
 191 |     assign in parallel Sensor:DAT.onewayRequestedCmd = 1 bool
 192 | 
 193 |     readData strategy="MinError" {
     | 
Unexpected: `timeout`
Possible items include (total 13):
  aggregate
  assign
  behavior
  call
  [...5 more...]
  touch
  macro
  preemptive
  }
  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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
mission homing_pursuit {
  arguments {
    # Define mission arguments

    Speed = 1 meter_per_second

    MassDefault = Control:VerticalControl.massDefault

    BuoyancyNeutral = Control:VerticalControl.buoyancyNeutral

    MinRange = 4 meter
      """
      Minimum range to continue to update heading being driven.
      """

    OnewayRange = 65.0 meter
      """
      Minimum range to continue to update heading being driven. Max is 120
      meters due to maximum sample output from modem in oneway mode.
      """

    TimeoutDuration = 40 minute
      """
      Maximum length of mission
      """

    PowerOnDATTimeoutDuration = 1 minute
      """
      Wait this long after turning on DAT before starting any behaviors that
      require DAT output.
      """

    ClosePursuitTimeout = 180 second
      """
      Run in OneWayMode for this long.
      """

    RolloutTimeout = 3 minute
      """
      Drive on your last heading for this long after approaching within
      minimum range.
      """

    HomingDepth = 7 meter
      """
      Depth for homing.
      """

    MaxDepth = 45 meter
      """
      Maximum depth for the entire mission.
      """

    EnabledNeilBrown = customUri "Config/Science.CTD_NeilBrown_enable"
      """
      Set either this or PeakDetectChlActive to True in order to sample from
      the Neil Brown CTD.
      """
  }

  # TODO any other science sensors that should be active?

  # Begin the mission.

  timeout duration=TimeoutDuration

  # Safety nets and surfacing behaviors

  behavior Guidance:AltitudeEnvelope {
    run in parallel
    set Guidance:AltitudeEnvelope.minAltitude = 7 meter
  }

  behavior Guidance:DepthEnvelope {
    run in parallel
    set Guidance:DepthEnvelope.minDepth = 0 meter
    set Guidance:DepthEnvelope.maxDepth = MaxDepth
  }

  behavior Guidance:OffshoreEnvelope {
    run in parallel
    set Guidance:OffshoreEnvelope.minOffshore = 1.0 kilometer
  }

  insert Insert/Surface.tl id="SurfaceComms"


  # Set default mass and pump positions

  behavior Guidance:Pitch {
    run in parallel
    set Guidance:Pitch.massPosition = MassDefault
  }

  behavior Guidance:Buoyancy {
    run in parallel
    set Guidance:Buoyancy.position = BuoyancyNeutral
  }

  # Request desired engineering data

  readData strategy="MinError" {
    Universal:height_above_sea_floor
  }

  readData strategy="AllDevices" {
    Universal:platform_orientation
  }

  readData {
    Sensor:DAT.range
  }

  # Start actual engineering mission sequence.

  aggregate PowerOnDAT {
    """
    Give the DAT some time to start up before you ask for ranges from
    it.
    """

    run in sequence

    assign in parallel Sensor:DAT.onewayRequestedCmd = 0 bool

    behavior Guidance:Pitch {
      run in parallel
      set Guidance:Pitch.depth = HomingDepth
    }

    behavior Guidance:Wait {
      run in sequence
      set Guidance:Wait.duration = PowerOnDATTimeoutDuration
    }
  }

  aggregate InitialPursuit {
    """
    Move toward the target using normal two-way queries. (These will
    also provide the heading of the compass attached to the acoustic
    modem.) Update the commanded heading with
    *Universal:homing_target_azimuth* each cycle. Continue until you
    approach within *OnewayRange*, then move on to the next aggregate.
    """

    run in sequence

    break if (
      Sensor:DAT.range < OnewayRange
    )

    # <Timeout Duration="InitialPursuitTimeout"/>

    behavior Guidance:SetSpeed {
      run in parallel
      set Guidance:SetSpeed.speed = Speed
    }

    behavior Guidance:Pitch {
      run in parallel
      set Guidance:Pitch.depth = HomingDepth
    }

    aggregate HeadingPursuit {
      run while ( Sensor:DAT.range > MinRange )

      behavior Guidance:Point {
        run in parallel
        set Guidance:Point.heading = Sensor:DAT.azimuth_vehicleFrame
      }
    }
  }

  aggregate ClosePursuit {
    """
    Move toward the target using fast one-way queries. (These will *NOT*
    provide the heading of the compass attached to the acoustic modem.)
    Update the commanded heading with *Universal:homing_target_azimuth*
    each cycle. Continue until you approach within *MinRange*, then move
    on to the next aggregate.
    """

    run in sequence

    break if (
      Sensor:DAT.range < MinRange
    )

    timeout duration=ClosePursuitTimeout

    assign in parallel Sensor:DAT.onewayRequestedCmd = 1 bool

    readData strategy="MinError" {
      Sensor:SCPI.sampleSCPI
    }

    behavior Guidance:SetSpeed {
      run in parallel
      set Guidance:SetSpeed.speed = Speed
    }

    behavior Guidance:Pitch {
      run in parallel
      set Guidance:Pitch.depth = HomingDepth
    }

    aggregate HeadingOneWay {
      run while ( Sensor:DAT.range > MinRange )

      behavior Guidance:Point {
        run in parallel
        set Guidance:Point.heading = Sensor:DAT.azimuth_vehicleFrame
      }
    }
  }

  aggregate Rollout {
    """
    Move away from the target at the last commanded heading until
    *RolloutTimeout* has passed. (DAT should still be reporting. Target
    acoustic modem may still be in Oneway mode.)
    """

    run in sequence

    timeout duration=RolloutTimeout

    readData {
      Sensor:DAT.range
    }

    behavior Guidance:SetSpeed {
      run in parallel
      set Guidance:SetSpeed.speed = Speed
    }

    behavior Guidance:Pitch {
      run in parallel
      set Guidance:Pitch.depth = HomingDepth
    }
  }

  call id="PhoneHome" refId="SurfaceComms"
}
  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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?xml version="1.0" encoding="UTF-8"?>
<Mission xmlns="Tethys"
       xmlns:Control="Tethys/Control"
       xmlns:Guidance="Tethys/Guidance" 
       xmlns:Sensor="Tethys/Sensor"
       xmlns:Units="Tethys/Units"
       xmlns:Universal="Tethys/Universal"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="Tethys http://okeanids.mbari.org/tethys/Xml/Tethys.xsd
                           Tethys/Control http://okeanids.mbari.org/tethys/Xml/Control.xsd
                           Tethys/Guidance http://okeanids.mbari.org/tethys/Xml/Guidance.xsd
                           Tethys/Sensor http://okeanids.mbari.org/tethys/Xml/Sensor.xsd
                           Tethys/Units http://okeanids.mbari.org/tethys/Xml/Units.xsd
                           Tethys/Universal http://okeanids.mbari.org/tethys/Xml/Universal.xsd"
       Id="homing_pursuit">

<!-- Define mission arguments -->

    <DefineArg Name="Speed"><Units:meter_per_second/><Value>1</Value></DefineArg>

    <DefineArg Name="MassDefault"><Control:VerticalControl.massDefault/></DefineArg>

    <DefineArg Name="BuoyancyNeutral"><Control:VerticalControl.buoyancyNeutral/></DefineArg>

    <DefineArg Name="MinRange"><Description>
        Minimum range to continue to update heading being driven.
    </Description><Units:meter/><Value>4</Value></DefineArg>

    <DefineArg Name="OnewayRange"><Description>
        Minimum range to continue to update heading being driven. Max is 120
        meters due to maximum sample output from modem in oneway mode.
    </Description><Units:meter/><Value>65.0</Value></DefineArg>

    <DefineArg Name="TimeoutDuration"><Description>
        Maximum length of mission
    </Description><Units:minute/><Value>40</Value></DefineArg>

    <DefineArg Name="PowerOnDATTimeoutDuration"><Description>
        Wait this long after turning on DAT before starting any behaviors that
        require DAT output.
    </Description><Units:minute/><Value>1</Value></DefineArg>

    <DefineArg Name="ClosePursuitTimeout"><Description>
        Run in OneWayMode for this long.
    </Description><Units:second/><Value>180</Value></DefineArg>

    <DefineArg Name="RolloutTimeout"><Description>
        Drive on your last heading for this long after approaching within
        minimum range.
    </Description><Units:minute/><Value>3</Value></DefineArg>

    <DefineArg Name="HomingDepth"><Description>
        Depth for homing.
    </Description><Units:meter/><Value>7</Value></DefineArg>

    <DefineArg Name="MaxDepth"><Description>
        Maximum depth for the entire mission.
    </Description><Units:meter/><Value>45</Value></DefineArg>

    <DefineArg Name="EnabledNeilBrown"><Description>
        Set either this or PeakDetectChlActive to True in order to sample from
        the Neil Brown CTD.
    </Description><CustomUri Uri="Config/Science.CTD_NeilBrown_enable"/></DefineArg>

<!-- TODO any other science sensors that should be active? -->

<!-- Begin the mission. -->

    <Timeout Duration="TimeoutDuration"/>

<!-- Safety nets and surfacing behaviors -->

    <Guidance:AltitudeEnvelope>
        <Parallel/>
        <Setting><Guidance:AltitudeEnvelope.minAltitude/><Units:meter/><Value>7</Value></Setting>
    </Guidance:AltitudeEnvelope>

    <Guidance:DepthEnvelope>
        <Parallel/>
        <Setting><Guidance:DepthEnvelope.minDepth/><Units:meter/><Value>0</Value></Setting>
        <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="MaxDepth"/></Setting>
    </Guidance:DepthEnvelope>

    <Guidance:OffshoreEnvelope>
        <Parallel/>
        <Setting><Guidance:OffshoreEnvelope.minOffshore/><Units:kilometer/><Value>1.0</Value></Setting>
    </Guidance:OffshoreEnvelope>

    <Insert Filename="Insert/Surface.tl" Id="SurfaceComms" />

<!-- Set default mass and pump positions -->

    <Guidance:Pitch>
        <Parallel/>
        <Setting><Guidance:Pitch.massPosition/><Arg Name="MassDefault"/></Setting>
    </Guidance:Pitch>

    <Guidance:Buoyancy>
        <Parallel/>
        <Setting><Guidance:Buoyancy.position /><Arg Name="BuoyancyNeutral"/></Setting>
    </Guidance:Buoyancy>

<!-- Request desired engineering data -->

    <ReadData Strategy="MinError">
        <Universal:height_above_sea_floor/>
    </ReadData>

    <ReadData Strategy="AllDevices">
        <Universal:platform_orientation/>
    </ReadData>

    <ReadData>
        <Sensor:DAT.range/>
    </ReadData>

<!-- Start actual engineering mission sequence. -->

    <Aggregate Id="PowerOnDAT">

        <Description>
            Give the DAT some time to start up before you ask for ranges from
            it.
        </Description>

        <Sequence/>

        <Assign><Parallel/><Sensor:DAT.onewayRequestedCmd/><Units:bool/><Value>0</Value></Assign>

        <Guidance:Pitch>
            <Parallel/>
            <Setting><Guidance:Pitch.depth/><Arg Name="HomingDepth"/></Setting>
        </Guidance:Pitch>

        <Guidance:Wait>
            <Sequence/>
            <Setting><Guidance:Wait.duration /><Arg Name="PowerOnDATTimeoutDuration"/></Setting>
        </Guidance:Wait>

    </Aggregate>

    <Aggregate Id="InitialPursuit">

        <Description>
            Move toward the target using normal two-way queries. (These will
            also provide the heading of the compass attached to the acoustic
            modem.) Update the commanded heading with
            *Universal:homing_target_azimuth* each cycle. Continue until you
            approach within *OnewayRange*, then move on to the next aggregate.
        </Description>

        <Sequence/>

        <Break>
            <Sensor:DAT.range/>
            <Lt><Arg Name="OnewayRange"/></Lt>
        </Break>

<!-- <Timeout Duration="InitialPursuitTimeout"/>-->

        <Guidance:SetSpeed>
            <Parallel/>
            <Setting><Guidance:SetSpeed.speed/><Arg Name="Speed"/></Setting>
        </Guidance:SetSpeed>

        <Guidance:Pitch>
            <Parallel/>
            <Setting><Guidance:Pitch.depth/><Arg Name="HomingDepth"/></Setting>
        </Guidance:Pitch>

        <Aggregate Id="HeadingPursuit">

            <While>
                <Sensor:DAT.range/>
                <Gt><Arg Name="MinRange"/></Gt>
            </While>

            <Guidance:Point>
                <Parallel/>
                <Setting><Guidance:Point.heading /><Sensor:DAT.azimuth_vehicleFrame/></Setting>
            </Guidance:Point>

        </Aggregate>

    </Aggregate>

    <Aggregate Id="ClosePursuit">

        <Description>
            Move toward the target using fast one-way queries. (These will *NOT*
            provide the heading of the compass attached to the acoustic modem.)
            Update the commanded heading with *Universal:homing_target_azimuth*
            each cycle. Continue until you approach within *MinRange*, then move
            on to the next aggregate.
        </Description>

        <Sequence/>

        <Break>
            <Sensor:DAT.range/>
            <Lt><Arg Name="MinRange"/></Lt>
        </Break>

        <Timeout Duration="ClosePursuitTimeout"/>

        <Assign><Parallel/><Sensor:DAT.onewayRequestedCmd/><Units:bool/><Value>1</Value></Assign>

        <ReadData Strategy="MinError">
            <Sensor:SCPI.sampleSCPI/>
        </ReadData>

        <Guidance:SetSpeed>
            <Parallel/>
            <Setting><Guidance:SetSpeed.speed/><Arg Name="Speed"/></Setting>
        </Guidance:SetSpeed>

        <Guidance:Pitch>
            <Parallel/>
            <Setting><Guidance:Pitch.depth/><Arg Name="HomingDepth"/></Setting>
        </Guidance:Pitch>

        <Aggregate Id="HeadingOneWay">

            <While>
                <Sensor:DAT.range/>
                <Gt><Arg Name="MinRange"/></Gt>
            </While>

            <Guidance:Point>
                <Parallel/>
                <Setting><Guidance:Point.heading /><Sensor:DAT.azimuth_vehicleFrame/></Setting>
            </Guidance:Point>

        </Aggregate>

    </Aggregate>

    <Aggregate Id="Rollout">

        <Description>
            Move away from the target at the last commanded heading until
            *RolloutTimeout* has passed. (DAT should still be reporting. Target
            acoustic modem may still be in Oneway mode.)
        </Description>

        <Sequence/>

        <Timeout Duration="RolloutTimeout"/>

        <ReadData>
            <Sensor:DAT.range/>
        </ReadData>

        <Guidance:SetSpeed>
            <Parallel/>
            <Setting><Guidance:SetSpeed.speed/><Arg Name="Speed"/></Setting>
        </Guidance:SetSpeed>

        <Guidance:Pitch>
            <Parallel/>
            <Setting><Guidance:Pitch.depth/><Arg Name="HomingDepth"/></Setting>
        </Guidance:Pitch>

    </Aggregate>

    <Call Id="PhoneHome" RefId="SurfaceComms"/>

</Mission>