<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bubbajobob</id>
	<title>PaparazziUAV - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bubbajobob"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Bubbajobob"/>
	<updated>2026-04-06T08:44:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6441</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6441"/>
		<updated>2010-04-26T23:59:17Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Flight Line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&lt;br /&gt;
[[Image:OSAMFlightLineDiagram.png|Flight Line Diagram]]&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,distance_before,distance_after)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multiple flight lines can be daisy chained by reusing waypoints as shown below...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R2,WP_R3,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R3,WP_R4,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R5,WP_R6,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, the previous block can also be implemented using the FlightLineBlock function. The FlightLineBlock function works the same as the FlightLine function except it automatically steps through the waypoints between the given waypoints. Make sure the waypoints are declared in order or else it won't work!&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R6,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Multiple Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6440</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6440"/>
		<updated>2010-04-26T23:54:56Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Exceptions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&lt;br /&gt;
[[Image:OSAMFlightLineDiagram.png|Flight Line Diagram]]&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,distance_before,distance_after)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multiple flight lines can be daisy chained by reusing waypoints as shown below...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R2,WP_R3,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R3,WP_R4,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R5,WP_R6,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Multiple Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6439</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6439"/>
		<updated>2010-04-26T23:54:30Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&lt;br /&gt;
[[Image:OSAMFlightLineDiagram.png|Flight Line Diagram]]&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,distance_before,distance_after)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multiple flight lines can be daisy chained by reusing waypoints as shown below...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R1,WP_R2,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R2,WP_R3,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R3,WP_R4,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R5,WP_R6,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Multiple Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6438</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6438"/>
		<updated>2010-04-26T23:49:24Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&lt;br /&gt;
Multiple flight lines can be daisy chained reusing&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Multiple Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6437</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6437"/>
		<updated>2010-04-26T23:48:48Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&lt;br /&gt;
Multiple flight lines can&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Multiple Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6436</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6436"/>
		<updated>2010-04-26T23:32:59Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:OSAMFlightLineExample.jpg |Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6435</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6435"/>
		<updated>2010-04-26T23:32:30Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Flight Line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
The Flight Line Routine allows the user to map/follow one dimensional areas of interest like roads and rivers. Given two waypoints, the routine will automatically transition into the flight line to ensure full coverage between the waypoints. In addition, distances before and after the flight line can be used to add extra security to the coverage.&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:P OSAMFlightLineExample.jpg |Flight Line Example&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:OSAMFlightLineExample.jpg&amp;diff=6434</id>
		<title>File:OSAMFlightLineExample.jpg</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:OSAMFlightLineExample.jpg&amp;diff=6434"/>
		<updated>2010-04-26T23:25:48Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6433</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6433"/>
		<updated>2010-04-26T23:22:21Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:OSAMFlightLineDiagram.png|Flight Line Diagram&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:OSAMFlightLineDiagram.png&amp;diff=6432</id>
		<title>File:OSAMFlightLineDiagram.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:OSAMFlightLineDiagram.png&amp;diff=6432"/>
		<updated>2010-04-26T23:20:26Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6431</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6431"/>
		<updated>2010-04-26T22:16:10Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Flight Line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;br /&gt;
   &amp;lt;block name=&amp;quot;Map River&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R1,WP_R7a,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLineBlock(WP_R8,WP_R14,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlightLine(WP_R15,WP_R16,nav_radius,100,100)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6430</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=6430"/>
		<updated>2010-04-26T22:08:08Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Alternative configurations ====&lt;br /&gt;
If you are wanting to start and stop the Poly Survey this is possible by splitting the Poly Survey code above into the initialization routine and the execution routine. You might want to do this if you are searching for something inside the Poly Survey, think you have found it and then realized you haven't, so you want to continue the survey (not restart it). Using the example above, but with the initialisation and execution code separate:&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Init Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Execute Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight Line ===&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4398</id>
		<title>Users</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4398"/>
		<updated>2009-01-30T16:59:39Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please add yourself to this list if you wish to share who you are and what you are doing with Paparazzi&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Asia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:mundhra@gmail.com M Mundhra] || India || Tiny 1.3 ||| 2007 || Gain tuning on a flying wing configuration airframe &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:ngkiangloong_at_hopetechnik.com Jianlun]|| Singapore || TWOG V1 ||| 2008 || trying to get TWOG onto an EasyStar. very much a newbie! &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Europe&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:silas_at_silas.hu SilaS] || Budapest || Tiny 1.3 ||| 2007 || Applied tiny to GWS Estarter, finished long travels in AUTO2. Now transfert it to a Twinstar and working on pairing tiny with FPV. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:st.jr_at_gmx.at TomS] || Graz || Tiny 2.11 ||| 2008 || Starting to complete the wiring for the tiny and then trying to apply it to my TwinStar II. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:markggriffin_at_gmail.com MarkG] || Geneva, Switzerland || Modified Tiny 2.11, EeePC as GCS, Multiplex FunJet  ||| 2008 || Many successful flights. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:x-microdrones@2007.polytechnique.org X-MicroDrones] || Paris, France || Tiny 2.11, Quad-Tilt-Rotor VTOL  ||| 2008 || Wiring completed, first flights soon... We're trying to adapt Paparazzi to a Quad-Tilt-Rotor VTOL able to perform both airplane-like and helicopter-like flights. Working on inertial measurement units implementation. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [[User:MarcusWolschon|Marcus Wolschon]] || Freiburg, Germany || Gumstix, Paraplane  ||| 2008 || Porting Paparazzi to Linux-Userland with UDP-communication using mesh-networking.&lt;br /&gt;
