Skip to content

Instantly share code, notes, and snippets.

@gautierhattenberger
Created January 19, 2017 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gautierhattenberger/c81f3f508954d175c04abb348924f98b to your computer and use it in GitHub Desktop.
Save gautierhattenberger/c81f3f508954d175c04abb348924f98b to your computer and use it in GitHub Desktop.
<flight_plan alt="650" ground_alt="600" home_mode_height="60" lat0="43.1231452" lon0="0.3653030" max_dist_from_home="1000" name="Flights Campistrou" qfu="270" security_height="40">
<header>
#include "subsystems/datalink/datalink.h"
#ifdef METEO_STICK_PERIODIC_PERIOD
static inline uint8_t TEMP_DECISION(void) { if (LessThan(meteo_stick.current_temperature, 9)) return TRUE; else return FALSE; }
#else
static inline uint8_t TEMP_DECISION(void) { return FALSE; }
#endif
</header>
<waypoints>
<waypoint name="HOME" x="0" y="0"/>
<waypoint name="CLIMB" x="164.5" y="11.1"/>
<waypoint alt="630" name="AF" x="-120.7" y="-263.8"/>
<waypoint alt="601" name="TD" x="-138.0" y="32.3"/>
<waypoint name="_BASELEG" x="237.0" y="-630.9"/>
<waypoint name="L1" x="48.7" y="-253.8"/>
<waypoint name="L2" x="60.3" y="222.8"/>
<waypoint name="L1H" x="28.7" y="-253.8" alt="950"/>
<waypoint name="L2H" x="40.3" y="222.8" alt="950"/>
<waypoint name="SP_LOW" x="-408.0" y="-4.8"/>
<waypoint alt="1650.0" name="SP" x="-47.2" y="-201.3"/>
<waypoint name="STNDBY" x="-37.9" y="-52.4"/>
<waypoint lat="43.1223881" lon="0.3627727" name="TA"/>
<waypoint lat="43.1241468" lon="0.3626271" name="TB"/>
<waypoint alt="900.0" name="C1" x="121.2" y="-198.1"/>
<waypoint alt="900.0" name="C2" x="-232.6" y="-186.8"/>
<waypoint alt="601" name="BUNGEE" x="-50.5" y="50.3"/>
</waypoints>
<exceptions>
<exception cond="GetPosAlt() > 2100" deroute="Standby"/>
<exception cond="datalink_time > (8*60)" deroute="Standby"/>
</exceptions>
<blocks>
<block name="Wait GPS">
<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="Holding point">
<set value="1" var="kill_throttle"/>
<attitude roll="0" throttle="0" vmode="throttle"/>
</block>
<block name="Bungee take-off">
<call fun="nav_bungee_takeoff_setup(WP_BUNGEE)"/>
<call fun="nav_bungee_takeoff_run()"/>
<deroute block="Standby"/>
</block>
<block group="home" name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > GetAltRef()+30" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block group="home" name="Standby" strip_button="Standby" strip_icon="home.png">
<circle radius="nav_radius" wp="STNDBY"/>
</block>
<block group="sp" name="Spiral UP" strip_button="Spiral Profile (SP) Up" strip_icon="up_profile.png">
<set value="2." var="fp_climb"/>
<circle climb="fp_climb" radius="nav_radius" until="GetPosAlt() > WaypointAlt(WP_SP)" vmode="climb" wp="SP"/>
<circle radius="nav_radius" until="NavCircleCount() > 0.5" wp="SP"/>
</block>
<block group="sp" name="Spiral DOWN" strip_button="Spiral Profile (SP) Down" strip_icon="down_profile.png">
<set value="-2." var="fp_climb"/>
<circle climb="fp_climb" radius="nav_radius" until="WaypointAlt(WP_SP_LOW) > GetPosAlt()" vmode="climb" wp="SP"/>
<deroute block="Standby"/>
</block>
<block group="sp" name="Spiral UP Temp">
<exception cond="TEMP_DECISION()" deroute="Spiral DOWN"/>
<set value="2." var="fp_climb"/>
<circle climb="fp_climb" radius="nav_radius" until="GetPosAlt() > WaypointAlt(WP_SP)" vmode="climb" wp="SP"/>
<circle radius="nav_radius" until="NavCircleCount() > 0.5" wp="SP"/>
<deroute block="Spiral DOWN"/>
</block>
<block group="oval_pattern" name="Oval L1-L2" strip_button="Oval (L1-L2)">
<oval p1="L1" p2="L2" radius="nav_radius"/>
</block>
<block group="oval_pattern" name="Oval L1-L2 High">
<oval p1="L1H" p2="L2H" radius="nav_radius"/>
</block>
<block group="oval_pattern" name="Oval UP" strip_button="Oval Climb (C1-C2)">
<set value="2." var="fp_climb"/>
<oval climb="fp_climb" p1="C1" p2="C2" radius="nav_radius" until="GetPosAlt() > WaypointAlt(WP_SP)" vmode="climb"/>
<deroute block="Standby"/>
</block>
<block group="oval_pattern" name="Oval DOWN" strip_button="Oval DOWN (C1-C2)">
<set value="-2." var="fp_climb"/>
<oval climb="fp_climb" p1="C1" p2="C2" radius="nav_radius" until="WaypointAlt(WP_SP_LOW) > GetPosAlt()" vmode="climb"/>
<deroute block="Standby"/>
</block>
<block name="Oval Towers" strip_button="Oval (TA-TB)">
<oval p1="TA" p2="TB" radius="nav_radius"/>
<deroute block="Standby"/>
</block>
<block group="land" 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 group="land" 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)-(nav_radius/fabs(nav_radius))*10), 10 > fabs(GetPosAlt() - WaypointAlt(WP__BASELEG)))" wp="_BASELEG"/>
</block>
<block name="final">
<exception cond="GetAltRef() + 8 > GetPosAlt()" deroute="flare"/>
<go from="AF" hmode="route" vmode="glide" wp="TD"/>
</block>
<block name="flare">
<go exceeding_time="10" from="AF" hmode="route" throttle="0.0" vmode="throttle" wp="TD"/>
<attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>
</block>
</blocks>
</flight_plan>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment