<!DOCTYPE flight_plan SYSTEM "flight_plan.dtd">
<flight_plan alt="550" ground_alt="500" lat0="48.330464" lon0="10.892268" max_dist_from_home="500" name="ScaleX_" security_height="20">
<header>
#include "subsystems/datalink/datalink.h"
</header>

  <waypoints>
    <waypoint name="HOME" lon="10.892268" lat="48.330464" height="40"/>
   <!-- BITTE NUR PROFIL UND ANFLUG AENDERN (PROFIL-KOORD. VON UNTEN RAUSKOPIEREN) -->
    <waypoint name="Profil" lon="10.891223" lat="48.331367"/>
    <waypoint name="Anflug" x="-150" y="0" height="30"/>

  </waypoints>
  <blocks>

    <block name="Waiting for GPS fix">
      <!-- <set value="1" var="kill_throttle"/> -->
      <while cond="!GpsFixValid()"/>
    </block>

    <block name="Geo init">
      <while cond="LessThan(NavBlockTime(), 10)"/>
      <!-- <call fun="NavSetGroundReferenceHere()"/> -->
    </block>

    <block name="Waiting for Remote Control">
      <while cond="RCLost()"/> 
    </block>

    <block name="Unlock throttle">
      <set value="1" var="launch"/>
      <set value="0" var="kill_throttle"/>
      <set value="0" var="autopilot_flight_time"/>
    </block>

    <block name="Climb">
<!-- HIER HOEHE EINTRAGEN ! -->
      <circle wp="Profil" pitch="45" radius="-70" throttle="0.80" until="GetPosAlt() > ground_alt+0305" vmode="throttle"/>
      <deroute block="Descent"/>
    </block>

    <block name="Descent">
      <circle wp="Profil" climb="-1.5" radius="-70" throttle="0.40" pitch="auto" until="ground_alt+25 > GetPosAlt()" vmode="climb"/>
<!-- HIER HOEHE EINTRAGEN ! -->
      <exception cond="GetPosAlt() > ground_alt + 0500 + 50 " deroute="Down"/>
      <deroute block="Landing"/>
    </block>

    <block name="Down">
     <circle wp="Profil" radius="-70" until="ground_alt+35 > GetPosAlt()" vmode="alt" alt="ground_alt+40"/>
      <deroute block="Landing"/>
    </block>

    <block name="Landing">
      <while cond="TRUE">
      <go wp="Anflug" approaching_time="1"/>
      <go from="Anflug" hmode="route" vmode="glide" wp="HOME" alt="ground_alt+15" approaching_time="1"/>
      </while>
      <deroute block="Standby"/>
    </block>

    <block name="Standby" group="home" key="Ctrl+a" strip_button="Standby" strip_icon="home.png">
      <circle radius="-70" wp="HOME"/>
    </block>
 
  </blocks>
</flight_plan>