UDP-Downlink working, GPS via GPSD working, Pararazzi in Linux working, Hardware still RC-only due to sensor-soldering-issues&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:spam1_at_marzer.com CedricM] || Geneva, Switzerland || Tiny 2.11, Multiplex FunJet with video camera  ||| 2008 || Many successful flights working on an osd module and weather probes. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:hendrix_at_vivodinet.gr Chris Efstathiou] || Piraeus Hellas || tiny 2.11 on a Mpx EasyGlider, TWOG 1.3 on a Boomerang turbine jet ||| 2008 || The Easyglider is fully operational, still working on the jet which had his first flight with the TWOG at 25/1/2009  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| FelixR || Edinburgh, Scotland || Booz2 quadrotor ||| 2008 || remote controlled flight, working on Kalman Filter&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:azoreanuav_at_gmail.com Rui Costa] || Portugal, Azores || Outrunner Twinstar II with Tiny 2.11, Aerocomm datalink, 1W video tx ||| 2008 || Only ground test and software configuration. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ North America&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:pauldanielcox_at_gmail_dot_com Paul Cox]  &lt;br /&gt;
|Vancouver, WA [http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=98663&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=64.664844,101.953125&amp;amp;ie=UTF8&amp;amp;ll=45.606112,-122.643471&amp;amp;spn=0.222411,0.398254&amp;amp;z=12 &amp;lt;span title=&amp;quot;Google Map of 98663&amp;quot;&amp;gt;98663&amp;lt;/span&amp;gt;] &lt;br /&gt;
|    Tiny v2.11  ||  Nov. 2008 || Getting geared up for a maiden flight soon hopefully. Skype: pauldanielcox Gtalk: [use email] &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:quill_at_u.washington.edu John Burt] || Portland, Oregon || Tiny v2.11 from PPZUAV, Multiplex Cularis, 9Xtend modems, T7CAP TX, ground station: EEE PC701 and/or Nokia N810 ||| Jan 2009 || Debugging Tiny-GCS interface. Possibly first test flights in late Jan 09. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:bmw330i@me.com David Conger] || San Diego (Ramona), California || Tiny1.3 (PPZUAV)  ||| Sept 2007 || Flying Wing MAV with onboard video. Test platform for the new 900mhz XBPro 900 RF modems.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| USU AggieAir Remote Sensing || Logan, UT || TWOG (PPZUAV)  ||| January 2009 || Building 72&amp;quot; Flying Wings which will be used for remote sensing. Routine autonomous flight.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [http://www.engr.usu.edu/wiki/index.php/OSAM USU OSAM-UAV] || Logan, UT || TWOG (PPZUAV)  ||| June 2007 || 2x72&amp;quot; 5x48&amp;quot; 1x60&amp;quot; Flying Wings. Research backyard for AggieAir Remote Sensing. Routine autonomous flight.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Central America&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:joschau@comcast.net Joekadet] || David Panama' || Tiny v2.11/LEA-4P (PPZUAV) No RF Modems yet.  Multiplex Mentor  ||| 2008 || Working on Airframe build. Paparazzi AP is wired and working awaiting integration into airframe. First flight hopefully end of February.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Australia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:todd_soaring@yahoo.com.au Todd Sandercock] || Adelaide, SA || Tiny v2.11, Multiplex Twinjet, 9Xtend modems ||| Jan 2008 || Completed successful flight testing. Now designing new airframe.  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4381</id>
		<title>Users</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4381"/>
		<updated>2009-01-27T18:14:10Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please add yourself to this list if you wish to share who you are and what you are doing with Paparazzi&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Asia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:ngkiangloong_at_hopetechnik.com Jianlun]|| Singapore || TWOG V1 ||| 2008 || trying to get TWOG onto an EasyStar. very much a newbie! &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Europe&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:silas_at_silas.hu SilaS] || Budapest || Tiny 1.3 ||| 2007 || Applied tiny to GWS Estarter, finished long travels in AUTO2. Now transfert it to a Twinstar and working on pairing tiny with FPV. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:st.jr_at_gmx.at TomS] || Graz || Tiny 2.11 ||| 2008 || Starting to complete the wiring for the tiny and then trying to apply it to my TwinStar II. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:markggriffin_at_gmail.com MarkG] || Geneva, Switzerland || Modified Tiny 2.11, EeePC as GCS, Multiplex FunJet  ||| 2008 || Many successful flights. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:x-microdrones@2007.polytechnique.org X-MicroDrones] || Paris, France || Tiny 2.11, Quad-Tilt-Rotor VTOL  ||| 2008 || Wiring completed, first flights soon... We're trying to adapt Paparazzi to a Quad-Tilt-Rotor VTOL able to perform both airplane-like and helicopter-like flights. Working on inertial measurement units implementation. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [[User:MarcusWolschon|Marcus Wolschon]] || Freiburg, Germany || Gumstix, Paraplane  ||| 2008 || Porting Paparazzi to Linux-Userland with UDP-communication using mesh-networking.&lt;br /&gt;
