<?xml version="1.0" encoding="UTF-8"?>
<Mission xmlns="Tethys"
       xmlns:Control="Tethys/Control"
       xmlns:Guidance="Tethys/Guidance" 
       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/Units http://okeanids.mbari.org/tethys/Xml/Units.xsd
                           Tethys/Universal http://okeanids.mbari.org/tethys/Xml/Universal.xsd"
       Id="TestMission">

<!--
TEST_CODE_START
minDepth = 20         # mission's min depth
maxDepth = 25         # mission's max depth
depthDelta = 6        # infections can occur with delta of min/max depth
reachedDepth = False
data = slate.read("depth")[0]
for i in range(len(data)):
  depth = abs(float(data[i].data)) 
  if depth >= minDepth:
    reachedDepth = True
    passed = True
  if reachedDepth == True and \
     depth < minDepth - (depthDelta / 2) and \
     depth > maxDepth + (depthDelta / 2):
    print("%g < %g - (%g / 2) and %g > %g + (%g / 2)" % (depth, minDepth, depthDelta, depth, maxDepth, depthDelta) )
    passed = False
TEST_CODE_END
-->

    <DefineArg Name="NegativeDepth"><Units:meter/><Value>0</Value></DefineArg>

    <Timeout Duration="P1H"/>

    <Insert Filename="RegressionTests/InsertHighPriority.xml"/>

    <Insert Filename="RegressionTests/InsertSurfaceOps.xml"/>

    <Aggregate Id="TestAggregate">

        <Sequence/>

        <Timeout Duration="P30M30S"></Timeout>

        <Guidance:SetSpeed>
            <Parallel/>
            <Setting><Guidance:SetSpeed.speed/><Units:meter_per_second/><Value>1</Value></Setting>
        </Guidance:SetSpeed>

        <Guidance:Point>
            <Parallel/>
            <Setting><Guidance:Point.heading/><Units:degree/><Value>-135</Value></Setting>
        </Guidance:Point>

        <Assign><Parallel/><Arg Name="NegativeDepth"/><Universal:depth/><Mult><Units:none/><Value>-1</Value></Mult></Assign>

        <Guidance:DepthEnvelope>
            <Parallel/>
            <Setting><Guidance:DepthEnvelope.minDepth/><Units:meter/><Value>-20</Value></Setting>
            <Setting><Guidance:DepthEnvelope.maxDepth/><Units:meter/><Value>-25</Value></Setting>
            <Setting><Guidance:DepthEnvelope.depthSurrogate/><Arg Name="NegativeDepth"/></Setting>
        </Guidance:DepthEnvelope>

    </Aggregate>

</Mission>
