Flight Plan Examples
This page will detail a number of flight plan examples.
Takeoff
The block of code:
File: conf/flight_plans/myflightplan.xml |
<flight_plan ...>
...
<blocks>
...
<block key="t" name="Takeoff" strip_button="Takeoff" strip_icon="takeoff.png">
<set value="0" var="kill_throttle"/>
<set value="0" var="autopilot_flight_time"/>
<go from="START" pitch="-10" throttle="1.0" vmode="throttle" wp="ER"/>
</block>
...
</blocks>
</flight_plan>
|
Below is an explanation of the code - left to right, top to bottom.
key accelerator to select the block with the keyboard (press t for takeoff)
key="t"
the name of the block
name="Takeoff"
This shows as the name when you hover your mouse over the button
strip_button="Takeoff"
The name of the icon picture shown in the GCS
strip_icon="takeoff.png"
This turns on the option to change the throttle
<set value="0" var="kill_throttle"/>
This turns on the flight time estimator
<set value="0" var="autopilot_flight_time"/>
<go from="START" pitch="-10" throttle="1.0" vmode="throttle" wp="ER"/>
This says for the aircraft to go from "START" waypoint towards "ER" (end runway) waypoint with a pitch angle setpoint of -10 degrees (to keep the aircraft on the ground) and throttle at 100%. You would also add a deroute option to change to the "CLIMB" waypoint (the waypoint that gets the aircraft up to the correct height) once the aircraft was moving above stall speed. I will add the code for this soon.
vmode="throttle" switches the vertical control into autothrottle mode; possible other values are climb, alt, xyz, or glide.
This code will work in theory, but may not in practice, especially if you only have a narrow runway or your aircraft takes a long time to get up to speed. This is because the autopilot is not exact in its estimation of where it is.
Surveying an area
There are two types of survey, two waypoint survey or Polysurvey. PolySurvey can be called multiple times during a flight plan but I am not sure how to do this (SOMEONE PLEASE UPDATE).
<block name="Initialize Poly Survey"> <call fun="InitializePolygonSurvey(WP_S1, 5, 150, 45)"/> </block>
<block name="Run Poly Survey"> <call fun="PolygonSurvey()"/> </block>
You will notice that there are two blocks of code instead of a single block. This because when you are surveying an area you may want to stop the survey and take a closer look at something (for instance you may wish to circle something of interest). If you want to continue the survey from the point where you stopped to look closer at the thing of interest all you need to do is call the "Run Poly Survey" block.
<call fun="InitializePolygonSurvey(WP_S1, 5, 150, 45)"/>
This initializes the PolySurvey starting with Waypoint S1 and using 5 waypoints (in sequence, eg S1, S2, S3, S4, S5), with a distance between each survey line of 150 meters and an angle of survey of 45 degrees from the initial waypoint.
<call fun="PolygonSurvey()"/>
This calls the PolySurvey, you may want to call this either via a button on the GCS or by calling it in external code for example an automated IR sensor (if you are looking for a person).
Mission Actions
During the survey, polygonsurvey and the oval, mission actions can be triggered during the straight parts using the
#define LINE_START_FUNCTION #define LINE_STOP_FUNCTION
defines in the flight plan. One example would be to start taking pictures or even limit the maximal roll angle (be careful with the roll angle limit: if the aircraft does not follow the circle very well, it might still need to turn the first part of the line: make a button to restore max_roll in case of problems). At the top of the flight plan file you can define:
<header> #include "dc.h" #include "fw_h_ctl.h" #define LINE_START_FUNCTION {dc_shoot = 1; h_ctl_roll_max_setpoint = DEG2RAD(15);} #define LINE_STOP_FUNCTION {dc_shoot = 0; h_ctl_roll_max_setpoint = H_CTL_ROLL_MAX_SETPOINT;} </header>
Landing your aircraft
<block name="final"> <exception cond="ground_alt + 10 > GetPosAlt()" deroute="flare"/> <go from="AF" hmode="route" vmode="glide" wp="TD"/> </block>
Above is the final Block. This block is used to bring the aircraft towards the end of the runway (or landing area) which is the "AF".
<go from="AF" hmode="route" vmode="glide" wp="TD"/>
Fly from waypoint "AF" to waypoint "TD" and glide between them to maintain the angle between them. You may want these two waypoints to be a significant distance between them if you want the aircraft to come in on a very shallow angle.
<exception cond="ground_alt + 10 > GetPosAlt()" deroute="flare"/>
"flare" is the deroute condition and it is implemented when the aircraft is 10 meters from the ground.
<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>
You would want the aircraft to flare just before hitting the ground. If your aircraft is not very stable at low speeds you may want to make the distance above ground lower.
<attitude roll="0.0" throttle="0.0" until="FALSE" vmode="throttle"/>
This lets the aircraft fly with roll controlled at neutral (0°) and throttle off.