UDP-Downlink working, GPS via GPSD working, Pararazzi in Linux working, Hardware still RC-only due to sensor-soldering-issues&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:spam1_at_marzer.com CedricM] || Geneva, Switzerland || Tiny 2.11, Multiplex FunJet with video camera  ||| 2008 || Many successful flights working on an osd module and weather probes. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:hendrix_at_vivodinet.gr Chris Efstathiou] || Piraeus Hellas || tiny 2.11 on a Mpx EasyGlider, TWOG 1.3 on a Boomerang turbine jet ||| 2008 || The Easyglider is fully operational, still working on the jet which had his first flight with the TWOG at 25/1/2009  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ North America&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:pauldanielcox_at_gmail_dot_com Paul Cox]  &lt;br /&gt;
|Vancouver, WA [http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=98663&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=64.664844,101.953125&amp;amp;ie=UTF8&amp;amp;ll=45.606112,-122.643471&amp;amp;spn=0.222411,0.398254&amp;amp;z=12 &amp;lt;span title=&amp;quot;Google Map of 98663&amp;quot;&amp;gt;98663&amp;lt;/span&amp;gt;] &lt;br /&gt;
|    Tiny v2.11  ||  Nov. 2008 || Getting geared up for a maiden flight soon hopefully. Skype: pauldanielcox Gtalk: [use email] &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:quill_at_u.washington.edu John Burt] || Portland, Oregon || Tiny v2.11 from PPZUAV, Multiplex Cularis, 9Xtend modems, T7CAP TX, ground station: EEE PC701 and/or Nokia N810 ||| Jan 2009 || Debugging Tiny-GCS interface. Possibly first test flights in late Jan 09. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:bmw330i@me.com David Conger] || San Diego (Ramona), California || Tiny1.3 (PPZUAV)  ||| Sept 2007 || Flying Wing MAV with onboard video. Test platform for the new 900mhz XBPro 900 RF modems.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| USU AggieAir Remote Sensing || Logan, UT || TWOG (PPZUAV)  ||| January 2009 || Building 72&amp;quot; Flying Wings which will be used for remote sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [http://www.engr.usu.edu/wiki/index.php/OSAM USU OSAM-UAV] || Logan, UT || TWOG (PPZUAV)  ||| June 2007 || 2x72&amp;quot; 5x48&amp;quot; 1x60&amp;quot; Flying Wings. Research backyard for AggieAir Remote Sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Australia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:todd_soaring@yahoo.com.au Todd Sandercock] || Adelaide, SA || Tiny v2.11, Multiplex Twinjet, 9Xtend modems ||| Jan 2008 || Completed successful flight testing. Now designing new airframe.  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4380</id>
		<title>Users</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4380"/>
		<updated>2009-01-27T18:13:20Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please add yourself to this list if you wish to share who you are and what you are doing with Paparazzi&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Asia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:ngkiangloong_at_hopetechnik.com Jianlun]|| Singapore || TWOG V1 ||| 2008 || trying to get TWOG onto an EasyStar. very much a newbie! &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Europe&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:silas_at_silas.hu SilaS] || Budapest || Tiny 1.3 ||| 2007 || Applied tiny to GWS Estarter, finished long travels in AUTO2. Now transfert it to a Twinstar and working on pairing tiny with FPV. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:st.jr_at_gmx.at TomS] || Graz || Tiny 2.11 ||| 2008 || Starting to complete the wiring for the tiny and then trying to apply it to my TwinStar II. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:markggriffin_at_gmail.com MarkG] || Geneva, Switzerland || Modified Tiny 2.11, EeePC as GCS, Multiplex FunJet  ||| 2008 || Many successful flights. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:x-microdrones@2007.polytechnique.org X-MicroDrones] || Paris, France || Tiny 2.11, Quad-Tilt-Rotor VTOL  ||| 2008 || Wiring completed, first flights soon... We're trying to adapt Paparazzi to a Quad-Tilt-Rotor VTOL able to perform both airplane-like and helicopter-like flights. Working on inertial measurement units implementation. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [[User:MarcusWolschon|Marcus Wolschon]] || Freiburg, Germany || Gumstix, Paraplane  ||| 2008 || Porting Paparazzi to Linux-Userland with UDP-communication using mesh-networking.&lt;br /&gt;
UDP-Downlink working, GPS via GPSD working, Pararazzi in Linux working, Hardware still RC-only due to sensor-soldering-issues&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:spam1_at_marzer.com CedricM] || Geneva, Switzerland || Tiny 2.11, Multiplex FunJet with video camera  ||| 2008 || Many successful flights working on an osd module and weather probes. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:hendrix_at_vivodinet.gr Chris Efstathiou] || Piraeus Hellas || tiny 2.11 on a Mpx EasyGlider, TWOG 1.3 on a Boomerang turbine jet ||| 2008 || The Easyglider is fully operational, still working on the jet which had his first flight with the TWOG at 25/1/2009  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ North America&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:pauldanielcox_at_gmail_dot_com Paul Cox]  &lt;br /&gt;
|Vancouver, WA [http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=98663&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=64.664844,101.953125&amp;amp;ie=UTF8&amp;amp;ll=45.606112,-122.643471&amp;amp;spn=0.222411,0.398254&amp;amp;z=12 &amp;lt;span title=&amp;quot;Google Map of 98663&amp;quot;&amp;gt;98663&amp;lt;/span&amp;gt;] &lt;br /&gt;
|    Tiny v2.11  ||  Nov. 2008 || Getting geared up for a maiden flight soon hopefully. Skype: pauldanielcox Gtalk: [use email] &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:quill_at_u.washington.edu John Burt] || Portland, Oregon || Tiny v2.11 from PPZUAV, Multiplex Cularis, 9Xtend modems, T7CAP TX, ground station: EEE PC701 and/or Nokia N810 ||| Jan 2009 || Debugging Tiny-GCS interface. Possibly first test flights in late Jan 09. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:bmw330i@me.com David Conger] || San Diego (Ramona), California || Tiny1.3 (PPZUAV)  ||| Sept 2007 || Flying Wing MAV with onboard video. Test platform for the new 900mhz XBPro 900 RF modems.&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [USU AggieAir Remote Sensing] || Logan, UT || TWOG (PPZUAV)  ||| January 2009 || Building 72&amp;quot; Flying Wings which will be used for remote sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [USU OSAM-UAV] || Logan, UT || TWOG (PPZUAV)  ||| June 2007 || 2x72&amp;quot; 5x48&amp;quot; 1x60&amp;quot; Flying Wings. Research backyard for AggieAir Remote Sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Australia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:todd_soaring@yahoo.com.au Todd Sandercock] || Adelaide, SA || Tiny v2.11, Multiplex Twinjet, 9Xtend modems ||| Jan 2008 || Completed successful flight testing. Now designing new airframe.  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4379</id>
		<title>Users</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Users&amp;diff=4379"/>
		<updated>2009-01-27T18:12:45Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please add yourself to this list if you wish to share who you are and what you are doing with Paparazzi&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Asia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:ngkiangloong_at_hopetechnik.com Jianlun]|| Singapore || TWOG V1 ||| 2008 || trying to get TWOG onto an EasyStar. very much a newbie! &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Europe&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:silas_at_silas.hu SilaS] || Budapest || Tiny 1.3 ||| 2007 || Applied tiny to GWS Estarter, finished long travels in AUTO2. Now transfert it to a Twinstar and working on pairing tiny with FPV. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:st.jr_at_gmx.at TomS] || Graz || Tiny 2.11 ||| 2008 || Starting to complete the wiring for the tiny and then trying to apply it to my TwinStar II. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:markggriffin_at_gmail.com MarkG] || Geneva, Switzerland || Modified Tiny 2.11, EeePC as GCS, Multiplex FunJet  ||| 2008 || Many successful flights. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:x-microdrones@2007.polytechnique.org X-MicroDrones] || Paris, France || Tiny 2.11, Quad-Tilt-Rotor VTOL  ||| 2008 || Wiring completed, first flights soon... We're trying to adapt Paparazzi to a Quad-Tilt-Rotor VTOL able to perform both airplane-like and helicopter-like flights. Working on inertial measurement units implementation. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [[User:MarcusWolschon|Marcus Wolschon]] || Freiburg, Germany || Gumstix, Paraplane  ||| 2008 || Porting Paparazzi to Linux-Userland with UDP-communication using mesh-networking.&lt;br /&gt;
UDP-Downlink working, GPS via GPSD working, Pararazzi in Linux working, Hardware still RC-only due to sensor-soldering-issues&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:spam1_at_marzer.com CedricM] || Geneva, Switzerland || Tiny 2.11, Multiplex FunJet with video camera  ||| 2008 || Many successful flights working on an osd module and weather probes. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:hendrix_at_vivodinet.gr Chris Efstathiou] || Piraeus Hellas || tiny 2.11 on a Mpx EasyGlider, TWOG 1.3 on a Boomerang turbine jet ||| 2008 || The Easyglider is fully operational, still working on the jet which had his first flight with the TWOG at 25/1/2009  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ North America&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:pauldanielcox_at_gmail_dot_com Paul Cox]  &lt;br /&gt;
|Vancouver, WA [http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=98663&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=64.664844,101.953125&amp;amp;ie=UTF8&amp;amp;ll=45.606112,-122.643471&amp;amp;spn=0.222411,0.398254&amp;amp;z=12 &amp;lt;span title=&amp;quot;Google Map of 98663&amp;quot;&amp;gt;98663&amp;lt;/span&amp;gt;] &lt;br /&gt;
|    Tiny v2.11  ||  Nov. 2008 || Getting geared up for a maiden flight soon hopefully. Skype: pauldanielcox Gtalk: [use email] &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:quill_at_u.washington.edu John Burt] || Portland, Oregon || Tiny v2.11 from PPZUAV, Multiplex Cularis, 9Xtend modems, T7CAP TX, ground station: EEE PC701 and/or Nokia N810 ||| Jan 2009 || Debugging Tiny-GCS interface. Possibly first test flights in late Jan 09. &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:bmw330i@me.com David Conger] || San Diego (Ramona), California || Tiny1.3 (PPZUAV)  ||| Sept 2007 || Flying Wing MAV with onboard video. Test platform for the new 900mhz XBPro 900 RF modems.|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [USU AggieAir Remote Sensing] || Logan, UT || TWOG (PPZUAV)  ||| January 2009 || Building 72&amp;quot; Flying Wings which will be used for remote sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [USU OSAM-UAV] || Logan, UT || TWOG (PPZUAV)  ||| June 2007 || 2x72&amp;quot; 5x48&amp;quot; 1x60&amp;quot; Flying Wings. Research backyard for AggieAir Remote Sensing&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;br /&gt;
----&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;background:black; color:blue&amp;quot;&lt;br /&gt;
|+ Australia&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Location !! Hardware !! Joined !! Current activities / project status&lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| [mailto:todd_soaring@yahoo.com.au Todd Sandercock] || Adelaide, SA || Tiny v2.11, Multiplex Twinjet, 9Xtend modems ||| Jan 2008 || Completed successful flight testing. Now designing new airframe.  &lt;br /&gt;
|- style=&amp;quot;background:bisque; color:black&amp;quot;&lt;br /&gt;
| New User || 1 || 2 ||| 3 || 4 &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4344</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4344"/>
		<updated>2009-01-20T21:39:36Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work consistantly, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4343</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4343"/>
		<updated>2009-01-20T21:38:43Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the routine has been initialized and the plane is on the bungee, check the laTo get this routine to work really well, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution should be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft!***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4342</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4342"/>
		<updated>2009-01-20T20:46:02Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line and will stop updating once the speed of the plane exceeds the MinSpeed. This allows the user to initialize the routine, move the plane and launch it without having to reinitialize. Once the plane is launched, it will follow the launch line until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line and the speed of the aircraft is greater than MinSpeed, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude, MinSpeed and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the routine has been initialized and the plane is on the bungee, check the laTo get this routine to work really well, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution needs to be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4341</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4341"/>
		<updated>2009-01-20T20:23:47Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is constantly drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line. The launch line will stop updating once the speed of the plane exceeds the MinSpeed. Once the plane is launched, it will follow the launch line until it crosses the throttle line and if the speed is greater than the MinSpeed. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work really well, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution needs to be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4340</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4340"/>
		<updated>2009-01-20T20:23:33Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is constantly drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line. The launch line will stop updating once the speed of the plane exceeds the MinSpeed. Once the plane is launched, it will follow the launch line until it crosses the throttle line and if the speed is greater than the MinSpeed. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get this routine to work really well, you will need to tune the values in the airframe config file. If the prop doesn't automatically turn on when it crosses the throttle line, it could be because the Distance and/or the MinSpeed are too big. If it turns on to early, it could be because the Distance and/or MinSpeed are too small. &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; ***Precaution needs to be taken while tuning the auto takeoff. If the MinSpeed is too low, the prop could turn on while holding the aircraft***&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4339</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4339"/>
		<updated>2009-01-20T19:08:55Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is constantly drawn from the position of the aircraft to the bungee waypoint. This line is called the launch line. The launch line will stop updating once the speed of the plane exceeds the MinSpeed. Once the plane is launched, it will follow the launch line until it crosses the throttle line and if the speed is greater than the MinSpeed. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the correct position of the bungee, you should just be able to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4338</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4338"/>
		<updated>2009-01-20T19:01:44Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MinSpeed&amp;quot; value=&amp;quot;3&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;    &lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4321</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4321"/>
		<updated>2009-01-07T22:45:56Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, NumOfCorners, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4320</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4320"/>
		<updated>2009-01-07T22:43:35Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;_S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;_S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4319</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4319"/>
		<updated>2009-01-07T22:42:43Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Exceptions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ====&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exceptions ====&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has gotten to the bottom of the polygon and swept back. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4315</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4315"/>
		<updated>2009-01-07T18:11:21Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions|see below]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4314</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4314"/>
		<updated>2009-01-07T18:07:44Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([[#Exceptions]]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4313</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4313"/>
		<updated>2009-01-07T18:05:24Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used ([Exceptions see below]).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4312</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4312"/>
		<updated>2009-01-07T18:04:17Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4311</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4311"/>
		<updated>2009-01-07T18:04:03Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveySweepDef.png|Sweep Definition&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveySweepBack.png|Sweeping Back&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4310</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4310"/>
		<updated>2009-01-07T18:03:19Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4309</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4309"/>
		<updated>2009-01-07T18:03:04Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Exceptions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4308</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4308"/>
		<updated>2009-01-07T18:01:38Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Polygon Survey */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
== Explanation ==&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exceptions ==&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4307</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4307"/>
		<updated>2009-01-07T18:00:28Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Polygon Survey */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby before it starts to sweep back up the polygon for the first time.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4306</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4306"/>
		<updated>2009-01-07T17:58:59Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Polygon Survey */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(EntryWP, CornerNum, SweepWidth, Orientation)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a couple of built in variables which can be used to exit the routine with an exception. PolySurveySweepNum gives the number of sweeps the aircraft has made and PolySurveySweepBackNum gives the number of times the aircraft has covered the polygon with the given sweep width. The first example would deroute the aircraft to standby after the aircraft made it's second sweep. The second example would deroute the aircraft to standby after the first time it covers the whole polygon.&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepNum &amp;gt;= 2&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;exception cond=&amp;quot;PolySurveySweepBackNum &amp;gt;= 1&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 45)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4305</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4305"/>
		<updated>2009-01-07T17:52:40Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon unless the user manually exits the block or unless an exception is used (talked about below).&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4304</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4304"/>
		<updated>2009-01-07T17:09:06Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Bungee Takeoff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4303</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4303"/>
		<updated>2009-01-07T16:33:24Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then add this navigation routine in your flight plan like so... &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4302</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4302"/>
		<updated>2009-01-07T16:31:53Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
Here is how to use this navigation routine in a flight plan. &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;A Range of Different Sweep Orientations&amp;quot;&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
Image:PolySurvey90DegreeEx.png|90 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4301</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4301"/>
		<updated>2009-01-07T16:29:20Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
Here is how to use this navigation routine in a flight plan. &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurvey0DegreeEx.png|0 Degrees&lt;br /&gt;
Image:PolySurvey30DegreeEx.png|30 Degrees&lt;br /&gt;
Image:PolySurvey65DegreeEx.png|65 Degrees&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey90DegreeEx.png&amp;diff=4300</id>
		<title>File:PolySurvey90DegreeEx.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey90DegreeEx.png&amp;diff=4300"/>
		<updated>2009-01-07T16:28:08Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey65DegreeEx.png&amp;diff=4299</id>
		<title>File:PolySurvey65DegreeEx.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey65DegreeEx.png&amp;diff=4299"/>
		<updated>2009-01-07T16:27:52Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey30DegreeEx.png&amp;diff=4298</id>
		<title>File:PolySurvey30DegreeEx.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey30DegreeEx.png&amp;diff=4298"/>
		<updated>2009-01-07T16:27:35Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey0DegreeEx.png&amp;diff=4297</id>
		<title>File:PolySurvey0DegreeEx.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurvey0DegreeEx.png&amp;diff=4297"/>
		<updated>2009-01-07T16:27:15Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4296</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4296"/>
		<updated>2009-01-07T16:25:38Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
[[Image:PolySurveySweepDef.png|thumb|Sweep Definition]]&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveyEntryPic.png|thumb|Entry Point]]&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
[[Image:PolySurveySweepBack.png|thumb|Sweeping Back]]&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
Here is how to use this navigation routine in a flight plan. &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurveySweepBack.png&amp;diff=4295</id>
		<title>File:PolySurveySweepBack.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurveySweepBack.png&amp;diff=4295"/>
		<updated>2009-01-07T16:24:55Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:PolySurveySweepDef.png&amp;diff=4294</id>
		<title>File:PolySurveySweepDef.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:PolySurveySweepDef.png&amp;diff=4294"/>
		<updated>2009-01-07T16:22:33Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4293</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4293"/>
		<updated>2009-01-07T16:10:02Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* Polygon Survey */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
Here is how to use this navigation routine in a flight plan. &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4292</id>
		<title>Advanced Navigation Routines</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=4292"/>
		<updated>2009-01-07T16:09:08Z</updated>

		<summary type="html">&lt;p&gt;Bubbajobob: /* [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM Team] Navigation Routines ==&lt;br /&gt;
=== Flower ===&lt;br /&gt;
[[Image:FlowerScreenShot.png|thumb|Screen shot of flower routine]]&lt;br /&gt;
The flower navigation routine flies the aircraft in a flower pattern defined by two waypoints. The center waypoint defines the center of the flower and the altitude the plane flies at. The edge waypoint defines the radius of the flower. &lt;br /&gt;
To use this navigation routine, you need to include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add flower to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Flower&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializeFlower(WP_Center,WP_Edge)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;FlowerNav()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bungee Takeoff ===&lt;br /&gt;
The bungee takeoff routine helps to automate takeoff by turning the throttle on after the bungee has been release from the hook. The only waypoint you need for this routine is the position of where the bungee is pegged to the ground. Using this waypoint, a line is drawn from the position of the aircraft (when the routine is initialized) to the bungee waypoint. This line is called the launch line. When the plane is released, it follows the launch line with the throttle off until it crosses the throttle line. The throttle line is a line perpendicular to the launch line at a distance d from the bungee waypoint (see the diagram below). When the plane crosses the throttle line, the throttle comes on. After the throttle comes on, the plane keeps going straight until it reaches a specified speed and altitude above the bungee waypoint altitude. When it reaches the takeoff speed and takeoff altitude, the next block in the flight plan is executed. The takeoff speed, takeoff altitude and the distance d from the bungee waypoint are specified in the airframe file. You will need to add those values to your airframe file like this...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;Takeoff&amp;quot; prefix=&amp;quot;Takeoff_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Height&amp;quot; value=&amp;quot;30&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Speed&amp;quot; value=&amp;quot;15&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;Distance&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;m&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use this navigation routine, include OSAMNav.h in your flight plan and OSAMNav.c to your airframe file. Then you can add the bungee takeoff routine to your flight plan like so...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;InitializeBungeeTakeoff(WP_Bungee)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;BungeeTakeoff()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stage bungeetakeoff has also been added to Flightplan.dtd so you can also use the bungee takeoff routine like this.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_button=&amp;quot;Takeoff (wp CLIMB)&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;bungeetakeoff BungeeWP=&amp;quot;Bungee&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you are ready to use bungee takeoff, and you have the plane on the bungee ready to go, select the takeoff block to initialize the routine. You will know that the routine is successfully initialized when a line is drawn from the plane to the bungee. The only other thing to consider is that you may have to tune the distance from the bungee to the throttle line for consistent success.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:BungeeTakeoffDiagram.png|Bungee takeoff diagram&lt;br /&gt;
Image:BungeeTakeoffInit.png|After bungee takeoff initialization&lt;br /&gt;
Image:BungeeTakeoffThrottleOn.png|After crossing the throttle line&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Polygon Survey ===&lt;br /&gt;
With this navigation routine, an aircraft can survey the area of any [http://en.wikipedia.org/wiki/Convex_polygon convex polygon] given an entry point, the number of waypoints which define the polygon, the sweep width and the desired orientation of the sweeps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
Image:PolySurveyEntryPic.png|Entry Point&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The entry point is the first corner of the polygon and the point at which the aircraft will begin surveying the area. When in the entry state, the aircraft will circle around the entry point in order to smoothly transition into the first sweep. The aircraft will also keep circling around the entry point until it gets to the waypoint altitude. After the first sweep is made, the direction of the next sweep is determined by the distance of the entry point to the edges of the polygon. If there is more area above the first sweep, the aircraft will sweep up. If there is more area below the first sweep, the aircraft will sweep down.&lt;br /&gt;
&lt;br /&gt;
The aircraft will keep sweeping back and forth until it reaches the end of the polygon. At this point, the aircraft will sweep back up/down the polygon halfway in between the sweeps previously made by the aircraft (just like the rectangle survey function). The aircraft will keep sweeping up and down the polygon until the user manually switches to another block.&lt;br /&gt;
&lt;br /&gt;
The orientation of the sweeps can ranges from north south to east west and any where in between (0-90 degrees respectively). The side of the polygon the aircraft starts on (ex. north or south)  is determined by the side of the polygon the entry point is located. &lt;br /&gt;
&lt;br /&gt;
Here is how to use this navigation routine in a flight plan. &lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Poly Survey&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;InitializePolygonSurvey(WP_S1, 5, 200, 17)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;PolygonSurvey()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are the entry waypoint, the number of waypoints in the polygon, the sweep width (meters), and the desired orientation of the sweeps (degrees). The maximum number of waypoints a polygon can have is currently ten (can be changed in the code). If the number of waypoints in the polygon exceeds the maximum number, the routine will exit and move to the next block in the flight plan. The routine will also exit if the orientation is not between 0 and 90 degrees.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how you should declare each of the corners of the polygon.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S1&amp;quot; x=&amp;quot;-546.2&amp;quot; y=&amp;quot;297.4&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S2&amp;quot; x=&amp;quot;-129.8&amp;quot; y=&amp;quot;744.1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1553.0&amp;quot; name=&amp;quot;S3&amp;quot; x=&amp;quot;1030.5&amp;quot; y=&amp;quot;535.5&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S4&amp;quot; x=&amp;quot;523.0&amp;quot; y=&amp;quot;-236.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;waypoint alt=&amp;quot;1453.0&amp;quot; name=&amp;quot;S5&amp;quot; x=&amp;quot;-285.9&amp;quot; y=&amp;quot;-255.7&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
S1 is the entry waypoint and the first corner. The other corners should be in order clockwise or counter clockwise around the polygon. Even though this group of waypoints must be declared together, where the group appears in the list of waypoints doesn't matter.&lt;br /&gt;
&lt;br /&gt;
If you want the edges of the polygon to show up on the GCS, you can also declare the polygon as a sector. This is not required to run the routine.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;PolySector&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S4&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;S5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bubbajobob</name></author>
	</entry>
</feed>