<?xml version="1.0" encoding="UTF-8"?>
<Mission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="Tethys"
         xmlns:Units="Tethys/Units"
         xmlns:Control="Tethys/Control"
         xmlns:Guidance="Tethys/Guidance"
         xmlns:Sample="Tethys/Sample"
         xmlns:Science="Tethys/Science"
         xmlns:Universal="Tethys/Universal"
         xsi:schemaLocation="Tethys http://okeanids.mbari.org/tethys/Xml/Tethys.xsd
                             Tethys/Units http://okeanids.mbari.org/tethys/Xml/Units.xsd
                             Tethys/Control http://okeanids.mbari.org/tethys/Xml/Control.xsd
                             Tethys/Sample http://okeanids.mbari.org/tethys/Xml/Sample.xsd
                             Tethys/Science http://okeanids.mbari.org/tethys/Xml/Science.xsd
                             Tethys/Universal http://okeanids.mbari.org/tethys/Xml/Universal.xsd
                             Tethys/Guidance http://okeanids.mbari.org/tethys/Xml/Guidance.xsd"
       Id="canon_esp_box">

    <Description>
        This mission cycles through the CANON BoxBow waypoints in the order: SE
        - NE - NW - SW - SE and sets the max depth for each leg. The mission can
        (re)start at any point within this trajectory by adjusting the `leg`
        parameter as needed.
    </Description>

<!-- Almost every mission should start with an overall timeout and a NeedCommsTime. -->

    <DefineArg Name="MissionTimeout"><Description>
        Maximum duration of mission
    </Description><Units:hour/><Value>14</Value></DefineArg>

    <DefineArg Name="NeedCommsTime"><Description>
        How often to surface for commumications
    </Description><Units:minute/><Value>120</Value></DefineArg>

<!-- You probably need to change these. -->

    <DefineArg Name="leg"><Description>
        Leg to start at (default is start at leg 1). leg 1: SE, 20m (to start
        position) leg 2: SE - E, 25m leg 3: E - E2, 100m leg 4: E2 - NE, 45m leg
        5: NE - N, 45m leg 6: N - NW, 65m leg 7: NW - W, 65m leg 8: W - W2, 100m
        leg 9: W2 - SW, 65m leg 10: SW - S, 50m leg 11: S - SE, 20m leg 12: SE -
        ?, 20m (spare wp)
    </Description><Units:count/><Value>1</Value></DefineArg>

    <DefineArg Name="SampleInterval"><Description>
        ESP sampling interval. Must be longer than the duration of a single ESP
        sample.
    </Description><Units:hour/><Value>4</Value></DefineArg>

    <DefineArg Name="CartridgeType"><Description>
        Specifies ESP cartridge type code (defaults to archive_bac: -6)
    </Description><Units:count/><Value>-6</Value></DefineArg>

    <DefineArg Name="StartWithASample"><Description>
        When true, the mission will acquire and ESP sample at the start of the
        mission. When false, the mission will wait for the SampleInterval before
        acquiring the first sample.
    </Description><True/></DefineArg>

    <DefineArg Name="Lat1"><Description>
        Latitude of waypoint 1 (default: SE).
    </Description><Units:degree/><Value>36.7755</Value></DefineArg>

    <DefineArg Name="Lon1"><Description>
        Longitude of waypoint 1 (default: SE).
    </Description><Units:degree/><Value>-121.825</Value></DefineArg>

    <DefineArg Name="Lat2"><Description>
        Latitude of waypoint 2 (default: E).
    </Description><Units:degree/><Value>36.7867</Value></DefineArg>

    <DefineArg Name="Lon2"><Description>
        Longitude of waypoint 2 (default: E).
    </Description><Units:degree/><Value>-121.829155</Value></DefineArg>

    <DefineArg Name="Lat3"><Description>
        Latitude of waypoint 3 (default: E2).
    </Description><Units:degree/><Value>36.794768</Value></DefineArg>

    <DefineArg Name="Lon3"><Description>
        Longitude of waypoint 3 (default: E2).
    </Description><Units:degree/><Value>-121.831951</Value></DefineArg>

    <DefineArg Name="Lat4"><Description>
        Latitude of waypoint 4 (default: NE).
    </Description><Units:degree/><Value>36.8315</Value></DefineArg>

    <DefineArg Name="Lon4"><Description>
        Longitude of waypoint 4 (default: NE).
    </Description><Units:degree/><Value>-121.8457</Value></DefineArg>

    <DefineArg Name="Lat5"><Description>
        Latitude of waypoint 5 (default: N).
    </Description><Units:degree/><Value>36.829608</Value></DefineArg>

    <DefineArg Name="Lon5"><Description>
        Longitude of waypoint 5 (default: N).
    </Description><Units:degree/><Value>-121.853778</Value></DefineArg>

    <DefineArg Name="Lat6"><Description>
        Latitude of waypoint 6 (default: NW).
    </Description><Units:degree/><Value>36.8219</Value></DefineArg>

    <DefineArg Name="Lon6"><Description>
        Longitude of waypoint 6 (default: NW).
    </Description><Units:degree/><Value>-121.8856</Value></DefineArg>

    <DefineArg Name="Lat7"><Description>
        Latitude of waypoint 7 (default: W).
    </Description><Units:degree/><Value>36.803838</Value></DefineArg>

    <DefineArg Name="Lon7"><Description>
        Longitude of waypoint 7 (default: W).
    </Description><Units:degree/><Value>-121.87895</Value></DefineArg>

    <DefineArg Name="Lat8"><Description>
        Latitude of waypoint 8 (default: W2).
    </Description><Units:degree/><Value>36.786706</Value></DefineArg>

    <DefineArg Name="Lon8"><Description>
        Longitude of waypoint 8 (default: W2).
    </Description><Units:degree/><Value>-121.872579</Value></DefineArg>

    <DefineArg Name="Lat9"><Description>
        Latitude of waypoint 9 (default: SW).
    </Description><Units:degree/><Value>36.766</Value></DefineArg>

    <DefineArg Name="Lon9"><Description>
        Longitude of waypoint 9 (default: SW).
    </Description><Units:degree/><Value>-121.8649</Value></DefineArg>

    <DefineArg Name="Lat10"><Description>
        Latitude of waypoint 10 (default: S).
    </Description><Units:degree/><Value>36.769648</Value></DefineArg>

    <DefineArg Name="Lon10"><Description>
        Longitude of waypoint 10 (default: S).
    </Description><Units:degree/><Value>-121.848834</Value></DefineArg>

    <DefineArg Name="Lat11"><Description>
        Latitude of waypoint 11 (default: SE).
    </Description><Units:degree/><Value>36.7755</Value></DefineArg>

    <DefineArg Name="Lon11"><Description>
        Longitude of waypoint 11 (default: SE).
    </Description><Units:degree/><Value>-121.825</Value></DefineArg>

    <DefineArg Name="Lat12"><Description>
        Latitude of waypoint 12 (spare).
    </Description><Units:degree/><Value>NaN</Value></DefineArg>

    <DefineArg Name="Lon12"><Description>
        Longitude of waypoint 12 (spare).
    </Description><Units:degree/><Value>NaN</Value></DefineArg>

    <DefineArg Name="Speed"><Description>
        Vehicle speed for the entire mission.
    </Description><Units:meter_per_second/><Value>1</Value></DefineArg>

    <DefineArg Name="YoYoMinDepth"><Description>
        Minimum YoYo depth for the entire mission.
    </Description><Units:meter/><Value>5</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth1"><Description>
        Maximum YoYo depth during leg 1.
    </Description><Units:meter/><Value>20</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth2"><Description>
        Maximum YoYo depth during leg 2.
    </Description><Units:meter/><Value>25</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth3"><Description>
        Maximum YoYo depth during leg 3.
    </Description><Units:meter/><Value>100</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth4"><Description>
        Maximum YoYo depth during leg 4.
    </Description><Units:meter/><Value>45</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth5"><Description>
        Maximum YoYo depth during leg 5.
    </Description><Units:meter/><Value>45</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth6"><Description>
        Maximum YoYo depth during leg 6.
    </Description><Units:meter/><Value>65</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth7"><Description>
        Maximum YoYo depth during leg 7.
    </Description><Units:meter/><Value>65</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth8"><Description>
        Maximum YoYo depth during leg 8.
    </Description><Units:meter/><Value>100</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth9"><Description>
        Maximum YoYo depth during leg 9.
    </Description><Units:meter/><Value>65</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth10"><Description>
        Maximum YoYo depth during leg 10.
    </Description><Units:meter/><Value>50</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth11"><Description>
        Maximum YoYo depth during leg 11.
    </Description><Units:meter/><Value>20</Value></DefineArg>

    <DefineArg Name="YoYoMaxDepth12"><Description>
        Maximum YoYo depth during leg 12.
    </Description><Units:meter/><Value>20</Value></DefineArg>

    <DefineArg Name="YoYoMinAltitude"><Description>
        Minimum altitude while performing the YoYo behavior (for
        bottom-terminated YoYos).
    </Description><Units:meter/><Value>9</Value></DefineArg>

    <DefineArg Name="YoYoUpPitch"><Description>
        Vehicle up pitch while performing the YoYo behavior.
    </Description><Units:degree/><Value>20</Value></DefineArg>

    <DefineArg Name="YoYoDownPitch"><Description>
        Vehicle down pitch while performing the YoYo behavior.
    </Description><Units:degree/><Value>-20</Value></DefineArg>

