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

<!--
TEST_CODE_START
depthTarget = 50
depthDeltaExit = 1 

reachedDepth = False
data = slate.read("depth")[0]
for i in range(len(data)):
  depth = abs(float(data[i].data)) 
  # simpy test to see if the pitch
  # angle makes us reach the right depth
  if reachedDepth == False and depth >= depthTarget:
    reachedDepth = True
    passed = True

  # do we quit somewhere near our depthTarget?
  # if not, then we have a problem
  if reachedDepth == True and (not utils.withinDelta(depth, depthTarget, depthDeltaExit)):
    passed = False
TEST_CODE_END
-->

    <Timeout Duration="P1H"/>

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

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

    <Stack Id="TestStack">

        <Until><Universal:depth/>
            <Gt/><Units:meter/><Value>50</Value>
        </Until>

        <Guidance:SetSpeed RunIn="Parallel">
            <Set><Guidance:SetSpeed.speed/><Units:meter_per_second/><Value>1</Value></Set>
        </Guidance:SetSpeed>

        <Guidance:Pitch RunIn="Parallel">
            <Set><Guidance:Pitch.pitch/><Units:degree/><Value>-26</Value></Set>
        </Guidance:Pitch>

        <Guidance:Waypoint Id="Waypoint" RunIn="Sequence">
            <Set><Guidance:Waypoint.latitude/><Units:degree/><Value>36.815</Value></Set>
            <Set><Guidance:Waypoint.longitude/><Units:degree/><Value>-121.95</Value></Set>
        </Guidance:Waypoint>

    </Stack>

</Stack>
