<?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="WaypointReplacementDemo">

<!-- some high priority behaviors -->

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

    <Guidance:OffshoreEnvelope>
        <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>
        <Parallel/>
        <Setting><Guidance:DepthEnvelope.minDepth/><Units:meter/><Value>5</Value></Setting>
        <Setting><Guidance:DepthEnvelope.maxDepth/><Units:meter/><Value>300</Value></Setting>
    </Guidance:DepthEnvelope>

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

    <Aggregate Id="SurfaceOps">

        <Sequence/>

        <Guidance:GoToSurface>
            <Progression/>
        </Guidance:GoToSurface>

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

    </Aggregate>

    <Aggregate Id="WaypointReplacement">

        <Sequence/>

        <Insert Id="InsertWaypointReplacement" Filename="BehaviorScripts/WaypointReplacement.xml"/>

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

        <Guidance:YoYo>
            <Parallel/>
        </Guidance:YoYo>

        <Guidance:Waypoint>
            <Sequence/>
            <Setting><Guidance:Waypoint.longitude/><Units:degree/><Value>-121.85</Value></Setting>
        </Guidance:Waypoint>

    </Aggregate>

    <Aggregate Id="WaypointNormal">

        <Sequence/>

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

        <Guidance:YoYo>
            <Parallel/>
        </Guidance:YoYo>

        <Guidance:Waypoint>
            <Sequence/>
            <Setting><Guidance:Waypoint.latitude/><Units:degree/><Value>36.82</Value></Setting>
        </Guidance:Waypoint>

    </Aggregate>

</Mission>
