<?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
depthTarget = 20
depthDelta = 1
startSecs = 720
endSecs = 3500
reachedTarget = False
data = slate.read("depth")[0]
for i in range(len(data)):
  elapsed = data[i].getUnixTime() - data[0].getUnixTime()
  depth = float(data[i].data) 
  if( elapsed < startSecs or elapsed >= endSecs ):
    continue
  # we reached our required depth
  if (not utils.withinDelta(depth, depthTarget, depthDelta)):
    passed = False
    print("Failed due to | depth(%f) - depthTarget(%f) | > depthDelta(%f)" % (depth, depthTarget, depthDelta))
    break
  else:
    passed = True 
TEST_CODE_END
-->

    <Timeout Duration="P1H"/>

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

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

    <Aggregate Id="TestAggregate">

        <Sequence/>

        <Break>
            <Universal:depth/>
            <Gt><Units:meter/><Value>100</Value></Gt>
        </Break>

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

        <Guidance:PitchServo>
            <Parallel/>
            <Setting><Guidance:PitchServo.holdValue/><Units:meter/><Value>20</Value></Setting>
        </Guidance:PitchServo>

        <Guidance:Waypoint Id="Waypoint">
            <Sequence/>
            <Setting><Guidance:Waypoint.latitude/><Units:degree/><Value>36.74</Value></Setting>
            <Setting><Guidance:Waypoint.longitude/><Units:degree/><Value>-121.88</Value></Setting>
        </Guidance:Waypoint>

    </Aggregate>

</Mission>
