<?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://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">

    <Timeout Duration="P5H"/>

<!-- some high priority behaviors -->

    <Guidance:AltitudeEnvelope RunIn="Parallel">
        <Setting><Guidance:AltitudeEnvelope.minAltitude/><Units:meter/><Value>20</Value></Setting>
    </Guidance:AltitudeEnvelope>

    <Guidance:OffshoreEnvelope RunIn="Parallel">
        <Setting><Guidance:OffshoreEnvelope.minOffshore/><Units:kilometer/><Value>1</Value></Setting>
        <Setting><Guidance:OffshoreEnvelope.maxOffshore/><Units:kilometer/><Value>50</Value></Setting>
    </Guidance:OffshoreEnvelope>

    <Guidance:DepthEnvelope RunIn="Parallel">
        <Setting><Guidance:DepthEnvelope.minDepth/><Units:meter/><Value>0</Value></Setting>
        <Setting><Guidance:DepthEnvelope.maxDepth/><Units:meter/><Value>300</Value></Setting>
    </Guidance:DepthEnvelope>

<!-- Initial GPS (and Iridium) Update -->

    <Aggregate Id="SurfaceOps" >

        <Guidance:GoToSurface RunIn="Parallel"/>

        <Guidance:GoToSurface RunIn="Sequence"/>

        <ReadDatum><Universal:latitude_fix/>
        </ReadDatum>

    </Aggregate>

    <Aggregate Id="NeedSatFix">

        <When>
            <Elapsed><Universal:time_fix/></Elapsed>
            <Gt/><Units:minute/><Value>10</Value>
        </When>

        <Guidance:GoToSurface RunIn="Parallel"/>

        <Guidance:GoToSurface RunIn="Sequence"/>

        <Aggregate Id="SurfOps">

            <Preemptive><True/></Preemptive>

            <ReadDatum><Universal:latitude_fix/>
            </ReadDatum>

        </Aggregate>

    </Aggregate>

    <Aggregate Id="TestAggregate">

        <Guidance:KeepStation RunIn="Parallel">
            <Setting><Guidance:KeepStation.longitude/><Units:degree/><Value>-121.89</Value></Setting>
            <Setting><Guidance:KeepStation.radius/><Units:meter/><Value>500</Value></Setting>
        </Guidance:KeepStation>

        <Guidance:DepthEnvelope RunIn="Parallel">
            <Setting><Guidance:DepthEnvelope.minDepth/><Units:meter/><Value>15</Value></Setting>
            <Setting><Guidance:DepthEnvelope.maxDepth/><Units:meter/><Value>15</Value></Setting>
        </Guidance:DepthEnvelope>

        <Guidance:Wait RunIn="Sequence">
            <Setting><Guidance:Wait.duration/><Units:minute/><Value>120</Value></Setting>
        </Guidance:Wait>

    </Aggregate>

</Mission>