<!-- You are even less likely to need to change these. -->

    <DefineArg Name="CaptureRadius"><Description>
        Waypoint capture radiues.
    </Description><Units:meter/><Value>NaN</Value></DefineArg>

    <DefineArg Name="BuoyancyNeutral"><Description>
        Buoyancy bladder position while performing the YoYo behavior. Defaults
        to buoyancyNeutral setting in the Config/Control.cfg file. Set to NaN cc
        for active buoyancy
    </Description><Control:VerticalControl.buoyancyNeutral/></DefineArg>

    <DefineArg Name="MassDefault"><Description>
        Static setting for mass during the mission. Set to NaN mm for active
        mass position
    </Description><Control:VerticalControl.massDefault/></DefineArg>

    <DefineArg Name="MinAltitude"><Description>
        Minimum height above the sea floor for the entire mission.
    </Description><Units:meter/><Value>5</Value></DefineArg>

    <DefineArg Name="MaxDepth"><Description>
        Maximum depth for the entire mission.
    </Description><Units:meter/><Value>110</Value></DefineArg>

    <DefineArg Name="MinOffshore"><Description>
        Minimum offshore distance for the entire mission.
    </Description><Units:kilometer/><Value>2</Value></DefineArg>

    <DefineOutput Name="ElapsedSinceLastSample"><Description>
        Mission variable (don't change). The mission sets this variable to reset
        the ESP sample timer.
    </Description><Units:minute/><Value>0</Value></DefineOutput>

    <DefineOutput Name="ElapsedTime"><Description>
        Mission variable (don't change). The mission sets this variable to reset
        the ESP sample timer.
    </Description><Units:hour/><Value>0</Value></DefineOutput>

    <DefineOutput Name="FirstSample"><Description>
        Mission variable (don't change). The mission sets this variable to
        trigger the first ESP sample.
    </Description><False/></DefineOutput>

<!-- Missions should almost always start with a timeout -->

    <Timeout Duration="MissionTimeout"/>

    <Insert Filename="Insert/Science.xml">
        <Description>
            Most missions will run the science sensors. If you don't place this
            aggregate above NeedComms, science instruments get turned off on the
            last upcast and while floating on the surface.
        </Description>
    </Insert>

<!-- Most missions should use the NeedComms aggregate. -->

    <Insert Filename="Insert/NeedComms.xml" Id="NeedComms"/>

    <Assign><Sequence/><Arg Name="NeedComms:DiveInterval"/><Arg Name="NeedCommsTime"/></Assign>

<!-- Missions should almost always start with standard safety envelopes;
                  most missions should not expose the parameters of these envelopes.
    -->

    <Insert Filename="Insert/StandardEnvelopes.xml"/>

    <Assign><Sequence/><Arg Name="StandardEnvelopes:MinAltitude"/><Arg Name="MinAltitude"/></Assign>

    <Assign><Sequence/><Arg Name="StandardEnvelopes:MaxDepth"/><Arg Name="MaxDepth"/></Assign>

    <Assign><Sequence/><Arg Name="StandardEnvelopes:MinOffshore"/><Arg Name="MinOffshore"/></Assign>

    <Assign><Sequence/><Arg Name="StandardEnvelopes:MaxDepth"/><Arg Name="MaxDepth"/></Assign>

    <Assign><Sequence/><Arg Name="StandardEnvelopes:MinOffshore"/><Arg Name="MinOffshore"/></Assign>

<!-- Automatically cycle logs every 24 hours -->

    <Aggregate Id="CycleLogs">

        <Parallel/>

        <Aggregate>

            <Sequence/>

            <Guidance:Wait>
                <Sequence/>
                <Setting><Guidance:Wait.duration/><Units:hour/><Value>24</Value></Setting>
            </Guidance:Wait>

            <Syslog Severity="Important">Restarting logs.</Syslog>

            <Guidance:Execute>
                <Sequence/>
                <Setting><Guidance:Execute.command/><String>restart logs</String></Setting>
            </Guidance:Execute>

        </Aggregate>

    </Aggregate>

<!-- Acquire ESP sample every SampleInterval -->

    <Aggregate Id="SampleTimer">

        <While>
            <Arg Name="FirstSample"/>
            <Or><Elapsed><Arg Name="ElapsedSinceLastSample"/></Elapsed><Gt><Arg Name="SampleInterval"/></Gt></Or>
        </While>

        <Aggregate Id="SampleESP">

            <Sequence/>

            <Assign><Sequence/><Arg Name="ElapsedTime"/><Elapsed><Arg Name="ElapsedSinceLastSample"/></Elapsed></Assign>

            <Syslog Severity="Important">Pre-sample comms. Elapsed time since last ESP sample: <Arg Name="ElapsedTime"/><Units:hour/></Syslog>

            <Call Id="PreSampleComms" RefId="NeedComms"/>

            <Aggregate Id="WaitForDepth">

                <Sequence/>

                <Break>
                    <Universal:depth/>
                    <Ge><Arg Name="YoYoMinDepth"/></Ge>
                </Break>

                <Syslog Severity="Info">Waiting to achieve min depth of <Arg Name="YoYoMinDepth"/><Units:meter/></Syslog>

                <Guidance:Wait>
                    <Sequence/>
                    <Setting><Guidance:Wait.duration/><Units:minute/><Value>30</Value></Setting>
                </Guidance:Wait>

            </Aggregate>

            <Aggregate Id="SampleESP">

                <Sequence/>

                <Sample:AbortSample>
                    <Parallel/>
                </Sample:AbortSample>

                <Syslog Severity="Important">Sampling ESP cartridge type <Arg Name="CartridgeType"/><Units:count/></Syslog>

                <Science:ESPCartridgeSelect>
                    <Sequence/>
                    <Timeout Duration="P1M"/>
                    <Setting><Science:ESPCartridgeSelect.cartridgeType/><Arg Name="CartridgeType"/></Setting>
                </Science:ESPCartridgeSelect>

                <ReadDatum Id="TriggerESP">
                    <Science:ESPComponent.sampling/>
                </ReadDatum>

                <ReadDatum Id="WaitForESP">
                    <Science:ESPComponent.sample_number/>
                </ReadDatum>

            </Aggregate>

            <Call Id="PostSampleComms" RefId="NeedComms"/>

<!-- This assignment restarts the sample timer -->

            <Assign><Sequence/><Arg Name="ElapsedSinceLastSample"/><Value>0</Value></Assign>

            <Assign><Sequence/><Arg Name="FirstSample"/><False/></Assign>

        </Aggregate>

    </Aggregate>

    <Call Id="StartingMission" RefId="NeedComms"/>

<!-- Many missions will keep mass position and buoyancy volume fixed at defaults. -->

    <Guidance:Pitch>
        <Parallel/>
        <Setting><Guidance:Pitch.massPosition/><Arg Name="MassDefault"/></Setting>
    </Guidance:Pitch>

    <Guidance:Buoyancy>
        <Parallel/>
        <Setting><Guidance:Buoyancy.position/><Arg Name="BuoyancyNeutral"/></Setting>
    </Guidance:Buoyancy>

    <Guidance:SetSpeed>
        <Parallel/>
        <Setting><Guidance:SetSpeed.speed/><Arg Name="Speed"/></Setting>
    </Guidance:SetSpeed>

    <Guidance:DepthEnvelope>
        <Description>
            Another depth envelope for the YoYo behavior. This envelope should
            fall within the limits of the standard safety envelopes in
            Insert/StandardEnvelopes.xml in order to avoid commanding high pitch
            angles for depth-terminated YoYos.
        </Description>
        <Parallel/>
        <Setting><Guidance:DepthEnvelope.minDepth/><Arg Name="YoYoMinDepth"/></Setting>
        <Setting><Guidance:DepthEnvelope.downPitch/><Arg Name="YoYoDownPitch"/></Setting>
        <Setting><Guidance:DepthEnvelope.upPitch/><Arg Name="YoYoUpPitch"/></Setting>
    </Guidance:DepthEnvelope>

    <Guidance:AltitudeEnvelope>
        <Description>
            Another altitude envelope for the YoYo behavior. This envelope
            should fall within the limits of the standard safety envelopes in
            Insert/StandardEnvelopes.xml in order to avoid commanding high pitch
            angles for bottom-terminated YoYos.
        </Description>
        <Parallel/>
        <Setting><Guidance:AltitudeEnvelope.minAltitude/><Arg Name="YoYoMinAltitude"/></Setting>
        <Setting><Guidance:AltitudeEnvelope.upPitch/><Arg Name="YoYoUpPitch"/></Setting>
    </Guidance:AltitudeEnvelope>

    <Guidance:YoYo>
        <Parallel/>
        <Setting><Guidance:YoYo.downPitch/><Arg Name="YoYoDownPitch"/></Setting>
        <Setting><Guidance:YoYo.upPitch/><Arg Name="YoYoUpPitch"/></Setting>
    </Guidance:YoYo>

    <Aggregate Id="SetWaypointsPerLegParameter">

        <Description>
            The following Leg2-5 aggregates adjust the Lat[] and Lon[] variables
            according to the `trajectory` parameter:
        </Description>

        <Sequence/>

        <Aggregate Id="Leg2">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>1</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat1"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon1"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg3">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>2</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat2"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon2"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg4">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>3</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat3"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon3"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg5">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>4</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat4"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon4"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg6">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>5</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat5"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon5"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg7">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>6</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat6"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon6"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg8">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>7</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat7"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon7"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg9">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>8</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat8"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon8"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg10">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>9</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat9"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon9"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

        <Aggregate Id="Leg11">

            <Sequence/>

            <Break><Arg Name="leg"/>
                <Le><Units:count/><Value>10</Value></Le>
            </Break>

            <Assign><Sequence/><Arg Name="Lat10"/><Units:degree/><Value>NaN</Value></Assign>

            <Assign><Sequence/><Arg Name="Lon10"/><Units:degree/><Value>NaN</Value></Assign>

        </Aggregate>

    </Aggregate>

    <Aggregate Id="Lap">

        <Sequence/>

        <Syslog Severity="Important">Starting Lap</Syslog>

        <Syslog Severity="Important">Lat[1] = <Arg Name="Lat1"/><Units:degree/> Lon[1] = <Arg Name="Lon1"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[2] = <Arg Name="Lat2"/><Units:degree/> Lon[2] = <Arg Name="Lon2"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[3] = <Arg Name="Lat3"/><Units:degree/> Lon[3] = <Arg Name="Lon3"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[4] = <Arg Name="Lat4"/><Units:degree/> Lon[4] = <Arg Name="Lon4"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[5] = <Arg Name="Lat5"/><Units:degree/> Lon[5] = <Arg Name="Lon5"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[6] = <Arg Name="Lat6"/><Units:degree/> Lon[6] = <Arg Name="Lon6"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[7] = <Arg Name="Lat7"/><Units:degree/> Lon[7] = <Arg Name="Lon7"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[8] = <Arg Name="Lat8"/><Units:degree/> Lon[8] = <Arg Name="Lon8"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[9] = <Arg Name="Lat9"/><Units:degree/> Lon[9] = <Arg Name="Lon9"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[10] = <Arg Name="Lat10"/><Units:degree/> Lon[10] = <Arg Name="Lon10"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[11] = <Arg Name="Lat11"/><Units:degree/> Lon[11] = <Arg Name="Lon11"/><Units:degree/></Syslog>

        <Syslog Severity="Important">Lat[12] = <Arg Name="Lat12"/><Units:degree/> Lon[12] = <Arg Name="Lon12"/><Units:degree/></Syslog>

        <Aggregate Id="SampleOnStart">

            <Sequence/>

            <Break>
                <Not><Arg Name="StartWithASample"/></Not>
            </Break>

<!-- Kick off the first ESP sample. -->

            <Assign><Sequence/><Arg Name="FirstSample"/><True/></Assign>

        </Aggregate>

<!-- The following aggregates dispatch the waypoints behaviors -->

        <Aggregate Id="Wpt1">

            <Sequence/>

            <Syslog Severity="Important">Navigating to box start WP. YoYoMaxDepth:<Arg Name="YoYoMaxDepth1"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth1"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat1"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon1"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt2">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP2. YoYoMaxDepth: <Arg Name="YoYoMaxDepth2"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth2"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat2"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon2"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt3">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP3. YoYoMaxDepth: <Arg Name="YoYoMaxDepth3"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth3"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat3"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon3"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt4">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP4. YoYoMaxDepth: <Arg Name="YoYoMaxDepth4"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth4"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat4"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon4"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt5">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP5. YoYoMaxDepth:<Arg Name="YoYoMaxDepth5"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth5"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat5"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon5"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt6">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP6. YoYoMaxDepth:<Arg Name="YoYoMaxDepth6"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth6"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat6"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon6"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt7">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP7. YoYoMaxDepth: <Arg Name="YoYoMaxDepth7"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth7"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat7"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon7"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt8">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP8. YoYoMaxDepth: <Arg Name="YoYoMaxDepth8"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth8"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat8"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon8"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt9">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP9. YoYoMaxDepth: <Arg Name="YoYoMaxDepth9"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth9"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat9"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon9"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt10">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP10. YoYoMaxDepth: <Arg Name="YoYoMaxDepth10"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth10"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat10"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon10"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt11">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP11. YoYoMaxDepth: <Arg Name="YoYoMaxDepth11"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth11"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat11"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon11"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

        <Aggregate Id="Wpt12">

            <Sequence/>

            <Syslog Severity="Important">Navigating to WP12. YoYoMaxDepth: <Arg Name="YoYoMaxDepth12"/><Units:meter/></Syslog>

            <Guidance:DepthEnvelope>
                <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="YoYoMaxDepth12"/></Setting>
            </Guidance:DepthEnvelope>

            <Guidance:Waypoint>
                <Sequence/>
                <Setting><Guidance:Waypoint.latitude/><Arg Name="Lat12"/></Setting>
                <Setting><Guidance:Waypoint.longitude/><Arg Name="Lon12"/></Setting>
            </Guidance:Waypoint>

        </Aggregate>

    </Aggregate>

</Mission>
