<?xml version="1.0" encoding="UTF-8"?>
<Aggregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns="Tethys"
           xmlns:Units="Tethys/Units"
           xmlns:Control="Tethys/Control"
           xmlns:BIT="Tethys/BIT"
           xmlns:Estimation="Tethys/Estimation"
           xmlns:Guidance="Tethys/Guidance"
           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/BIT http://okeanids.mbari.org/tethys/Xml/BIT.xsd
                               Tethys/Estimation http://okeanids.mbari.org/tethys/Xml/Estimation.xsd
                               Tethys/Guidance http://okeanids.mbari.org/tethys/Xml/Guidance.xsd"
       Id="Docked">

    <DefineArg Name="MaxDockRange"><Description>
        Maximum range allowed from the dock.
    </Description><Units:meter/><Value>8</Value></DefineArg>

    <DefineArg Name="DetachedTimeout"><Description>
        Time duration limit for determining if the vehicle is detached from the
        dock.
    </Description><Units:minute/><Value>5</Value></DefineArg>

    <DefineArg Name="DockedTimeout"><Description>
        Time duration limit for determining if the vehicle is ON the dock.
    </Description><Units:second/><Value>30</Value></DefineArg>

    <DefineArg Name="Depth"><Description>
        Depth to maintain while docked.
    </Description><Units:meter/><Value>5</Value></DefineArg>

    <DefineArg Name="TransponderCode"><Description>
        Transponder Address.
    </Description><Units:count/><Value>2</Value></DefineArg>

    <DefineArg Name="TrackingUpdatePeriod"><Description>
        How long to wait between acoustic queries.
    </Description><Units:second/><Value>60</Value></DefineArg>

    <DefineArg Name="NumberOfPings"><Description>
        Number of pings requested each time.
    </Description><Units:count/><Value>1</Value></DefineArg>

    <DefineArg Name="Speed"><Description>
        Thruster speed while docked.
    </Description><Units:meter_per_second/><Value>0.0</Value></DefineArg>

    <DefineArg Name="DepthDeadband"><Description>
        How much vertical drift from the specified depth is allowed while
        docked.
    </Description><Units:meter/><Value>1.5</Value></DefineArg>

    <DefineArg Name="PitchLimit"><Description>
        Max vehicle pitch (+/-) while on dock.
    </Description><Units:degree/><Value>20</Value></DefineArg>

    <DefineArg Name="MinDepth"><Description>
        Minimum depth while docked.
    </Description><Control:VerticalControl.surfaceThreshold/></DefineArg>

    <DefineArg Name="MaxDepth"><Description>
        Maximum depth while docked.
    </Description><BIT:CBIT.stopDepth/></DefineArg>

    <Sequence/>

    <Guidance:DepthEnvelope>
        <Parallel/>
        <Setting><Guidance:DepthEnvelope.minDepth/><Arg Name="MinDepth"/></Setting>
        <Setting><Guidance:DepthEnvelope.maxDepth/><Arg Name="MaxDepth"/></Setting>
    </Guidance:DepthEnvelope>

    <Estimation:TrackAcousticContact>
        <Parallel/>
        <Setting><Estimation:TrackAcousticContact.contactLabelSetting/><Arg Name="TransponderCode"/></Setting>
        <Setting><Estimation:TrackAcousticContact.numberOfSamplesSetting/><Arg Name="NumberOfPings"/></Setting>
        <Setting><Estimation:TrackAcousticContact.updatePeriodSetting/><Arg Name="TrackingUpdatePeriod"/></Setting>
    </Estimation:TrackAcousticContact>

    <Assign><Parallel/><Control:VerticalControl.pitchLimit/><Arg Name="PitchLimit"/></Assign>

    <Assign><Parallel/><Control:VerticalControl.depthDeadband/><Arg Name="DepthDeadband"/></Assign>

    <Guidance:Pitch>
        <Parallel/>
        <Setting><Guidance:Pitch.depth/><Arg Name="Depth"/></Setting>
    </Guidance:Pitch>

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

    <Guidance:Docked>
        <Sequence/>
        <Setting><Guidance:Docked.StopDepth/><Arg Name="MaxDepth"/></Setting>
        <Setting><Guidance:Docked.DockRange/><Arg Name="MaxDockRange"/></Setting>
        <Setting><Guidance:Docked.DetachedTimeout/><Arg Name="DetachedTimeout"/></Setting>
        <Setting><Guidance:Docked.DockedTimeout/><Arg Name="DockedTimeout"/></Setting>
    </Guidance:Docked>

</Aggregate>
