<flight_plan alt="100" ground_alt="59" lat0="30.6478" lon0="-86.3253" max_dist_from_home="1500" name="MAV06" qfu="90" security_height="25">
<header>
#include "subsystems/navigation/bomb.h"
#include "subsystems/navigation/nav_line.h"
</header>
  <waypoints>
    <waypoint alt="59." name="TARGET" x="85.1922610838" y="8.50236448925"/>
    <waypoint name="TARGET1" x="700.251490867" y="-210.691196656"/>
    <waypoint name="11" x="0." y="-150."/>
    <waypoint name="22" x="0." y="150."/>
    <waypoint name="BASELEG" x="-2.87161011167" y="-163.418097454"/>
    <waypoint alt="90." name="START" x="-61.4546727629" y="-124.362795495"/>
    <waypoint name="RELEASE" x="149.970542131" y="126.560028979"/>
    <waypoint name="HOME" x="0" y="-60"/>
    <waypoint alt="120." name="WAIT" x="117.199996091" y="-142.703845164"/>
    <waypoint alt="120." name="CLIMB" x="241.669853874" y="83.9946379811"/>
    <waypoint alt="89." name="AF" x="-143.80300338" y="-158.231289385"/>
    <waypoint alt="59." name="TD" x="27.3293594896" y="1.40175988153"/>
    <waypoint name="TOD" x="-142.91998501" y="2.3426450938"/>
    <waypoint name="OVERRUN" x="207.635718161" y="109.431672315"/>
    <waypoint name="CIRCLE" x="10" y="10"/>
  </waypoints>
  <blocks>
    <block name="kill">
      <attitude roll="0" throttle="0" vmode="throttle"/>
    </block>


   <!-- <block name="land">
      <set value="compute_baseleg()" var="unit"/>
      <circle radius="BOMB_RADIUS" until="circle_count > 0.5" wp="BASELEG"/>
      <set value="V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE" var="v_ctl_auto_throttle_cruise_throttle"/>
      <circle radius="BOMB_RADIUS" until="Qdr(DegOfRad(bomb_start_qdr)-10) && baseleg_alt_tolerance > fabs(GetPosAlt() - baseleg_alt)" wp="BASELEG"/>
    </block>

    <block name="final">
      <exception cond="ground_alt + 10 > GetPosAlt()" deroute="flare"/>
      <go alt="baseleg_alt" approaching_time="16" from="AF" hmode="route" wp="TD"/>
      <go approaching_time="2" from="AF" hmode="route" throttle="0.1" vmode="throttle" wp="TD"/>
    </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>

    <block name="circle 1">
      <exception cond="block_time > 300" deroute="wait"/>
      <circle wp="C1" radius="80"/>
    </block>

    <block name="climb">
      <exception cond=" GetPosAlt() > ground_alt +30" deroute="wait"/>
      <attitude pitch="15" roll="0" throttle="0.8" until="10> stage_time" vmode="throttle"/>
    </block>-->
    <block name="wait" strip_button="Wait">
      <set value="v_ctl_auto_throttle_nominal_cruise_throttle" var="v_ctl_auto_throttle_cruise_throttle"/>
      <circle radius="-100" wp="WAIT"/>
    </block>
   <!-- <block name="Climb 0">
      <circle climb="0" radius="100" vmode="climb" wp="WAIT"/>
    </block>


    <block name="target1" strip_button="T1">
      <exception cond="block_time > 300" deroute="wait"/>
      <eight center="TARGET1" radius="80" turn_around="C1"/>
    </block>

    <block name="bomb" strip_button="Bomb">
      <set value="BombComputeApproach()" var="unit"/>
      <circle radius="BOMB_RADIUS" until="Qdr(DegOfRad(bomb_start_qdr)-10)" wp="BASELEG"/>
    </block>
    <block name="align">
      <exception cond="BombUpdateRelease()" deroute="kill"/>
      <go approaching_time="bomb_trigger_delay" from="START" hmode="route" wp="RELEASE"/>
    </block>
    <block name="shoot">
      <set value="BombShoot()" var="unit"/>
      <go approaching_time="0" from="RELEASE" hmode="route" wp="CLIMB"/>
      <set value="BombCloseHatch()" var="unit"/>
      <deroute block="wait"/>
    </block>
    <block name="close">
      <set value="BombCloseHatch()" var="unit"/>
      <deroute block="wait"/>
    </block>

    <block name="roll" strip_button="Roll">
      <set value="TRUE" var="h_ctl_disabled"/>
      <set value="(-0.75*MAX_PPRZ)" var="h_ctl_aileron_setpoint"/>
      <while cond="3 > stage_time && (stateGetNedToBodyEulers_f()->phi > 0 ||  -M_PI_2 > stateGetNedToBodyEulers_f()->phi)"/>
      <set value="FALSE" var="h_ctl_disabled"/>
      <return/>
    </block>-->
<!--   <block name="circle_here" strip_button="circle_here">
      <set value="compute_loiter()" var="unit"/>
      <circle radius="-100" wp="CIRCLE"/>
      </block>-->

       <block name="Line" strip_button="Line">
         <call fun="nav_line_init()"/>
         <call fun="nav_line(WP_11, WP_22, 100)"/>
    </block>
  </blocks>
</flight_plan>
