<!DOCTYPE procedure SYSTEM "flight_plan.dtd">

<procedure>
  <waypoints>
    <waypoint name="AF" x="177.4" y="45.1" alt="30"/>
    <waypoint name="TD" x="28.8" y="57.0" alt="0"/>
    <waypoint name="_BASELEG" x="168.8" y="-13.8"/>
  </waypoints>
<blocks>
    <block name="Land Right AF-TD" strip_button="Land right (wp AF-TD)" strip_icon="land-right.png">
      <set value="DEFAULT_CIRCLE_RADIUS" var="nav_radius"/>
      <deroute block="land"/>
    </block>
    <block name="Land Left AF-TD" strip_button="Land left (wp AF-TD)" strip_icon="land-left.png">
      <set value="-DEFAULT_CIRCLE_RADIUS" var="nav_radius"/>
      <deroute block="land"/>
    </block>
    <block name="land">
      <call fun="nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)"/>
      <circle radius="nav_radius" until="NavCircleCount() > 0.5" wp="_BASELEG"/>
      <circle radius="nav_radius" until="And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 > fabs(estimator_z - WaypointAlt(WP__BASELEG)))" wp="_BASELEG"/>
    </block>
    <block name="final">
      <exception cond="ground_alt + 10 > estimator_z" deroute="flare"/>
      <go from="AF" hmode="route" vmode="glide" wp="TD" alt="ground_alt"/>
    </block>
    <block name="flare">
      <go approaching_time="0" from="AF" hmode="route" throttle="0.0" vmode="throttle" wp="TD"/>
      <attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>
    </block>
</blocks>
</procedure>
