<?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=Alonsoac</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=Alonsoac"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Alonsoac"/>
	<updated>2026-05-19T12:11:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=19320</id>
		<title>JTAG</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=19320"/>
		<updated>2014-12-26T21:21:28Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Upgrade BMP firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A JTAG interface is designed for on-chip debugging. It can also be used to flash your firmware if you do not have a means to upload software via USB already. For short, if you want to upload your own software or want to do serious paparazzi development work, the you need a JTAG adapter like this.&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
* [[FirmwareFlashing#JTAG|firmware flashing via JTAG]]&lt;br /&gt;
* [[DevGuide/JTAG-Debug|debugging with JTAG]]&lt;br /&gt;
&lt;br /&gt;
==JTAG Adapters==&lt;br /&gt;
There are multiple Paparazzi-compatible devices available that support JTAG.&lt;br /&gt;
&lt;br /&gt;
Below you find a list of JTAG devices that you can use in combination with e.g. a Paparazzi Lisa/M board. &lt;br /&gt;
&lt;br /&gt;
=== FLOSS JTAG ===&lt;br /&gt;
 &lt;br /&gt;
The FLOSS JTAG is based on an FTDI chip that allows two simultaneous USB connections, which means that FLOSS JTAG allows JTAG and UART/COM connections.&lt;br /&gt;
&lt;br /&gt;
Let's take a look at upper side of the board. It contains JTAG connector (which is connected on photo) and two sets of RX/TX LEDs for JTAG and UART/COM interface separately. The JTAG connector is 2x5 pins, 0.05-inch pitch, and is compatible with the Samtec FFSD-05-D-06.00-01-N-RW-R ribbon cable.&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-up.jpg]]&lt;br /&gt;
&lt;br /&gt;
On the other side of the board there is 4 pin UART/COM connector, which contains (from top to bottom in the image below): Ground (black), RX (orange), TX (yellow), and +5V (red)&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-down.jpg]]&lt;br /&gt;
&lt;br /&gt;
Usage of board is pretty simple: JTAG can be used to upload firmware into the board and/or repair board with broken bootloader, and UART/COM interfaced can be used to make &amp;quot;COM port style&amp;quot; connection to the board. COM connection can be used for example for telemetry debug.&lt;br /&gt;
&lt;br /&gt;
More info available on the [http://randomprojects.org/wiki/Floss-JTAG randomprojects.org wiki].&lt;br /&gt;
&lt;br /&gt;
=== Black Magic Probe ===&lt;br /&gt;
&lt;br /&gt;
[[Image:BMPM_1_top.jpg|500x500px]][[Image:BMPM_1_bottom.jpg|500x500px]]&lt;br /&gt;
&lt;br /&gt;
Some additional info about the Black Magic Probe is available at the [http://www.blacksphere.co.nz/main/blackmagic Black Sphere Technology website].&lt;br /&gt;
&lt;br /&gt;
To use Black Magic Probe instead of FLOSS-JTAG or Luftboot for firmware flashing, append the following string to the upload command:&lt;br /&gt;
&lt;br /&gt;
On Linux:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/ttyACM0&lt;br /&gt;
On Mac OS:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/cu.usbmodem&amp;lt;serial&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make this the default flash method add this in the airframe file firmware section:&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG_BMP&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;BMP_PORT&amp;quot; value=&amp;quot;/dev/ttyACM0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for other methods.&lt;br /&gt;
&lt;br /&gt;
==== Benefits ====&lt;br /&gt;
&lt;br /&gt;
There are good reasons to use the Black Magic Probe Mini instead of FLOSS-JTAG:&lt;br /&gt;
&lt;br /&gt;
*Lower cost&lt;br /&gt;
*No need for OpenOCD as BMPM has a built in GDB server&lt;br /&gt;
*Orders of magnitude faster as all the high speed protocol logic happens on the built-in STM32&lt;br /&gt;
*Supports Serial Wire Debug (SWD)&lt;br /&gt;
*Supports tracing using the SWD trace pin&lt;br /&gt;
*No need for loading and unloading of FTDI drivers on Mac OS X&lt;br /&gt;
&lt;br /&gt;
====UART port====&lt;br /&gt;
The pinout for the UART port on the back side of the BMP as seen on the image above and starting from the top is ground,rx,tx,3.3v . You can use this for receiving telemetry.&lt;br /&gt;
&lt;br /&gt;
====Upgrade BMP firmware====&lt;br /&gt;
&lt;br /&gt;
Check firmware version:&lt;br /&gt;
 $ sudo /usr/bin/arm-none-eabi-gdb&lt;br /&gt;
 (gdb)  target extended-remote /dev/ttyACM0&lt;br /&gt;
 (gdb)  monitor version&lt;br /&gt;
&lt;br /&gt;
To upgrade the brain of your Black Magic Probe, a.k.a. its firmware:&lt;br /&gt;
&lt;br /&gt;
 - Download the compiled firmware from http://blacksphere.co.nz/builds/  (more info at https://github.com/blacksphere/blackmagic/wiki/Frequently-Asked-Questions)&lt;br /&gt;
 - Download and run the stm32_mem.py script:&lt;br /&gt;
   $ git clone git://blackmagicdebug.git.sourceforge.net/gitroot/blackmagicdebug/blackmagicdebug&lt;br /&gt;
   $ cd blackmagicdebug/src/scripts&lt;br /&gt;
   $ ./stm32_mem.py blackmagic-XXXX.bin   (this is the .bin file you downloaded in previous step)&lt;br /&gt;
&lt;br /&gt;
=== FT2232H Mini Module ===&lt;br /&gt;
&lt;br /&gt;
Use ftdi prog to change the Description String into: FLOSS-JTAG. &amp;lt;br/&amp;gt;&lt;br /&gt;
More information for this board at [[Serial_Adapter]].&lt;br /&gt;
[[File:AlternativeFlossJtag.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=19319</id>
		<title>JTAG</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=19319"/>
		<updated>2014-12-26T21:14:22Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Upgrade BMP firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A JTAG interface is designed for on-chip debugging. It can also be used to flash your firmware if you do not have a means to upload software via USB already. For short, if you want to upload your own software or want to do serious paparazzi development work, the you need a JTAG adapter like this.&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
* [[FirmwareFlashing#JTAG|firmware flashing via JTAG]]&lt;br /&gt;
* [[DevGuide/JTAG-Debug|debugging with JTAG]]&lt;br /&gt;
&lt;br /&gt;
==JTAG Adapters==&lt;br /&gt;
There are multiple Paparazzi-compatible devices available that support JTAG.&lt;br /&gt;
&lt;br /&gt;
Below you find a list of JTAG devices that you can use in combination with e.g. a Paparazzi Lisa/M board. &lt;br /&gt;
&lt;br /&gt;
=== FLOSS JTAG ===&lt;br /&gt;
 &lt;br /&gt;
The FLOSS JTAG is based on an FTDI chip that allows two simultaneous USB connections, which means that FLOSS JTAG allows JTAG and UART/COM connections.&lt;br /&gt;
&lt;br /&gt;
Let's take a look at upper side of the board. It contains JTAG connector (which is connected on photo) and two sets of RX/TX LEDs for JTAG and UART/COM interface separately. The JTAG connector is 2x5 pins, 0.05-inch pitch, and is compatible with the Samtec FFSD-05-D-06.00-01-N-RW-R ribbon cable.&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-up.jpg]]&lt;br /&gt;
&lt;br /&gt;
On the other side of the board there is 4 pin UART/COM connector, which contains (from top to bottom in the image below): Ground (black), RX (orange), TX (yellow), and +5V (red)&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-down.jpg]]&lt;br /&gt;
&lt;br /&gt;
Usage of board is pretty simple: JTAG can be used to upload firmware into the board and/or repair board with broken bootloader, and UART/COM interfaced can be used to make &amp;quot;COM port style&amp;quot; connection to the board. COM connection can be used for example for telemetry debug.&lt;br /&gt;
&lt;br /&gt;
More info available on the [http://randomprojects.org/wiki/Floss-JTAG randomprojects.org wiki].&lt;br /&gt;
&lt;br /&gt;
=== Black Magic Probe ===&lt;br /&gt;
&lt;br /&gt;
[[Image:BMPM_1_top.jpg|500x500px]][[Image:BMPM_1_bottom.jpg|500x500px]]&lt;br /&gt;
&lt;br /&gt;
Some additional info about the Black Magic Probe is available at the [http://www.blacksphere.co.nz/main/blackmagic Black Sphere Technology website].&lt;br /&gt;
&lt;br /&gt;
To use Black Magic Probe instead of FLOSS-JTAG or Luftboot for firmware flashing, append the following string to the upload command:&lt;br /&gt;
&lt;br /&gt;
On Linux:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/ttyACM0&lt;br /&gt;
On Mac OS:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/cu.usbmodem&amp;lt;serial&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make this the default flash method add this in the airframe file firmware section:&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG_BMP&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;BMP_PORT&amp;quot; value=&amp;quot;/dev/ttyACM0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for other methods.&lt;br /&gt;
&lt;br /&gt;
==== Benefits ====&lt;br /&gt;
&lt;br /&gt;
There are good reasons to use the Black Magic Probe Mini instead of FLOSS-JTAG:&lt;br /&gt;
&lt;br /&gt;
*Lower cost&lt;br /&gt;
*No need for OpenOCD as BMPM has a built in GDB server&lt;br /&gt;
*Orders of magnitude faster as all the high speed protocol logic happens on the built-in STM32&lt;br /&gt;
*Supports Serial Wire Debug (SWD)&lt;br /&gt;
*Supports tracing using the SWD trace pin&lt;br /&gt;
*No need for loading and unloading of FTDI drivers on Mac OS X&lt;br /&gt;
&lt;br /&gt;
====UART port====&lt;br /&gt;
The pinout for the UART port on the back side of the BMP as seen on the image above and starting from the top is ground,rx,tx,3.3v . You can use this for receiving telemetry.&lt;br /&gt;
&lt;br /&gt;
====Upgrade BMP firmware====&lt;br /&gt;
&lt;br /&gt;
To upgrade the brain of your Black Magic Probe, a.k.a. its firmware:&lt;br /&gt;
&lt;br /&gt;
 - Download the compiled firmware from http://blacksphere.co.nz/builds/  (more info at https://github.com/blacksphere/blackmagic/wiki/Frequently-Asked-Questions)&lt;br /&gt;
 - Download and run the stm32_mem.py script:&lt;br /&gt;
   $ git clone git://blackmagicdebug.git.sourceforge.net/gitroot/blackmagicdebug/blackmagicdebug&lt;br /&gt;
   $ cd blackmagicdebug/src/scripts&lt;br /&gt;
   $ ./stm32_mem.py blackmagic-XXXX.bin   (this is the .bin file you downloaded in previous step)&lt;br /&gt;
&lt;br /&gt;
=== FT2232H Mini Module ===&lt;br /&gt;
&lt;br /&gt;
Use ftdi prog to change the Description String into: FLOSS-JTAG. &amp;lt;br/&amp;gt;&lt;br /&gt;
More information for this board at [[Serial_Adapter]].&lt;br /&gt;
[[File:AlternativeFlossJtag.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Module/Airspeed_ETS&amp;diff=19305</id>
		<title>Module/Airspeed ETS</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Module/Airspeed_ETS&amp;diff=19305"/>
		<updated>2014-12-21T02:25:46Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
[[Image:Ets_airspeed_v3.jpg|thumb|right|Eagletree Airspeed v3]]&lt;br /&gt;
&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Modules&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The EagleTree Airspeed Sensor is a low cost module and comes with a good [http://en.wikipedia.org/wiki/Pitot_tube pitot tube] (Prandtl style, pitot-static tube) that includes static and dynamic ports. It has an I²C interface that connects directly to the Autopilot I²C port.&lt;br /&gt;
&lt;br /&gt;
NOTE: the sensor has two operating modes which determine what value is sent to the autopilot. In the default mode the pressure diference between the 2 ends of the pitot is sent. Supposedly this could be used to calculate airspeed but in reality temperature must also be taken into account. The rest of this page assumes that a temperature reading is not needed and the usefullness is in question. Do not use it for any serious stuff.&amp;lt;BR&amp;gt;&lt;br /&gt;
In the other mode, called &amp;quot;third party mode&amp;quot;, the actual speed value is sent as shown in the sensor. The sensor is said by the manufacturer to take temperature into account to arrive at this value so this should be used as the correct speed. Unfortunately the Paparazzi code does not work in this mode and additional hardware (an EagleTree elogger) is needed to put the sensor in this mode.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||Module name||sensors/airspeed_ets&lt;br /&gt;
|-&lt;br /&gt;
|Sensor type&lt;br /&gt;
|air speed&lt;br /&gt;
|-&lt;br /&gt;
|Range&lt;br /&gt;
|4m/s .. 150m/s&lt;br /&gt;
|-&lt;br /&gt;
|Resolution&lt;br /&gt;
|0.3m/s&lt;br /&gt;
|-&lt;br /&gt;
|Refresh rate&lt;br /&gt;
|10Hz&lt;br /&gt;
|-&lt;br /&gt;
|I2C address&lt;br /&gt;
|0xEA&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://www.eagletreesystems.com/Support/manuals/airspeed-v3.pdf Product data sheet]&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
&lt;br /&gt;
The sensor can directly be connected to an I2C port of and autopilot. The + supply voltage can be between 3V and 16V. &lt;br /&gt;
&lt;br /&gt;
When you buy the airspeed sensor it is set to operate in the default mode. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''Caution!'''&amp;lt;/span&amp;gt; Make sure you did not set it somehow to 3rd party mode.&lt;br /&gt;
&lt;br /&gt;
== Wiring ==&lt;br /&gt;
&lt;br /&gt;
The ETS Airspeed sensor has an I2C cable with the following layout:&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''Tiny/TWOG I2C pin'''||'''Autopilot I2C'''||'''ETS Airspeed wire colour'''&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|GND&lt;br /&gt;
|white&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| +5V&lt;br /&gt;
|red&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| +3.3V&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|SDA&lt;br /&gt;
|yellow&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|SCL&lt;br /&gt;
|brown&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please refer to your boards documentation to find out the correct pinout on your board (which cable to connect to which pin). &lt;br /&gt;
As an example the correct pinout for the TWOG v1.0 and Tiny has been given in the table above.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
To use it load the ''airspeed_ets'' module:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;airspeed_ets.xml&amp;quot; /&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Depending on your board and the I2C interface you are using, you may need to&lt;br /&gt;
enable I2CX, where X is 0,1,2,etc., if you are not using it already:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_I2C0&amp;quot; /&amp;gt; &amp;lt;!-- In case you attached the ETS module to I2C0 --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_I2C1&amp;quot; /&amp;gt; &amp;lt;!-- In case you attached the ETS module to I2C1 --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_I2C2&amp;quot; /&amp;gt; &amp;lt;!-- In case you attached the ETS module to I2C2 --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_I2C3&amp;quot; /&amp;gt; &amp;lt;!-- In case you attached the ETS module to I2C3 --&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
You can also set some '''optional parameters to change the default configuration'''. &lt;br /&gt;
For example to use I2C1 instead of I2C0, a scale of 1.44 (default is 1.8) and offset of 50 (default is 0) is needed:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    &amp;lt;load name=&amp;quot;airspeed_ets.xml&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- Applies if another I2C interface than IC20 is used --&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;AIRSPEED_ETS_SCALE&amp;quot;   value=&amp;quot;1.44&amp;quot;/&amp;gt; &lt;br /&gt;
      &amp;lt;define name=&amp;quot;AIRSPEED_ETS_OFFSET&amp;quot;  value=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;AIRSPEED_ETS_I2C_DEV&amp;quot; value=&amp;quot;i2c1&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Usage as sensor for speed control ==&lt;br /&gt;
&lt;br /&gt;
To use the sensor to control the speed of your aircraft add the aggressive climb flag, define which I2C device you are enabling and enable airspeed control:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;target name=&amp;quot;ap&amp;quot; board=&amp;quot;twog_1.0&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AGR_CLIMB&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_I2C0&amp;quot;/&amp;gt;     &amp;lt;!-- Details: see above --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_AIRSPEED&amp;quot;/&amp;gt; &amp;lt;!-- Use the airspeed sensor in the control loop --&amp;gt;&lt;br /&gt;
  &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration ===&lt;br /&gt;
 &lt;br /&gt;
Now to use real airspeed values for adjusting your aircrafts autopilot behavior there are several way to accomplish this. A simple classic way is to add the following to the end of the &amp;quot;VERTICAL CONTROL&amp;quot; section of your airframe file:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;VERTICAL_CONTROL&amp;quot; prefix=&amp;quot;V_CTL_&amp;quot;&amp;gt;&lt;br /&gt;
    ....&lt;br /&gt;
    &amp;lt;!-- auto airspeed and altitude inner loop (for airspeed sensor) --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_AIRSPEED_SETPOINT&amp;quot; value=&amp;quot;13.0&amp;quot;  unit=&amp;quot;m/s&amp;quot; /&amp;gt; &amp;lt;!-- SETPOINT values may need to be adjusted to suit your aircraft --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_AIRSPEED_PGAIN&amp;quot;    value=&amp;quot;0.060&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_AIRSPEED_IGAIN&amp;quot;    value=&amp;quot;0.050&amp;quot; /&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_GROUNDSPEED_SETPOINT&amp;quot; value=&amp;quot;7.0&amp;quot;  unit=&amp;quot;m/s&amp;quot; /&amp;gt; &amp;lt;!-- SETPOINT values may need to be adjusted to suit your aircraft --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_GROUNDSPEED_PGAIN&amp;quot;    value=&amp;quot;0.75&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_GROUNDSPEED_IGAIN&amp;quot;    value=&amp;quot;0.25&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
  &lt;br /&gt;
Note that the SETPOINT values may need to be adjusted to suit your aircraft.&lt;br /&gt;
&lt;br /&gt;
Note that depending on whether you set the AIRSPEED setpoint or the GROUNDSPEED setpoint higher, either constant airspeed or constant groundspeed, respectively, will be the goal of the controller.&lt;br /&gt;
&lt;br /&gt;
See paparazzi/conf/airframes/easystar_ets_example.xml for an example airframe configuration.&lt;br /&gt;
&lt;br /&gt;
Better even is to start using ETECS, '''E'''nhanced '''T'''otal '''E'''nergy '''C'''ontrol '''S'''ystem&lt;br /&gt;
&lt;br /&gt;
Take a look at See paparazzi/conf/airframes/MentorEnergy.xml for an example airframe configuration.&lt;br /&gt;
&lt;br /&gt;
=== Debugging and logging the airspeed values ===&lt;br /&gt;
&lt;br /&gt;
To debug or log the raw values from the ETS airspeed sensor define SENSOR_SYNC_SEND in your airframe file to send the message AIRSPEED_ETS on every sensor reading. &lt;br /&gt;
Note that defining this sends the AIRSPEED_ETS message at the sensor read rate as defined in conf/modules/airspeed_ets.xml. &lt;br /&gt;
This does not have any bearing on the AIRSPEED message (if both SENSOR_SYNC_SEND and USE_AIRSPEED are defined, then both messages are sent). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''Caution!'''&amp;lt;/span&amp;gt; ''Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND''&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    &amp;lt;load name=&amp;quot;airspeed_ets.xml&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SENSOR_SYNC_SEND&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The general airspeed can be displayed in the Messages tool by adding the AIRSPEED message to the telemetry file as follows:&lt;br /&gt;
{{Box Code|conf/telemetry/default.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Ap&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;AIRSPEED&amp;quot; period=&amp;quot;1.0&amp;quot;/&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The AIRSPEED_ETS message does NOT need to be added to the telemetry configuration since it is sent directly by the module if SENSOR_SYNC_SEND is defined.&lt;br /&gt;
&lt;br /&gt;
=== NOTES ===&lt;br /&gt;
# In the GCS, the strip displays ground speed and '''not''' airspeed by default. In order to display airspeed, drag-and-drop the airspeed message field from the Messages tool onto the 2D map of the GCS. &lt;br /&gt;
# The telemetry name AIRSPEED&amp;quot;  should actually be called SPEED and contains Groundspeed and airspeed return values.&lt;br /&gt;
&lt;br /&gt;
== Measurement only ==&lt;br /&gt;
&lt;br /&gt;
To use the  sensor for airspeed measurement is also possible. This Measurement only mode does thus not imput to the control loops to have effect to the aircraft behaviour.&lt;br /&gt;
&lt;br /&gt;
To see the sensors data in the log file set the SENSOR_SYNC_SEND in your airframe file. Every time new data is available it will be sent directly.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    &amp;lt;load name=&amp;quot;airspeed_ets.xml&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SENSOR_SYNC_SEND&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''Caution!'''&amp;lt;/span&amp;gt; ''Please note: if you are using the master branch and have merged commits on or later than July 16, 2013, please replace SENSOR_SYNC_SEND with AIRSPEED_ETS_SYNC_SEND''&lt;br /&gt;
&lt;br /&gt;
===Result message===&lt;br /&gt;
&lt;br /&gt;
The raw data (adc), estimated offset at init time (offset) and the converted result (scaled) is written to the log file.&lt;br /&gt;
{{Box Code|conf/messages.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;message name=&amp;quot;AIRSPEED_ETS&amp;quot; id=&amp;quot;57&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;field name=&amp;quot;adc&amp;quot;    type=&amp;quot;uint16&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;field name=&amp;quot;offset&amp;quot; type=&amp;quot;uint16&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;field name=&amp;quot;scaled&amp;quot; type=&amp;quot;float&amp;quot;  /&amp;gt;&lt;br /&gt;
 &amp;lt;/message&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample log file lines&lt;br /&gt;
 149.529 123 AIRSPEED_ETS 1626 1606 8.024844&lt;br /&gt;
 149.633 123 AIRSPEED_ETS 1626 1606 8.024844&lt;br /&gt;
 149.730 123 AIRSPEED_ETS 1627 1606 7.942226&lt;br /&gt;
 149.841 123 AIRSPEED_ETS 1628 1606 7.942226&lt;br /&gt;
&lt;br /&gt;
=Issues= &lt;br /&gt;
&lt;br /&gt;
Some people report that the sensor only works after a fresh upload, not after a regular power on. Adding a AIRSPEED_ETS_START_DELAY setting could help getting it to work. For this to work need at least version 5.2 of Paparazzi.&lt;br /&gt;
&lt;br /&gt;
Add the following to your module part in your airframe XML document. Where ''value'' can be anything from 0.01 to 4seconds. Some users report that a value of 1 fixes the issue for them.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;load name=&amp;quot;airspeed_ets.xml&amp;quot;&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
   ...&lt;br /&gt;
   &amp;lt;define name=&amp;quot;AIRSPEED_ETS_START_DELAY&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/load&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=TCP_Aircraft_Server&amp;diff=18951</id>
		<title>TCP Aircraft Server</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=TCP_Aircraft_Server&amp;diff=18951"/>
		<updated>2014-08-20T02:35:39Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: document additional tcp methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Tools&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;tcp aircraft server&amp;lt;/tt&amp;gt; (in &amp;lt;tt&amp;gt;sw/tools/tcp_aircraft_server/&amp;lt;/tt&amp;gt;) is an agent that re-broadcasts the ivy telemetry stream from a specified vehicle over tcp to a specified remote ip which hosts its own local ground segment ivy network. This allows the broadcast of a vehicle telemetry stream over the internet to a remote party without the need for VPNs.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Broadcast Ground Station ===&lt;br /&gt;
&lt;br /&gt;
If you have not done so already, set your Paparazzi src and home directories:&lt;br /&gt;
&lt;br /&gt;
 export PAPARAZZI_SRC=~/path/to/paparazzi&lt;br /&gt;
 export PAPARAZZI_HOME=~/path/to/paparazzi&lt;br /&gt;
&lt;br /&gt;
Then, from your Paparazzi directory, run:&lt;br /&gt;
 ./sw/ground_segment/tmtc/ivy_tcp_aircraft -id &amp;lt;ac_id_number&amp;gt; -h &amp;lt;remote IP&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recipient Computer, option #1 ===&lt;br /&gt;
&lt;br /&gt;
Run:&lt;br /&gt;
 ./sw/tools/tcp_aircraft_server/tcp_aircraft_server.py&lt;br /&gt;
&lt;br /&gt;
Then open [[Paparazzi_Center|Paparazzi Center]] using the -n option for the [[Server]] unless you wish to log messages locally, and use the tools within Paparazzi Center as you would do normally.&lt;br /&gt;
&lt;br /&gt;
The recipient side of the setup broadcasts locally over the default Paparazzi ivy bus 127.255.255.255:2010&lt;br /&gt;
&lt;br /&gt;
=== Recipient Computer, option #2 ===&lt;br /&gt;
&lt;br /&gt;
This allows for a multiple tier control architecture. &lt;br /&gt;
&lt;br /&gt;
Designate one computer as the server and run these 2 programs. First one communicates with remote controllers and second one with ground stations.&lt;br /&gt;
&lt;br /&gt;
 ./sw/ground_segment/tmtc/broadcaster -f TM -t DL -p 4243&lt;br /&gt;
 ./sw/ground_segment/tmtc/broadcaster&lt;br /&gt;
&lt;br /&gt;
Designate the same or another or several other computers as remote controller and run:&lt;br /&gt;
 ./sw/ground_segment/tmtc/ivy_tcp_controller -h &amp;lt;ip address of server computer&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the controller open [[Paparazzi_Center|Paparazzi Center]] using the -n option for the [[Server]] unless you wish to log messages locally, and use the tools within Paparazzi Center as you would do normally.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can connect multiple ground stations to the same server.&lt;br /&gt;
&lt;br /&gt;
All of these programs accept a --help argument and will show more options.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: For this to work it is necessary to synchronize the compiled code in the aircraft, the controller and the ground station. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tools]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18786</id>
		<title>Subsystem/actuators</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18786"/>
		<updated>2014-06-28T04:14:28Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: fix MKK and add MKK v2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Subsystems&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This subsystem only needs be explicitly specified for rotorcrafts where there are several different actuators implementations and you have to add the correct one depending on the ESCs you use.&lt;br /&gt;
&lt;br /&gt;
Currently possible actuators subsystems are&lt;br /&gt;
* ''mkk''&lt;br /&gt;
* ''asctec''&lt;br /&gt;
* ''asctec_v2''&lt;br /&gt;
* ''pwm''&lt;br /&gt;
* ''skiron''&lt;br /&gt;
* ''heli''&lt;br /&gt;
* ''ardrone2''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MKK ==&lt;br /&gt;
Mikrokopter ESCs&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
   &amp;lt;subsystem name=&amp;quot;actuators&amp;quot;     type=&amp;quot;mkk&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;configure name=&amp;quot;MKK_I2C_SCL_TIME&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt; &amp;lt;!-- only LPC21xx, optional, 150 is default, use 50 for 8 motors--&amp;gt;&lt;br /&gt;
     &amp;lt;configure name=&amp;quot;ACTUATORS_MKK_I2C_DEV&amp;quot; value=&amp;quot;i2c1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;I2C_TRANSACTION_QUEUE_LEN&amp;quot; value=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- default is 8, increase to 10 or more for 8 motors--&amp;gt;&lt;br /&gt;
 &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* ''MKK_I2C_SCL_TIME'' is specific to LPC21x based boards (e.g. booz) and has no effect for STM32 based boards (e.g. Lisa/M/L)&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
 &lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;ACTUATORS_MKK&amp;quot; prefix=&amp;quot;ACTUATORS_MKK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&amp;lt;!-- number of motors --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADDR&amp;quot; value=&amp;quot;{ 0x52, 0x54, 0x56, 0x58 }&amp;quot;/&amp;gt;&amp;lt;!-- the I2C addresses of your motors --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEVICE&amp;quot; value=&amp;quot;i2c1&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
  &amp;lt;servos driver=&amp;quot;mkk&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;FRONT&amp;quot;  no=&amp;quot;0&amp;quot;    min=&amp;quot;0&amp;quot; neutral=&amp;quot;2&amp;quot; max=&amp;quot;255&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;RIGHT&amp;quot;  no=&amp;quot;1&amp;quot;    min=&amp;quot;0&amp;quot; neutral=&amp;quot;2&amp;quot; max=&amp;quot;255&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;BACK&amp;quot;   no=&amp;quot;2&amp;quot;    min=&amp;quot;0&amp;quot; neutral=&amp;quot;2&amp;quot; max=&amp;quot;255&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;LEFT&amp;quot;   no=&amp;quot;3&amp;quot;    min=&amp;quot;0&amp;quot; neutral=&amp;quot;2&amp;quot; max=&amp;quot;255&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
  &amp;lt;command_laws&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;motor_mixing_run(autopilot_motors_on,FALSE,values)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;FRONT&amp;quot;  value=&amp;quot;motor_mixing.commands[SERVO_FRONT]&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;BACK&amp;quot;   value=&amp;quot;motor_mixing.commands[SERVO_BACK]&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;RIGHT&amp;quot;  value=&amp;quot;motor_mixing.commands[SERVO_RIGHT]&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;LEFT&amp;quot;   value=&amp;quot;motor_mixing.commands[SERVO_LEFT]&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/command_laws&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The order of addresses in the list defines the numbering of motors! Warn on this during motor mixing!&lt;br /&gt;
&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
For Paparazzi versions  older than 5.0 MKK specific values for SUPERVISION defines:&lt;br /&gt;
* ''STOP_MOTOR'' : 0, optional, as the default is already 0&lt;br /&gt;
* ''MIN_MOTOR'' : 3&lt;br /&gt;
* ''MAX_MOTOR'' : 200&lt;br /&gt;
This does not apply to version 5.0 and above.&lt;br /&gt;
&lt;br /&gt;
== MKK v2 ==&lt;br /&gt;
&lt;br /&gt;
Similar to the above, this is version 2 of the MKK ESCs. The configuration is the same as above, just change mkk to mkk_v2 and MKK to MKK_V2.&lt;br /&gt;
&lt;br /&gt;
This also works with ESCs that have the SimonK firmware and that have I2C support. Very limited documentation is available at [https://github.com/sim-/tgy/ the github page]. It should be noted that you will need to compile and load the firmware for each motor as you will need to change the I2C address for each one to match the ADDR define. If you have success with this please post some more info here.&lt;br /&gt;
&lt;br /&gt;
== Asctec v1 ==&lt;br /&gt;
These controllers already to the mixing themselves, so the [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]] section is not needed.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Asctec v2 ==&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec_v2&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
You need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== PWM ==&lt;br /&gt;
Only for stm32 based autopilot boards (eg. Lisa/M, Lisa/L)&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;pwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The define ''SERVO_HZ'' sets a higher update frequency for the pwm controllers which is needed for good response times on some ESCs. Some newer ESCs are said to work better with lower frequencies. More information should be added here.&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;servos min=&amp;quot;0&amp;quot; neutral=&amp;quot;0&amp;quot; max=&amp;quot;0xff&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;FRONT&amp;quot; no=&amp;quot;0&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;BACK&amp;quot; no=&amp;quot;1&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;LEFT&amp;quot; no=&amp;quot;2&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;RIGHT&amp;quot; no=&amp;quot;3&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== Dual PWM ==&lt;br /&gt;
This driver allows you to generate dual pulses to control for example double servos like those :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual linear servos.jpg]]&lt;br /&gt;
&lt;br /&gt;
The signal we want to generate look like that :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual_pulse.png]]&lt;br /&gt;
&lt;br /&gt;
During the time of a regular pwm pulse (20ms) we got two parts :&lt;br /&gt;
* the first 1 with a total period of 4ms. During that part we generate the first pulse that is going to control for exemple the first servo.&lt;br /&gt;
* the first 2 with a total period of 16ms. During that part we generate the second pulse that is going to control for exemple the second servo.&lt;br /&gt;
&lt;br /&gt;
=== How to use the driver ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;This module is only implemented on the lisa M and lisa S boards at the time of writing this documentation (28 mars 2014)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all you are going to need to add the subsystem that is going to generate those pulses :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot;   board=&amp;quot;lisa_s_0.1&amp;quot;&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;dualpwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;DUAL_PWM_ON&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
Then we will be able to add a servo block into the airframe file (in the same way we would for regular servos). But we have to specify the driver that we are using for thoses servos :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
  &amp;lt;servos driver=&amp;quot;DualPwm&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;SWITCH&amp;quot;  no=&amp;quot;3&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;pitchator&amp;quot;  no=&amp;quot;2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;The tricky part about this module is that it requires the use of the full timer (that was previously shared between multiple regular pwm). In order to reduce the wast of pins we can only put that type of servos on specifics pins :&lt;br /&gt;
* lisa S (version 0.1) : on the servos 2 and 3 (as shown above). The dual PWM will then but outputted on the 5th pin (yes that is not logical).&lt;br /&gt;
* lisa M (version 2.0) : on the servos 4 and 5. The dual PWM will be outputted on the 4th pin.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Subsystems]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18785</id>
		<title>Subsystem/actuators</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18785"/>
		<updated>2014-06-28T02:36:29Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* XML configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Subsystems&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This subsystem only needs be explicitly specified for rotorcrafts where there are several different actuators implementations and you have to add the correct one depending on the ESCs you use.&lt;br /&gt;
&lt;br /&gt;
Currently possible actuators subsystems are&lt;br /&gt;
* ''mkk''&lt;br /&gt;
* ''asctec''&lt;br /&gt;
* ''asctec_v2''&lt;br /&gt;
* ''pwm''&lt;br /&gt;
* ''skiron''&lt;br /&gt;
* ''heli''&lt;br /&gt;
* ''ardrone2''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MKK ==&lt;br /&gt;
Mikrokopter ESCs&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
   &amp;lt;subsystem name=&amp;quot;actuators&amp;quot;     type=&amp;quot;mkk&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;configure name=&amp;quot;MKK_I2C_SCL_TIME&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt; &amp;lt;!-- only LPC21xx, optional, 150 is default, use 50 for 8 motors--&amp;gt;&lt;br /&gt;
   &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;I2C_TRANSACTION_QUEUE_LEN&amp;quot; value=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- default is 8, increase to 10 or more for 8 motors--&amp;gt;&lt;br /&gt;
 &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* ''MKK_I2C_SCL_TIME'' is specific to LPC21x based boards (e.g. booz) and has no effect for STM32 based boards (e.g. Lisa/M/L)&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
required defines in section ''ACTUATORS_MKK'':&lt;br /&gt;
* ''NB'': number of motors&lt;br /&gt;
* ''ADDR'': the I2C addresses of your motors&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;ACTUATORS_MKK&amp;quot; prefix=&amp;quot;ACTUATORS_MKK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADDR&amp;quot; value=&amp;quot;{ 0x52, 0x54, 0x56, 0x58 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The order of addresses in the list defines the numbering of motors! Warn on this during motor mixing!&lt;br /&gt;
&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
For Paparazzi versions  older than 5.0 MKK specific values for SUPERVISION defines:&lt;br /&gt;
* ''STOP_MOTOR'' : 0, optional, as the default is already 0&lt;br /&gt;
* ''MIN_MOTOR'' : 3&lt;br /&gt;
* ''MAX_MOTOR'' : 200&lt;br /&gt;
This does not apply to version 5.0 and above.&lt;br /&gt;
&lt;br /&gt;
== Asctec v1 ==&lt;br /&gt;
These controllers already to the mixing themselves, so the [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]] section is not needed.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Asctec v2 ==&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec_v2&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
You need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== PWM ==&lt;br /&gt;
Only for stm32 based autopilot boards (eg. Lisa/M, Lisa/L)&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;pwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The define ''SERVO_HZ'' sets a higher update frequency for the pwm controllers which is needed for good response times on some ESCs. Some newer ESCs are said to work better with lower frequencies. More information should be added here.&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;servos min=&amp;quot;0&amp;quot; neutral=&amp;quot;0&amp;quot; max=&amp;quot;0xff&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;FRONT&amp;quot; no=&amp;quot;0&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;BACK&amp;quot; no=&amp;quot;1&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;LEFT&amp;quot; no=&amp;quot;2&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;RIGHT&amp;quot; no=&amp;quot;3&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== Dual PWM ==&lt;br /&gt;
This driver allows you to generate dual pulses to control for example double servos like those :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual linear servos.jpg]]&lt;br /&gt;
&lt;br /&gt;
The signal we want to generate look like that :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual_pulse.png]]&lt;br /&gt;
&lt;br /&gt;
During the time of a regular pwm pulse (20ms) we got two parts :&lt;br /&gt;
* the first 1 with a total period of 4ms. During that part we generate the first pulse that is going to control for exemple the first servo.&lt;br /&gt;
* the first 2 with a total period of 16ms. During that part we generate the second pulse that is going to control for exemple the second servo.&lt;br /&gt;
&lt;br /&gt;
=== How to use the driver ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;This module is only implemented on the lisa M and lisa S boards at the time of writing this documentation (28 mars 2014)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all you are going to need to add the subsystem that is going to generate those pulses :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot;   board=&amp;quot;lisa_s_0.1&amp;quot;&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;dualpwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;DUAL_PWM_ON&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
Then we will be able to add a servo block into the airframe file (in the same way we would for regular servos). But we have to specify the driver that we are using for thoses servos :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
  &amp;lt;servos driver=&amp;quot;DualPwm&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;SWITCH&amp;quot;  no=&amp;quot;3&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;pitchator&amp;quot;  no=&amp;quot;2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;The tricky part about this module is that it requires the use of the full timer (that was previously shared between multiple regular pwm). In order to reduce the wast of pins we can only put that type of servos on specifics pins :&lt;br /&gt;
* lisa S (version 0.1) : on the servos 2 and 3 (as shown above). The dual PWM will then but outputted on the 5th pin (yes that is not logical).&lt;br /&gt;
* lisa M (version 2.0) : on the servos 4 and 5. The dual PWM will be outputted on the 4th pin.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Subsystems]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Lisa/M_v2.0&amp;diff=18782</id>
		<title>Lisa/M v2.0</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Lisa/M_v2.0&amp;diff=18782"/>
		<updated>2014-06-26T16:33:47Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Using JTAG */ add note about BMP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Autopilots&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:LisaM_V2_0_TopView.JPG|right|500px|Lisa/M V2.0 top view]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lisa/M is a small, general purpose autopilot designed with flexibility across multiple applications in mind. Small weight and size, with (optional) integrated [[AspirinIMU | Aspirin IMU]] and full size 0.1&amp;quot; servo headers make the Lisa/M suitable for both fixed-wing and rotorcraft vehicles. This autopilot is based on a STM32 processor for extensive peripheral connection and faster processing.&lt;br /&gt;
&lt;br /&gt;
A number of tutorials are being prepared for getting started with Lisa/M:&lt;br /&gt;
* [[Lisa/M/Tutorial/FixedWing|Fixedwing tutorial]]&lt;br /&gt;
* [[Lisa/M/Tutorial/RotorCraft|Rotorcraft tutorial]]&lt;br /&gt;
&lt;br /&gt;
Please join us in our quest to make the getting started information even more, eh... informative, by adjusting those pages with your own improvements.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
Lisa/M is based on the 64 pins STM32F105RCT6 [http://www.st.com/internet/mcu/product/221023.jsp connectivity line family] processor featuring 64k of RAM and 256k of FLASH. All the pins are exposed, providing access to the complete set of the STM32 peripherals.&lt;br /&gt;
NOTE: This MCU is different from LISA/L. Lisa/L is based on the 64 pins STM32F103RE processor featuring 64k of RAM and 512k of FLASH, which is part of the [http://www.st.com/internet/mcu/product/164485.jsp high-density performance line family].&lt;br /&gt;
&lt;br /&gt;
* STM32 microcontroller [http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00220364.pdf STM32F105RCT6 datasheet] with 256kB flash and 64kB RAM&lt;br /&gt;
* Pressure sensor [http://www.bosch-sensortec.com/content/language1/html/3477.htm BMP085] (optional as of 08/2012)&lt;br /&gt;
* 7 x Analog input channels&lt;br /&gt;
* 3 x Generic digital in-/out-puts&lt;br /&gt;
* 2 x 3.3V TTL UART (5V tolerant)&lt;br /&gt;
* 8 x Servo PPM outputs (only 6 if second I2C (I2C1) bus in use)&lt;br /&gt;
* 1 x CAN bus&lt;br /&gt;
* 1 x [http://en.wikipedia.org/wiki/Serial_Peripheral_Interface SPI] bus&lt;br /&gt;
* 1 x [http://en.wikipedia.org/wiki/I2c I&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;C] bus (2 x when using only the first 6 Servo PPM outputs)&lt;br /&gt;
* 1 x Micro USB&lt;br /&gt;
* 4 x status LEDs with attached test point&lt;br /&gt;
* 10.8 grams (0.4 oz) (with Aspirin IMU mounted)&lt;br /&gt;
* 9.9 grams (0.35 oz) (without Aspirin IMU mounted)&lt;br /&gt;
* ~34mm x ~60mm x ~10mm&lt;br /&gt;
* 4 layers PCB design&lt;br /&gt;
&lt;br /&gt;
With mounted Aspirin IMU has the following additional sensors on board:&lt;br /&gt;
&lt;br /&gt;
* 3 Axis Gyroscope&lt;br /&gt;
* 3 Axis Accelerometer&lt;br /&gt;
* 3 Axis Magnetometer&lt;br /&gt;
* Barometer MS5611 (as of Aspirin v2.1)&lt;br /&gt;
&lt;br /&gt;
NOTE:&lt;br /&gt;
'''Lisa/M has pads for the BMP085 pressure sensor. Lias/M 2 boards made before August 2012 had the BMP085 sensor mounted. Boards made after August 2012 do not have the sensor mounted as they are designed to be used with Aspirin 2.1 which has the new MS5611-01BA03 barometric pressure sensor.'''&lt;br /&gt;
&lt;br /&gt;
The drivers for the MS5611-01BA03 are '''work in progress''' and are available in the master branch of the Paparazzi codebase. All '''help''' with testing and improving the driver are '''very welcome'''!&lt;br /&gt;
&lt;br /&gt;
So, except for a GPS unit you have all necessary sensors for full attitude and altitude stabilization in an extremely small package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=200px heights=200px&amp;gt;&lt;br /&gt;
Image:LisaM_V2_0_TopView.JPG|Lisa/M V2.0 top view&lt;br /&gt;
Image:LisaM_V2_0_BottomView.JPG|Lisa/M V2.0 bottom view&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pinout ==&lt;br /&gt;
Pins Name and Type are specified with respect to the Autopilot Board.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 100%&amp;quot;&amp;gt;&lt;br /&gt;
[[Image:LisaM_V2_0_top_labeled.png|900px]]&lt;br /&gt;
[[Image:LisaM_warning_label.png|200px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''SERVO1/2/3/4/5/6/7/8'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||SERVOx||OUT||Servo signal (PWM)(See Note 1 below)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|2||SV||PWR||Servo Bus Voltage Rail (conf w/ JP1)||style=&amp;quot;background:red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''JTAG'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||N/A||N/A||JTAG Debug Header (Pin 1 is +3V3)||style=&amp;quot;background:white; color:black&amp;quot;|None&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART3'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2||V_IN||PWR||UART Voltage (conf w/ JP6 and JP7)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||TX||OUT||USART3 Serial Output (3.3V level)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|4||RX||IN||USART3 Serial Input (3.3V level)(Pullup to Pin 2 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART1/5'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot (conf w/ JP8 and JP9)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||RX1||IN||USART1 Serial Input (3.3V level)(Pullup to Pin 2 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|4||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|5|| +3V3||PWR||3.3V Rail from autopilot (conf w/ JP8 and JP9)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|6||RX5||IN||UART5 Serial Input (3.3V level)(Pullup to Pin 5 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''GPIO'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||PC12||I/O||GPIO, connected to PC12 (5V tolerant)||style=&amp;quot;background:#FDC579; color:black&amp;quot;|Dark Tan&lt;br /&gt;
|-&lt;br /&gt;
|5||TRST||I/O||JTAG_TRST (also connected to LED1 cathode)||style=&amp;quot;background:#FED6B1; color:black&amp;quot;|Light Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''ANALOG2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| +5V||PWR||5V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||ADC4||I/O||by default connected to LED_4 cathode (Remove LED/resistor to use as ADC4)||style=&amp;quot;background:magenta; color:white&amp;quot;|Magenta&lt;br /&gt;
|-&lt;br /&gt;
|5||ADC6||I/O||by default connected to LED_3 cathode (Remove LED/resistor to use as ADC6)||style=&amp;quot;background:#FFA1B2; color:black&amp;quot;|Pink&lt;br /&gt;
|-&lt;br /&gt;
|6||BOOT0||I/O||BOOT0||style=&amp;quot;background:grey; color:black&amp;quot;|Grey&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''USB'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||N/A||N/A||USB (The USB connections are also available as 0.05&amp;quot; (1.27mm) through hole pads underneath the GPIO header)||style=&amp;quot;background:white; color:black&amp;quot;|None&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''I2C1 CAN'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| V_BATT||PWR||V_BATT Bus on autopilot, voltage divider for V_BAT_MEAS, (conf w/ JP2 to connect to V_IN)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| V_IN||PWR||Connected to autopilot voltage regulator inputs (conf w/ JP1, JP2 and JP3)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||CANL||I/O||CANL (5V level)||style=&amp;quot;background:orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|5||CANH||I/O||CANH (5V level)||style=&amp;quot;background:yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|6||SCL||I/O||SCL (5V level)(See Note 1 below)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|7||SDA||I/O||SDA (5V level)(See Note 1 below)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''SPI1'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||MOSI||Out||MOSI||style=&amp;quot;background:orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|4||MISO||In||MISO||style=&amp;quot;background:yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|5||SCK||Out||SCK||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|6||SS||Out||SS||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|-&lt;br /&gt;
|7||DRDY||I/O||DRDY||style=&amp;quot;background:#FDC579; color:black&amp;quot;|Dark Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''ANALOG1'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| +5V||PWR||5V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||ADC1||In||ADC1 (or LED_6 if populated)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|5||ADC2||In||ADC2 (or LED_7 if populated)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|-&lt;br /&gt;
|6||ADC3||In||ADC3 (or LED_8 if populated)||style=&amp;quot;background:#FED6B1; color:black&amp;quot;|Light Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||UART Voltage (conf w/ JP4 and JP5)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||TX||OUT||USART2 Serial Output (3.3V level)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|4||RX||IN||USART2 Serial Input (3.3V level)('''NOT 5V TOLERANT''')(Pullup to Pin 2 voltage)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''I2C2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||SCL||I/O||SCL (3.3V level)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|4||SDA||I/O||SDA (3.3V level)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOTE 1''': SERVO7 and SERVO8 are directly connected to I2C1_SCL and I2C1_SDA lines. Therefore one has to choose, either use SERVO7 and SERVO8 '''OR''' have the I2C1 bus available, if that one needs to be used for whatever reason alongside the I2C2 bus. To use the servos 7 and 8 just set the  &amp;lt;define name=&amp;quot;USE_SERVOS_7AND8&amp;quot;/&amp;gt;  in your airframe file and you are good to go. For this to work one must make sure to have the latest Paparazzi sourcecode.&lt;br /&gt;
&lt;br /&gt;
=== LEDs ===&lt;br /&gt;
Lisa/M 2.0 has 5 LEDS (+1 power LED). There are 3 additional LEDs (LED_6, LED_7, LED_8) that are not populated by default (in favor of using ADC1-3 on the ANALOG1 connector).&lt;br /&gt;
By default the LEDs are use for:&lt;br /&gt;
; LED_1, red: ''SYS_TIME_LED'': blinks with 1Hz&lt;br /&gt;
; LED_2, green : ''AHRS_ALIGNER_LED'': blinks until the AHRS is aligned (gyro bias initilalized) and then stays on&lt;br /&gt;
; LED_3, green : ''GPS_LED'': blinking if trying to get a fix, on if 3D fix&lt;br /&gt;
; LED_4, red : ''RADIO_CONTROL_LED'': on if RC signal is ok&lt;br /&gt;
; LED_5, green : not set to anything by default&lt;br /&gt;
&lt;br /&gt;
=== Jumper Configuration ===&lt;br /&gt;
There are a number of jumpers on Lisa/M used to configure voltage levels and power input.&lt;br /&gt;
&lt;br /&gt;
The default configuration is UART3 VCC at V_IN, UART1/2/5 VCC at +3V3, with the V_SERVO servo voltage rail NOT connected to the autopilot V_IN rail, allowing one to power the autopilot and servos separately. The +5V regulator is NOT bypassed, allowing a regulated +5V on listed headers and for the CAN transceiver and I2C level shifter. The V_BATT connector is NOT connected to V_IN, so one can attach a battery voltage to the V_BATT pin to measure the battery voltage, if so desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=380px heights=205px&amp;gt;&lt;br /&gt;
Image:LisaM_V2_0_top_jumpers_and_leds.png | Lisa/M v2.0 Top Jumpers and LEDs&lt;br /&gt;
Image:LisaM_V2_0_bottom_jumpers.png | Lisa/M v2.0 Bottom Jumpers&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''Power Jumper Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP1||SERVO_BUS to V_IN||OPEN||Connects servo header voltage rail SERVO_BUS to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP2||V_BATT to V_IN||OPEN||Connects I2C1/CAN rail V_BATT to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP3||V_IN to +5V||OPEN||Connects autopilot input voltage V_IN rail to autopilot +5V rail, bypassing onboard 5V supply&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART3 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP6||UART3_VCC to V_IN||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART3 connector VCC to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP7||UART3_VCC to +3V3||OPEN||Connects UART3 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: UART3 GPS Connector is connected to V_IN, check your GPS input voltage before connecting!!!'''&lt;br /&gt;
&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP6 AND JP7 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART2 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP4||UART2_VCC to V_IN||OPEN||Connects UART2 connector VCC to autopilot input voltage V_IN rail '''SEE WARNING BELOW'''&lt;br /&gt;
|-&lt;br /&gt;
|JP5||UART2_VCC to +3V3||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART2 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: UART2 RX is NOT 5V TOLERANT. Thus, while possible to connect UART2_VCC to V_IN, DO NOT ATTEMPT THIS. Only use JP5 (the default).&lt;br /&gt;
&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP4 AND JP5 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART1 and UART5 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP8||UART1&amp;amp;5_VCC to V_IN||OPEN||Connects UART1 and UART5 connector VCC to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP9||UART1&amp;amp;5_VCC to +3V3||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART1 and UART5 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP8 AND JP9 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
There are additional jumpers on the board for expert or developer configurations, please see [[Lisa/M_v20#Schematic|schematic]] and [[Lisa/M_v20#Downloads|layout]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Powering the Board ===&lt;br /&gt;
&lt;br /&gt;
[[Image:LisaM_warning_label.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
The 3.3V regulator on Lisa/M is a [http://www.micrel.com/page.do?page=/product-info/products/mic5209.shtml MIC5209-3.3YM] capable of delivering up to 500mA. While it is possible to power this regulator with up to 16V, '''DO NOT''' do this. By default, the UART3 RX pin is pulled up to the input voltage V_IN. For this reason, 5V is the maximum input voltage. Note that the UART3 GPS Connector is connected to V_IN, check your GPS input voltage before connecting. If one desires to have V_IN at a higher voltage, the jumpers should be adjusted accordingly. As noted, this regulator can handle up to 16V, though experience has shown that this regulator can become very hot in operation with high input voltages, resulting in potential thermal shutdown while in flight. Depending on the expected current draw, it is best to power this regulator with a lower voltage. 5V is the perfect choice. &lt;br /&gt;
&lt;br /&gt;
The onboard 5V regulator on Lisa/M is a [http://www.national.com/pf/LP/LP2992.html LP2992], a low-noise, low-dropout linear regulator capable of delivering up to 250mA. This regulator can be bypassed with JP3, connecting the autopilot V_IN bus directly to the autopilot 5V bus if, for example, one is using an external 5V regulated supply, and a higher current is needed. Unless external use of 5V is required on the ANALOG1 and ANALOG2 headers, the only 5V usage onboard is for the CAN transceiver and the I2C1 level shifter.&lt;br /&gt;
&lt;br /&gt;
When measuring the supply voltage of a battery with the V_BATT pin (could be connected to V_IN through JP2), it is important to note the maximum voltage limit. The voltage divider on the board for measuring with a 3.3V ADC is --'''V_BAT'''--/\/\'''10k'''/\/\--'''V_BAT_MEAS'''--/\/\'''2k2'''/\/\--'''GND'''--. This means that the maximum allowable voltage on V_BATT is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V\_BAT_{max} = 3.3V*\frac{10k}{2.2k} = 15V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a higher voltage measurement is desired, another voltage divider is required off-board. Alternatively, one could modify the existing voltage divider (e.g. change 10k resistor to 22k to get 33V maximum). When checking if voltage exceeds the maximum, make sure to consider maximum battery voltage, not nominal voltage (e.g. 4.22V or so for a single lithium cell, not 3.7V nominal, so the maximum number of cells in series is 3, like a 3S LiPo pack).&lt;br /&gt;
&lt;br /&gt;
== Schematic ==&lt;br /&gt;
&amp;lt;gallery widths=250px heights=168px&amp;gt;&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_1.png | LisaM V2.0 Schematic Sheet 1/3&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_2.png | LisaM V2.0 Schematic Sheet 2/3&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_3.png | LisaM V2.0 Schematic Sheet 3/3&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples of Airborne Equipment Electrical Connections ==&lt;br /&gt;
&lt;br /&gt;
=== Quadrocopter, Spektrum Satellite Receivers, PWM Motor Controllers (ESC) and dedicated avionics Battery Elimination Circuit (BEC) ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_quadrocopter_spektrum_bec_pwmesc.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This is a recommended powering configuration. It eliminates the balancing issues of the built in BECs into the ESCs.&lt;br /&gt;
&lt;br /&gt;
The dotted lines from the BEC show the alternative wiring that does not require closing the VS jumper on the Lisa/M. The disadvantage is that you have to wire/crimp the BEC output wires into the picoblade molex connector providing the battery voltage reference. Usually it is easier to just use the existing &amp;quot;servo&amp;quot; connector on the BEC and closing the jumper instead.&lt;br /&gt;
&lt;br /&gt;
=== Quadrocopter, Spektrum Satellite Receivers and PWM Motor Controllers (ESC) ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_v2_0_wiring_quadrocopter_spektrum_pwmesc.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESCs have a battery eliminator circuit (BEC) function and provide 5 volts on their 5V pins. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Warning:&amp;lt;/span&amp;gt; The built in BECs on the ESCs are usually linear voltage regulators, they are fairly inefficient compared to dedicated BECs that are usually implemented as switching DC/DC converters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;Warning:&amp;lt;/span&amp;gt; Due to manufacturing differences of BECs, connecting more then one BEC in parallel will likely cause one of the BECs to take majority of the load and dissipate most of the drop down voltage. ([https://en.wikipedia.org/wiki/Linear_regulator Read on how linear voltage regulators work.]) As in this example the BECs are part of the ESCs, one of the ESCs will get warmer than the others, which in turn may lead to reliability issues.&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_quadrocopter_spektrum_pwmesc_shunts.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;Tip:&amp;lt;/span&amp;gt; To improve balancing between the ESC built in BECs you can add a 1Ohm resistor in the +5V line coming from the motor controller. This will cause some pre-loading of the voltage regulator and improve the load sharing between the BECs while decreasing the efficiency of the supply.&lt;br /&gt;
&lt;br /&gt;
When using cheap ATMega or SiLabs-based PWM motor controllers consider replacing their firmware with either [https://github.com/sim-/tgy Simon Kirby] or [https://github.com/bitdump/BLHeli BLHeli] firmware respectively to get useful performance of your multicopter! You can find a firmware compatibility list [https://docs.google.com/spreadsheet/ccc?key=0AhR02IDNb7_MdEhfVjk3MkRHVzhKdjU1YzdBQkZZRlE here].&lt;br /&gt;
&lt;br /&gt;
=== Quadrocopter, Spektrum Satellite Receivers and I2C Motor Controllers (ESC) ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_quadrocopter_spektrum_i2c_esc_wiring.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This diagram &amp;quot;should&amp;quot; be the same for AscTec as well as Mikrokopter motor controller based airframes.&lt;br /&gt;
&lt;br /&gt;
=== Fixedwing, Spektrum Satellite Receivers and Elevons Only ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_fixedwing_spektrum_elevons.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESC has a BEC and provides 5 volts on its 5V pin. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
=== Fixedwing, Spektrum Satellite Receivers ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_fixedwing_spektrum.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESC has a BEC and provides 5 volts on its 5V pin. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
=== Transitioning [http://wiki.thequadshot.com Quadshot] Using Spektrum Receivers ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_quadshot_spektrum.png|700px]]&lt;br /&gt;
&lt;br /&gt;
The ESCs have BECs and provide 5 volts on their 5V pins. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
Still need: Large Fixed-wing with advanced power system and/or IC engine, PPM example&lt;br /&gt;
&lt;br /&gt;
== R/C Receivers ==&lt;br /&gt;
&lt;br /&gt;
One can use [[Subsystem/radio_control#Spektrum|Spektrum]] DSM2 or compatible receivers as well as traditional PPM receivers.  It is even possible to [[Subsystem/radio_control#Spektrum|connect two Spectrum or compatible satellite receivers]] for better redundancy or to improve RC signal reception. Connecting a RC receiver for flying your aircraft in manual mode during setup and test phase is 99% of the cases a must. Therefore the Paparazzi team made it easy to connect one.&lt;br /&gt;
&lt;br /&gt;
===  Using a Spektrum DSM receiver ===&lt;br /&gt;
&lt;br /&gt;
==== Physically connecting ====&lt;br /&gt;
&lt;br /&gt;
Wiring up a Spektrum or compatible satellite receiver is not to difficult to do. &lt;br /&gt;
It is very important to make absolutley sure the connectors are properly made. &lt;br /&gt;
Not being precise in this step can mean full RC loss and loss of airframe in the first tuning testflights. &lt;br /&gt;
&lt;br /&gt;
The spektrum satellite receiver should be connected to the UART1 connector on the autopilot board. Make sure the voltage on the AP board UART1 + pin is not to high, or to low for your receiver.&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
# Connect the minus(-) of the receiver to GND of UART1&lt;br /&gt;
# The receiver plus(+) to the UART1 Plus(+) &lt;br /&gt;
# Data out signal of the receiver to the RX pin on the UART1&lt;br /&gt;
&lt;br /&gt;
==== Binding ====&lt;br /&gt;
&lt;br /&gt;
To get a receiver and transmitter to work together you must perform a binding process. &lt;br /&gt;
&lt;br /&gt;
It is important to '''bind''' your Spectrum DSM receiver to your transmitter '''via''' your '''Lisa board''', not in any other way!&lt;br /&gt;
&lt;br /&gt;
The way to bind is by temporary connecting via fiddly small molex pins. &lt;br /&gt;
It is advised to make a small bind plug out of a molex connector for this purpose. &lt;br /&gt;
Before you start make sure you have your airframe configuration already uploaded either via USB or a JTAG cable.&lt;br /&gt;
&lt;br /&gt;
The bind procedure:&lt;br /&gt;
&lt;br /&gt;
# On the connector '''ANALOG1''' have a wire between the GND and ADC1 pin, located in the middle of the board&lt;br /&gt;
# Power up your autopilot board&lt;br /&gt;
# Hold the bind button on your '''transmitter''', while '''keeping it pressed''' switch on your transmitter&lt;br /&gt;
#:Wait...! All lights of the receiver blink and then go steady&lt;br /&gt;
# Let go of your transmitter bind button&lt;br /&gt;
# Power off your Lisa Board&lt;br /&gt;
# Remove the wire connecting the GND and ADC1 pins on the ANALOG1 connector&lt;br /&gt;
# Repower your board, if you have servos connected and wiggle the RC transmitter sticks some servos should move&lt;br /&gt;
&lt;br /&gt;
That is all, you are done. &lt;br /&gt;
The bind procedure only needs to be done '''once''' for your receiver.&lt;br /&gt;
&lt;br /&gt;
===  Using a PPM receiver ===&lt;br /&gt;
&lt;br /&gt;
Using a PPM receiver, a so called '''PPM sum stream''' input is possible. [[RC_Receivers_and_Radios#PPM_Based_Systems | To make it work, you need a PPM sum stream out capable receiver. Find out more following this link]]  &lt;br /&gt;
&lt;br /&gt;
==== Connecting ====&lt;br /&gt;
&lt;br /&gt;
Connect the PPM out signal to the RX pin of UART1.&lt;br /&gt;
&lt;br /&gt;
Make sure put this in your airframe file in your AP target section.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;radio_control&amp;quot; type=&amp;quot;ppm&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;RADIO_CONTROL_PPM_PIN&amp;quot; value=&amp;quot;UART1_RX&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Alternative =====&lt;br /&gt;
&lt;br /&gt;
However if in the case you want to use the UART1 port for something else, there is an option to connect the receiver to a servo pin. Yes, that's right, a servo connector is used for receiving a PPM stream '''input'''.  If you want to walk that path, the default pin number to capture the PPM sum stream is via servo connector SERVO6&lt;br /&gt;
&lt;br /&gt;
If you connect the PPM ou capable receiver that way make sure to put this in your airframe file in your AP target section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;radio_control&amp;quot; type=&amp;quot;ppm&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;RADIO_CONTROL_PPM_PIN&amp;quot; value=&amp;quot;SERVO6&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not have or cannot modify a receiver to a ''PPM out'' able receiver, a [[PPM_Encoder | PPM encoder board]] can be used to avoid opening your receiver for PPM out modification.&lt;br /&gt;
&lt;br /&gt;
== Extras ==&lt;br /&gt;
&lt;br /&gt;
=== UART I/O ===&lt;br /&gt;
&lt;br /&gt;
UART pins can also be used as general purpose I/O, this might come in handy in case all other inputs or your AP board are in use.&lt;br /&gt;
&lt;br /&gt;
===  USB as UART1TX + hardware flow control===&lt;br /&gt;
&lt;br /&gt;
[[File:Lisam-usb-uart1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The USB_VBUS on the Lisa/M 2.0 can be used as UART1 TX. To do this, a diode has to be removed. Make sure to include a series resistor of 100-3000 Ohm to protect the microcontroller from overcurrents. The 2nd and 3th pin of the USB pads are CTS and RTS respactively. It is recommended to include a series resistor in the RTS line, as this is an outgoing line. &lt;br /&gt;
&lt;br /&gt;
If you want to enable flow control in the software, but don't want to use flow control when no cable is connected to the CTS/RTS, a pulldown resistor of 10 kOhm has to be added between the CTS and the GND. If you do this, take care when connecting UART devices that have a large series resistor in their RTS line. The combination of the pulldown resistor and the series resistor might cause the high-level voltage to drop under the high-level treshold of the microcontroller, causing strange behaviour.&lt;br /&gt;
&lt;br /&gt;
For Example the RTS , mostly a purple wire, is the '''pin 10''' on the Xtend module when set in the module with Hardware flow control (use X-CTU)&lt;br /&gt;
CTS, most blue, on pin 9 of the Xtend&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=380px heights=205px&amp;gt;&lt;br /&gt;
Image:Lisam-diode.JPG | Remove this diode. After removing this diode you can not power the board via USB anymore.&lt;br /&gt;
Image:Lisam-gpio-usb.JPG | Take care of the small distance between the GPIO pins and the USB pads.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== PCB ==&lt;br /&gt;
&lt;br /&gt;
=== Gerber &amp;amp; Drill Files  ===&lt;br /&gt;
&lt;br /&gt;
'''''Download  Lisa/M v2.0 gerber &amp;amp; drill files (zip)''''' ''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
== Assembly ==&lt;br /&gt;
&lt;br /&gt;
To create and assemble a board oneself is possible. It takes some skills however. &lt;br /&gt;
&lt;br /&gt;
For the Lisa/m v2.0 without the Aspirin sensor board a good soldering iron is enough.(smallest components are 0402) For the Aspirin Sensor board you need a hot air soldering station.&lt;br /&gt;
&lt;br /&gt;
In case you wan to follow that path you need the desing. You came to the right place here is the info to get the needed files;&lt;br /&gt;
&lt;br /&gt;
===Components Layout===&lt;br /&gt;
&lt;br /&gt;
''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
Need some top and bottom of board images and line drawings here.&lt;br /&gt;
&lt;br /&gt;
=== Bill Of Material ===&lt;br /&gt;
&lt;br /&gt;
'''''Download  Lisa/M v2.0 Bill Of Material (zipped .xls file)''''' ''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
Open .sch File in Eagle, execute UPL --&amp;gt; bom.ulp , save as .txt&lt;br /&gt;
&lt;br /&gt;
== PCB and assembled boards suppliers ==&lt;br /&gt;
&lt;br /&gt;
To difficult to creat your own AP board, understandable, thus pre made board available via [[Get_Hardware|Get Hardware]] page... hopefully :)&lt;br /&gt;
&lt;br /&gt;
== Mechanical Dimensions ==&lt;br /&gt;
&lt;br /&gt;
[[Image:LisaM_V2_0_top_mechanical.png|500px|Lisa/M v2.0 Mechanical Dimensions]]&lt;br /&gt;
&lt;br /&gt;
The overall height of the board including the servo connectors is 10mm. Note that the overall length includes the USB connector. The mounting holes are nominal 2mm diameter (with a bit of clearance).&lt;br /&gt;
&lt;br /&gt;
== Get the design ==&lt;br /&gt;
&lt;br /&gt;
'''Source files'''&lt;br /&gt;
:*download available on GitHub: ''[https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lisa_m/v2.0 Lisa/M v2.0 Cadsoft Eagle 6 Design]''&lt;br /&gt;
'''Gerber &amp;amp; Drill files'''&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need generated gerbers and drill files&lt;br /&gt;
'''Assembly files'''&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need Lisa/M v2.0 Components layouts (pdf)&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need Lisa/M v2.0 Bill Of Material&lt;br /&gt;
&lt;br /&gt;
== Uploading new software ==&lt;br /&gt;
New onboard software for the Lisa/M v2.0 can uploaded by connecting your PC via a micro-USB port to the autopilot board. For this the board need to contain the [[Luftboot]] bootloader. All Lisa/M 2.0 from Transition Robotics Inc. come with luftboot already in the board.&lt;br /&gt;
&lt;br /&gt;
An alternative to get your firmware in the board is by using a JTAG connector connected via the 10-pin Samtec connector that is available on the board.&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for an overview of different methods to upload new software to your autopilot.&lt;br /&gt;
&lt;br /&gt;
=== Using luftboot ===&lt;br /&gt;
'''This is the default FLASH_MODE for Lisa/M v2.0''', it could be explicitly selected by adding&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;DFU&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
to the firmware section of your airframe file. Make sure to set Lisa/M 2.0 as it's target board.&lt;br /&gt;
&lt;br /&gt;
Once USB is plugged in, the board automatically goes to bootloader mode and the status LEDs cycle up and down:&lt;br /&gt;
&lt;br /&gt;
[[File:Luftboot.gif|320px]]&lt;br /&gt;
&lt;br /&gt;
If you have trouble entering the bootloader mode or want to upload/update the bootloader itself, see the [[Luftboot]] page.&lt;br /&gt;
&lt;br /&gt;
=== Using JTAG ===&lt;br /&gt;
You still can use a [[JTAG|JTAG adapter]] for [[FirmwareFlashing#JTAG|flashing]] and [[DevGuide/JTAG-Debug|debugging]] your paparazzi firmware. To use [[FirmwareFlashing#JTAG|JTAG flashing]] configure the ''FLASH_MODE'' in your firmware section:&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to use an advanced adapter called Black Magic Probe. See more details [[here|JTAG#Black_Magic_Probe]]&lt;br /&gt;
&lt;br /&gt;
Using JTAG will not overwrite the bootloader by default. To overwrite the luftboot bootloader configure&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;NO_LUFTBOOT&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then press upload as normal...&lt;br /&gt;
&lt;br /&gt;
=== Serial Firmware Upload ===&lt;br /&gt;
Firmware upload using the factory integrated bootloader can be useful e.g. if you have overwritten [[Luftboot]] accidentally and don´t have access to [[JTAG]].&amp;lt;br/&amp;gt;&lt;br /&gt;
Either set the flash mode in the target section of the airframe configuration:&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;SERIAL&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
or add it to the commandline invocation:&lt;br /&gt;
 make AIRCRAFT=&amp;lt;aircraftname&amp;gt; ap.upload FLASH_MODE=SERIAL&lt;br /&gt;
&lt;br /&gt;
Due to hardware constraints, the board has to be modified to make use of the bootloader, which is only accessible on UART1:&lt;br /&gt;
# Diode D3 has to be removed (the bigger black brick next to the USB connector). Attention, no more powering via USB after that.&lt;br /&gt;
# BOOT1 has to be set to GND by connecting ACC_DRDY(unused) to GND at the Aspirin pads&lt;br /&gt;
&lt;br /&gt;
Now a boot sequence works as follows:&lt;br /&gt;
#BOOT1 has to be set to 3.3V by use of a jumper cable&lt;br /&gt;
#Connect a 3,3V serial cable (FTDI, MAX232...) to UART1, the TX pin is USB_VBUS&lt;br /&gt;
#Power the board and activate the bootloader program&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Prevent board from going into bootloader mode ===&lt;br /&gt;
&lt;br /&gt;
Normally, if you power up the board with the USB cable connected to a PC it will automatically go into bootloader mode. If you want the board to power up normally with the cable connected you can ground the ADC2 in the ANALOG1 connector.&lt;br /&gt;
&lt;br /&gt;
== Detailed Hardware Revision History ==&lt;br /&gt;
&lt;br /&gt;
=== Changes Between LISA v1.1 and v2.0 ===&lt;br /&gt;
&lt;br /&gt;
* Lots of silkscreen improvements&lt;br /&gt;
* Added attributes to all parts to make the usage of bom-ex ulp possible.&lt;br /&gt;
* Improved routing to allow teardropping&lt;br /&gt;
* Fixed stm32f1, f2 and f4 compatibility circuit. (has to jump to ground not to 3v3)&lt;br /&gt;
* Connected existing UART RX pullups to the respective connector power pins instead of 3v3. To prevent connecting 5V over IO pin to the 3v3 power rail.&lt;br /&gt;
* Added pullups on all UART RX lines to prevent undesired floatation.&lt;br /&gt;
* LED's are connected to 3v3 now. To make sure we don't have an issue with voltage tolerance on the gpio pins.&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
== Hardware Change Requests ==&lt;br /&gt;
&lt;br /&gt;
If you have a Lisa/M 2.0 and in the process of using it you come up with something you find annoying, dangerous, or restricting, add your hardware update requests here. Better still, modify the Lisa schematics yourself and show your new improvements if you are skilled enough to do this.&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace BMP085 with MS5611 (the MS5611 seems to be better in performance then the BMP but it is more expensive and seems to be more difficult to obtain. &lt;br /&gt;
** A: Using a MS5611 is possible through using a Aspirin v2.1 board&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace 7 Pin CAN with molex with something less risky to be inserted in 7 Pin SPI in relation to powering the board via CAN molex.&lt;br /&gt;
&lt;br /&gt;
* REQ: Separate spot for external power if powered via separate battery. Realizing we can via Servo ports by Bridge J1 but still like to measure board voltage then and have a way to add power without mistakenly insert I2CCAN Molex conector into SPI Molex on board connector. Thus a separate CAN and Power plug. Power on regular four pin molex with GND, V+5, , V_BATT, V_I (Current sense). Option to have thicker wire to be soldered to the board, for power hungry setups and other issues connectors for power are not a good idea.&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace Aspirin IMU board with InvenSense MPU-9150 and bring the MS5611 back onto the Lisa/M board to reduce footprint, mass, and manufacturing cost once the 9150 becomes readily available(if at al with SPI) and is tested to perform well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Lisa/Lia F4 ==&lt;br /&gt;
Lisa/Lia autopilot can be easily converted to a much more powerful controller, based on STM32F405RGT6 chip [http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN1035/PF252144]. The chip has the same dimensions (LQFP64 10x10mm package) with the exact same pinout as the original STM32F105RCT6 chip. The main advantage of the f4 chip is:&lt;br /&gt;
&lt;br /&gt;
* 168MHz CPU speed, 1MB flash and 192kb RAM&lt;br /&gt;
* FPU (fast floating point computations)&lt;br /&gt;
* configurable DMA streams (more peripherals can use DMA)&lt;br /&gt;
* multiplexed IO pins (peripherals can be mapped to various IO pins)&lt;br /&gt;
* CPU usage only about 5% with standard rotorcraft flight configuration&lt;br /&gt;
&lt;br /&gt;
STM32F405RGT6 chip can be ordered for example [http://cz.mouser.com/ProductDetail/STMicroelectronics/STM32F405RGT6/?qs=Z8%252beY1k3TIKgj7QWsYGpQw== here]. To replace the chip a good soldering station with microscope and enough light is recommended. After replacing the chip, jumpers CMP1 and CMP2 have to be opened. &lt;br /&gt;
&amp;lt;gallery widths=300px heights=200px&amp;gt;&lt;br /&gt;
 [[File:F4_digikey.jpg]]&lt;br /&gt;
Image:F4_digikey.jpg|DigiKey part number for F4 chip&lt;br /&gt;
Image:F4_on_board.jpg|Lia F4 with the new chip&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Programming ===&lt;br /&gt;
The STM32F4 can be flashed via SWD/JTAG (e.g. with the BlackMagicProbe) or via [[DFU#Native_DFU_bootloader_.28embedded_in_ROM.29|DFU-UTIL]].&lt;br /&gt;
[[Luftboot|Luftboot]] currently supports only F1xx chips.&lt;br /&gt;
&lt;br /&gt;
A guide how to flash the F4 chip from Eclipse can be found in [[RT_Paparazzi|RT_Paparazzi]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Lisa]] [[Category:User_Documentation]] [[Category:Autopilots]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=18778</id>
		<title>JTAG</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=18778"/>
		<updated>2014-06-26T08:30:12Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Black Magic Probe */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A JTAG interface is designed for on-chip debugging. It can also be used to flash your firmware if you do not have a means to upload software via USB already. For short, if you want to upload your own software or want to do serious paparazzi development work, the you need a JTAG adapter like this.&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
* [[FirmwareFlashing#JTAG|firmware flashing via JTAG]]&lt;br /&gt;
* [[DevGuide/JTAG-Debug|debugging with JTAG]]&lt;br /&gt;
&lt;br /&gt;
==JTAG Adapters==&lt;br /&gt;
There are multiple Paparazzi-compatible devices available that support JTAG.&lt;br /&gt;
&lt;br /&gt;
Below you find a list of JTAG devices that you can use in combination with e.g. a Paparazzi Lisa/M board. &lt;br /&gt;
&lt;br /&gt;
=== FLOSS JTAG ===&lt;br /&gt;
 &lt;br /&gt;
The FLOSS JTAG is based on an FTDI chip that allows two simultaneous USB connections, which means that FLOSS JTAG allows JTAG and UART/COM connections.&lt;br /&gt;
&lt;br /&gt;
Let's take a look at upper side of the board. It contains JTAG connector (which is connected on photo) and two sets of RX/TX LEDs for JTAG and UART/COM interface separately. The JTAG connector is 2x5 pins, 0.05-inch pitch, and is compatible with the Samtec FFSD-05-D-06.00-01-N-RW-R ribbon cable.&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-up.jpg]]&lt;br /&gt;
&lt;br /&gt;
On the other side of the board there is 4 pin UART/COM connector, which contains (from top to bottom in the image below): Ground (black), RX (orange), TX (yellow), and +5V (red)&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-down.jpg]]&lt;br /&gt;
&lt;br /&gt;
Usage of board is pretty simple: JTAG can be used to upload firmware into the board and/or repair board with broken bootloader, and UART/COM interfaced can be used to make &amp;quot;COM port style&amp;quot; connection to the board. COM connection can be used for example for telemetry debug.&lt;br /&gt;
&lt;br /&gt;
More info available on the [http://randomprojects.org/wiki/Floss-JTAG randomprojects.org wiki].&lt;br /&gt;
&lt;br /&gt;
=== Black Magic Probe ===&lt;br /&gt;
&lt;br /&gt;
[[Image:BMPM_1_top.jpg|500x500px]][[Image:BMPM_1_bottom.jpg|500x500px]]&lt;br /&gt;
&lt;br /&gt;
Some additional info about the Black Magic Probe is available at the [http://www.blacksphere.co.nz/main/blackmagic Black Sphere Technology website].&lt;br /&gt;
&lt;br /&gt;
To use Black Magic Probe instead of FLOSS-JTAG or Luftboot for firmware flashing, append the following string to the upload command:&lt;br /&gt;
&lt;br /&gt;
On Linux:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/ttyACM0&lt;br /&gt;
On Mac OS:&lt;br /&gt;
 FLASH_MODE=JTAG_BMP BMP_PORT=/dev/cu.usbmodem&amp;lt;serial&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make this the default flash method add this in the airframe file firmware section:&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG_BMP&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;BMP_PORT&amp;quot; value=&amp;quot;/dev/ttyACM0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for other methods.&lt;br /&gt;
&lt;br /&gt;
==== Benefits ====&lt;br /&gt;
&lt;br /&gt;
There are good reasons to use the Black Magic Probe Mini instead of FLOSS-JTAG:&lt;br /&gt;
&lt;br /&gt;
*Lower cost&lt;br /&gt;
*No need for OpenOCD as BMPM has a built in GDB server&lt;br /&gt;
*Orders of magnitude faster as all the high speed protocol logic happens on the built-in STM32&lt;br /&gt;
*Supports Serial Wire Debug (SWD)&lt;br /&gt;
*Supports tracing using the SWD trace pin&lt;br /&gt;
*No need for loading and unloading of FTDI drivers on Mac OS X&lt;br /&gt;
&lt;br /&gt;
====UART port====&lt;br /&gt;
The pinout for the UART port on the back side of the BMP as seen on the image above and starting from the top is ground,rx,tx,3.3v . You can use this for receiving telemetry.&lt;br /&gt;
&lt;br /&gt;
====Upgrade BMP firmware====&lt;br /&gt;
&lt;br /&gt;
To upgrade the brain of your Black Magic Probe, a.k.a. its firmware, use these commands on your command line:&lt;br /&gt;
&lt;br /&gt;
 $ git clone git://blackmagicdebug.git.sourceforge.net/gitroot/blackmagicdebug/blackmagicdebug&lt;br /&gt;
 $ cd blackmagicdebug/src&lt;br /&gt;
 $ make CROSS_COMPILE=~/sat/bin/arm-none-eabi- &lt;br /&gt;
 $ ../scripts/stm32_mem.py blackmagic.bin&lt;br /&gt;
&lt;br /&gt;
Note the minus sign after ''eabi'', ye that is correct, best to cut 'n paste the lines without the $ sign in front ofcourse.&lt;br /&gt;
&lt;br /&gt;
=== FT2232H Mini Module ===&lt;br /&gt;
&lt;br /&gt;
Use ftdi prog to change the Description String into: FLOSS-JTAG. &amp;lt;br/&amp;gt;&lt;br /&gt;
More information for this board at [[Serial_Adapter]].&lt;br /&gt;
[[File:AlternativeFlossJtag.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=18777</id>
		<title>JTAG</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=JTAG&amp;diff=18777"/>
		<updated>2014-06-26T08:24:07Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Black Magic Probe */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
A JTAG interface is designed for on-chip debugging. It can also be used to flash your firmware if you do not have a means to upload software via USB already. For short, if you want to upload your own software or want to do serious paparazzi development work, the you need a JTAG adapter like this.&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
* [[FirmwareFlashing#JTAG|firmware flashing via JTAG]]&lt;br /&gt;
* [[DevGuide/JTAG-Debug|debugging with JTAG]]&lt;br /&gt;
&lt;br /&gt;
==JTAG Adapters==&lt;br /&gt;
There are multiple Paparazzi-compatible devices available that support JTAG.&lt;br /&gt;
&lt;br /&gt;
Below you find a list of JTAG devices that you can use in combination with e.g. a Paparazzi Lisa/M board. &lt;br /&gt;
&lt;br /&gt;
=== FLOSS JTAG ===&lt;br /&gt;
 &lt;br /&gt;
The FLOSS JTAG is based on an FTDI chip that allows two simultaneous USB connections, which means that FLOSS JTAG allows JTAG and UART/COM connections.&lt;br /&gt;
&lt;br /&gt;
Let's take a look at upper side of the board. It contains JTAG connector (which is connected on photo) and two sets of RX/TX LEDs for JTAG and UART/COM interface separately. The JTAG connector is 2x5 pins, 0.05-inch pitch, and is compatible with the Samtec FFSD-05-D-06.00-01-N-RW-R ribbon cable.&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-up.jpg]]&lt;br /&gt;
&lt;br /&gt;
On the other side of the board there is 4 pin UART/COM connector, which contains (from top to bottom in the image below): Ground (black), RX (orange), TX (yellow), and +5V (red)&lt;br /&gt;
&lt;br /&gt;
[[Image:Jtag-down.jpg]]&lt;br /&gt;
&lt;br /&gt;
Usage of board is pretty simple: JTAG can be used to upload firmware into the board and/or repair board with broken bootloader, and UART/COM interfaced can be used to make &amp;quot;COM port style&amp;quot; connection to the board. COM connection can be used for example for telemetry debug.&lt;br /&gt;
&lt;br /&gt;
More info available on the [http://randomprojects.org/wiki/Floss-JTAG randomprojects.org wiki].&lt;br /&gt;
&lt;br /&gt;
=== Black Magic Probe ===&lt;br /&gt;
&lt;br /&gt;
[[Image:BMPM_1_top.jpg|500x500px]][[Image:BMPM_1_bottom.jpg|500x500px]]&lt;br /&gt;
&lt;br /&gt;
Some additional info about the Black Magic Probe is available at the [http://www.blacksphere.co.nz/main/blackmagic Black Sphere Technology website].&lt;br /&gt;
&lt;br /&gt;
To use Black Magic Probe instead of FLOSS-JTAG or Luftboot for firmware flashing, append the following string to the upload command:&lt;br /&gt;
&lt;br /&gt;
On Linux:&lt;br /&gt;
 FLASH_MODE=JTAG BMP_PORT=/dev/ttyACM0&lt;br /&gt;
On Mac OS:&lt;br /&gt;
 FLASH_MODE=JTAG BMP_PORT=/dev/cu.usbmodem&amp;lt;serial&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make this the default flash method add this in the airframe file firmware section:&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG_BMP&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;BMP_PORT&amp;quot; value=&amp;quot;/dev/ttyACM0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for other methods.&lt;br /&gt;
&lt;br /&gt;
==== Benefits ====&lt;br /&gt;
&lt;br /&gt;
There are good reasons to use the Black Magic Probe Mini instead of FLOSS-JTAG:&lt;br /&gt;
&lt;br /&gt;
*Lower cost&lt;br /&gt;
*No need for OpenOCD as BMPM has a built in GDB server&lt;br /&gt;
*Orders of magnitude faster as all the high speed protocol logic happens on the built-in STM32&lt;br /&gt;
*Supports Serial Wire Debug (SWD)&lt;br /&gt;
*Supports tracing using the SWD trace pin&lt;br /&gt;
*No need for loading and unloading of FTDI drivers on Mac OS X&lt;br /&gt;
&lt;br /&gt;
====UART port====&lt;br /&gt;
The pinout for the UART port on the back side of the BMP as seen on the image above and starting from the top is ground,rx,tx,3.3v . You can use this for receiving telemetry.&lt;br /&gt;
&lt;br /&gt;
====Upgrade BMP firmware====&lt;br /&gt;
&lt;br /&gt;
To upgrade the brain of your Black Magic Probe, a.k.a. its firmware, use these commands on your command line:&lt;br /&gt;
&lt;br /&gt;
 $ git clone git://blackmagicdebug.git.sourceforge.net/gitroot/blackmagicdebug/blackmagicdebug&lt;br /&gt;
 $ cd blackmagicdebug/src&lt;br /&gt;
 $ make CROSS_COMPILE=~/sat/bin/arm-none-eabi- &lt;br /&gt;
 $ ../scripts/stm32_mem.py blackmagic.bin&lt;br /&gt;
&lt;br /&gt;
Note the minus sign after ''eabi'', ye that is correct, best to cut 'n paste the lines without the $ sign in front ofcourse.&lt;br /&gt;
&lt;br /&gt;
=== FT2232H Mini Module ===&lt;br /&gt;
&lt;br /&gt;
Use ftdi prog to change the Description String into: FLOSS-JTAG. &amp;lt;br/&amp;gt;&lt;br /&gt;
More information for this board at [[Serial_Adapter]].&lt;br /&gt;
[[File:AlternativeFlossJtag.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]] [[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18709</id>
		<title>Flight Plans</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18709"/>
		<updated>2014-06-05T03:17:45Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Call */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''flight plan''' is a XML document which one can create and store aboard an autopilot. The flight plan will describe how you want your aircraft to travel if released into into the wild blue yonder.&lt;br /&gt;
&lt;br /&gt;
== DTD and Structure ==&lt;br /&gt;
&lt;br /&gt;
The formal description of the flight plan file is given in the [http://en.wikipedia.org/wiki/Document_Type_Definition '''DTD'''] (located in &amp;lt;tt&amp;gt;conf/flight_plans/flight_plan.dtd&amp;lt;/tt&amp;gt;). This&lt;br /&gt;
DTD must be referenced in the header of your flight plan XML document using the following line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flight plans are stored in the &amp;lt;tt&amp;gt;conf/flight_plans&amp;lt;/tt&amp;gt; directory. The [[Flight_Plan_Editor|flight plan editor]] can be used to create basic flight plans via the GUI.&lt;br /&gt;
&lt;br /&gt;
Extract from the [http://en.wikipedia.org/wiki/Document_Type_Definition DTD]:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!ELEMENT flight_plan (header?,waypoints,sectors?,include*,exceptions?,blocks)&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''A flight plan is composed of two mandatory elements: [[#waypoints|waypoints]] and [[#blocks|blocks]]'''&lt;br /&gt;
&lt;br /&gt;
The root &amp;lt;tt&amp;gt;flight_plan&amp;lt;/tt&amp;gt; element is specified with several attributes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;'''&amp;lt;flight_plan name lat0 lon0 ground_alt security_height home_mode_height qfu alt max_dist_from_home&amp;gt;'''&amp;lt;/tt&amp;gt;&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''name'''&amp;lt;/tt&amp;gt;: The name of the mission (a text string)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''lat0, lon0'''&amp;lt;/tt&amp;gt;: Defines the latitude and longitude coordinates of the reference point {0,0} in WGS84 degree coordinates&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;: The ground altitude (in meters), Above Sea Level where you are flying. It defines the &amp;lt;tt&amp;gt;GROUND_ALT&amp;lt;/tt&amp;gt; constant value which can be used in combination with a waypoint &amp;lt;height&amp;gt; parameter to define a waypoint height&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;:  The height (over &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;) used by the circle-home failsafe procedure and in other flight procedures such as formation flight and anti-collision avoidance. Warnings are produced if you place a waypoint lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; (usually the case for the landing point)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; (optional): This optional attribute available since v4.2 allows to override &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; as failsafe height in home mode. If &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; Is set lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;, the later is used. This attribute is useful if you need to return home at a high altitude rather than a low altitude.&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''qfu'''&amp;lt;/tt&amp;gt; (optional): defines the global constant &amp;lt;tt&amp;gt;QFU&amp;lt;/tt&amp;gt;. It usually is the magnetic heading in degrees (north=0, east=90) of the runway, the opposite of wind direction. This constant may be used in the mission description. It is also used by the simulator as the original course of the aircraft. So if you want to take off and climb to the West you would use qfu=270. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''alt'''&amp;lt;/tt&amp;gt;: The default altitude of waypoints ([[Altitude_definitions|Above Sea Level]]). So if your ground altitude is 400 then alt needs to be a value greater than ground altitude and above any obstructions in the flight plan. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''max_dist_from_home'''&amp;lt;/tt&amp;gt;: A radius representing the maximum allowed distance (in meters) from the HOME waypoint. Exceeding this value (ie flying outside the circle with this radius) will trigger an exception. It is up to you to define the block to be executed (ie what to do) for the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Here is an '''example''' of such a line in the top of a flight plan:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan alt=&amp;quot;250&amp;quot; ground_alt=&amp;quot;185&amp;quot; lat0=&amp;quot;43.46223&amp;quot; lon0=&amp;quot;1.27289&amp;quot; name=&amp;quot;Example Muret&amp;quot; max_dist_from_home=&amp;quot;300&amp;quot; qfu=&amp;quot;270&amp;quot; security_height=&amp;quot;25&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a flight plan could also contain optional &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt;'s and &amp;lt;tt&amp;gt;exceptions&amp;lt;/tt&amp;gt; cases.&lt;br /&gt;
&lt;br /&gt;
In English the above flight plan says the name is Example Muret. The reference coordinates for the 0,0 point is: 43.46223 (lat) and 1.27289 (long). The flying site 0,0 location is 185m above sea level. The security height is 25m above 0,0 point or 210m above sea level. The default (ie if not defined in a waypoint this alt is used) altitude is 250m (above sea level). The home mode block altitude is defined to be 150m above sea level. Also, for security, a circle is defined with a radius that's 300m from 0,0 position. This is the max_dist_from_home value. Fly 301m from 0,0 and an exception is triggered. A useful block is to trigger/go to the home mode block and return to home when the aircraft flies outside the safety circle. Example flight plans are helpful for study before you build your own from scratch.&lt;br /&gt;
&lt;br /&gt;
== Waypoints ==&lt;br /&gt;
&lt;br /&gt;
The waypoints are the geographic locations used to specify the trajectories. A waypoint is specified by it's name and coordinates:&lt;br /&gt;
 &amp;lt;tt&amp;gt;''' &amp;lt;waypoint name wpx wpy [alt] [height]/&amp;gt; '''&amp;lt;/tt&amp;gt;&lt;br /&gt;
where wpx and wpy are real positional coordinates ( &amp;lt;tt&amp;gt;'''lat/lon'''&amp;lt;/tt&amp;gt; )  '''or''' UTM coordinates ( &amp;lt;tt&amp;gt;'''utm_x0/utm_y0'''&amp;lt;/tt&amp;gt; ) '''or''' relative coordinates ( &amp;lt;tt&amp;gt;'''x/y'''&amp;lt;/tt&amp;gt; ) in meters from your reference point {0,0} .  &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; is an optional parameter and can be used to assign an altitude to a particular waypoint that is different from the globally defined &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; parameter of the flightplan. The &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; attribute can be used to set the waypoint height relative to the [[Altitude_definitions|ground altitude]] (&amp;lt;tt&amp;gt;ground_alt&amp;lt;/tt&amp;gt;) of the flight plan for this waypoint.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;HOME&amp;quot; x=&amp;quot;0.0&amp;quot; y=&amp;quot;30.0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;BRIDGEOVERRIVER&amp;quot; x=&amp;quot;-100.0&amp;quot; y=&amp;quot;60.0&amp;quot; alt=&amp;quot;270.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MyBarn&amp;quot; x=&amp;quot;-130.0&amp;quot; y=&amp;quot;217.5&amp;quot; alt=&amp;quot;3000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;3&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;4&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50.&amp;quot; alt=&amp;quot;ground_alt + 50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYHELPERSPOT&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;60&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYOTHERHELPERSPOT&amp;quot; x=&amp;quot;-70.0&amp;quot; y=&amp;quot;90&amp;quot; height=&amp;quot;70.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOWER&amp;quot; lat=&amp;quot;48.858249&amp;quot; lon=&amp;quot;2.294494&amp;quot; height=&amp;quot;324.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MountainCAFE&amp;quot; utm_x0=&amp;quot;360284.8&amp;quot; utm_y0=&amp;quot;4813595.5&amp;quot; alt=&amp;quot;1965.&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* Waypoints are easily adjusted with the [[Flight_Plan_Editor|flight plan editor]].&lt;br /&gt;
* If a waypoint name starts with an underscore ( _ ), the waypoint is '''not displayed''' in the GCS, except in editor mode.&lt;br /&gt;
* The maximum number of waypoints is 254.&lt;br /&gt;
* A waypoint named &amp;lt;tt&amp;gt;HOME&amp;lt;/tt&amp;gt; is required if the failsafe HOME mode procedure is used.&lt;br /&gt;
&lt;br /&gt;
== Sectors ==&lt;br /&gt;
&lt;br /&gt;
Flat ''Sectors'' can be described as an area defined by list of waypoint corners. Such an area will be displayed in the Ground Control Station (GCS) by colored lines connecting the cornerpoints.&lt;br /&gt;
A function is generated to check if a point, usually the aircraft itself, is ''inside'' this sector. Currently, this feature requires that the polygon is &amp;lt;b&amp;gt;convex&amp;lt;/b&amp;gt; and described in a &amp;lt;b&amp;gt;clockwise&amp;lt;/b&amp;gt; order. For a sector named &amp;lt;tt&amp;gt;MyBigGarden&amp;lt;/tt&amp;gt; the generated function for the example here would be &amp;lt;tt&amp;gt;bool_t InsideMyBigGarden(float x, float y);&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; are east and north coordinated, in meters, relative to the geographic reference of the flight plan. If the flight plan is dynamically relocated, such a sector will be relocated but the display is currently not updated on the GCS. It would be great if one would help improving that part of the source code. Note that sector names are not allowed to contain spaces.&lt;br /&gt;
&lt;br /&gt;
For example, with the following element in a flight plan.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;MyBigGarden&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is then possible to add an exception clause to your flightplan. For example if the aircraft for some reason flies outside this, defined by us, sector the airframe will fly to a standby waypoint. The exclamation mark (!) means the boolean operator &amp;lt;tt&amp;gt;NOT&amp;lt;/tt&amp;gt; in this example. In regular language one would describe &amp;quot;If my airframe is NOT inside the MyBigGarden sector anymore then deroute it to the standby waypoint. In Flightplan &amp;quot;Speak&amp;quot; this is written like: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;exception cond=&amp;quot;! InsideMyBigGarden(GetPosX(), GetPosY())&amp;quot; deroute=&amp;quot;standby&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: editing of the waypoints of the sector during the flight will not dynamically update the inside function. It will always check if the position is inside the original sector.&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* A nice option in the corner notation is that one can add an underscore ( _ ) in front of the name; a corner or waypoint name that starts with an underscore is not displayed in the GCS. Only in editor mode it is visible. It is visible in editor mode, because if you the could not see it, it also would be not possible to edit or drag the corner or waypoint to another position.&lt;br /&gt;
* The color indicating the sector borders is not fixed but can be defined by oneself if wished for via the color attribute.&lt;br /&gt;
&lt;br /&gt;
== Includes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; is used to add some flight plan elements defined in an external procedure. It’s useful to include pre-written procedures with only few arguments and then clarify the flight plan.&lt;br /&gt;
Here is the structure:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;include name procedure&amp;gt; [&amp;lt;arg name value /&amp;gt;]*[&amp;lt;with from to /&amp;gt;]*&amp;lt;/include&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; attribute of the include element will be used in this flight plan to prefix the blocks of the &amp;lt;tt&amp;gt;procedure&amp;lt;/tt&amp;gt;, the XML referenced file.&lt;br /&gt;
Named arguments may be given with their value in the &amp;lt;tt&amp;gt;arg&amp;lt;/tt&amp;gt; elements. The &amp;lt;tt&amp;gt;with&amp;lt;/tt&amp;gt; tag allows to link labels (e.g. attribute of a deroute instruction or of an exception) from the procedure to blocks of the main flight plan.&lt;br /&gt;
Then, each block of the procedure is like any block of the flight plan and is designated with a dotted identifier: block &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; of a procedure named &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; is named &amp;lt;tt&amp;gt;b.p&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;includes&amp;gt;&lt;br /&gt;
    &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/includes&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Blocks ==&lt;br /&gt;
&lt;br /&gt;
Block elements are the main part of a flight plan: they describe each unit of the mission.&lt;br /&gt;
They are made of various primitives, called stages and exceptions, you can put one after the other. When a&lt;br /&gt;
stage (or a block) is finished, the autopilot goes to the next one. The behaviour after the last stage of the last block is undefined. &lt;br /&gt;
&lt;br /&gt;
As described in the DTD, the &amp;lt;tt&amp;gt;blocks&amp;lt;/tt&amp;gt; element is composed of &amp;lt;tt&amp;gt;block&amp;lt;/tt&amp;gt; elements which are sequence of ''stages'':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT blocks (block+)&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT block  (exception|while|heading|attitude|go|xyz|set|call|circle|deroute|stay|follow|survey_rectangle|for|return|eight|oval|home|path)*&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle radius=&amp;quot;75&amp;quot; wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add a button in the [[GCS#Strips|strip of the aircraft]] with the attribute &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This button will activate the block. If the attribute &amp;lt;tt&amp;gt;group&amp;lt;/tt&amp;gt; is specified, all strip buttons of the same group will be placed vertically on top of each other.&lt;br /&gt;
&lt;br /&gt;
In the same way, a key shortcut can be specified:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block key=&amp;quot;D&amp;quot; name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Modifiers are allowed, using the syntax of [http://library.gnome.org/devel/gtk/2.15/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse GTK accelerators].&lt;br /&gt;
&lt;br /&gt;
An icon can be specified to display the button. The &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt; label then is a tooltip for the icon. The icon must be an image file available in the directory &amp;lt;tt&amp;gt;data/pictures/gcs_icons&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot; strip_button=&amp;quot;Takeoff&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expressions ====&lt;br /&gt;
&lt;br /&gt;
Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C expression is restricted to &lt;br /&gt;
* numeric constants&lt;br /&gt;
* some internal autopilot variables (not fully documented, see examples)&lt;br /&gt;
* Some binary operators: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, ==, +, -, /, *&lt;br /&gt;
* Some utility functions&lt;br /&gt;
&lt;br /&gt;
Some examples of usable expressions are given in the next sections.&lt;br /&gt;
=== Initialization  Blocks ===&lt;br /&gt;
Most flight plans will have three blocks of flight plan initialization blocks. It is good practice to follow this example below if you first start learing to create flightplans&lt;br /&gt;
&lt;br /&gt;
The first block waits until the GPS fix has been established, as shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Wait GPS&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The second block updates the local waypoints with respect to the UAV.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Geo init&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;LessThan(NavBlockTime(), 10)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;NavSetGroundReferenceHere()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This next block prevents the UAV from starting the engine and taking off. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Holding point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!--set var=&amp;quot;nav_mode&amp;quot; value=&amp;quot;NAV_MODE_ROLL&amp;quot;/--&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;attitude roll=&amp;quot;0&amp;quot; throttle=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exceptions ===&lt;br /&gt;
&lt;br /&gt;
The flight manager can handle exceptions. They consist in conditions checked periodically (at the same pace as the navigation control), allowing the control to jump to a given block. Here is the syntax of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;...&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; is an expression and &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the name of the block we want to switch to as soon as the condition is true.&lt;br /&gt;
&lt;br /&gt;
Here are some example of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;10 &amp;gt; PowerVoltage()&amp;quot; deroute=&amp;quot;go_down&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(ground_alt+10 &amp;gt; GetPosAlt())&amp;quot; deroute=&amp;quot;go_up&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(autopilot_flight_time &amp;gt; 840)&amp;quot; deroute=&amp;quot;quick_land&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions can be local to a block or global to the flight plan, in the &amp;lt;tt&amp;gt;&amp;lt;exceptions&amp;gt;&amp;lt;/tt&amp;gt; element. In the following example, time since last reception of a message from the ground station is monitored and the navigation is switched to the &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt; block if no message have been received for 22s. This exception is valid for '''all''' the blocks.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan ...&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt; ... &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;exceptions&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;datalink_time &amp;gt; 22&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/exceptions&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt; ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deroute ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the ''goto'' directive of the flight plan; it switches the navigation to the given block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this primitive should not be used to execute loops which are provided by the following elements.&lt;br /&gt;
&lt;br /&gt;
=== Loops ===&lt;br /&gt;
&lt;br /&gt;
Unbounded loops are written with &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; elements whose &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; attribute is a boolean expression.&lt;br /&gt;
Children  of &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; are stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;while cond=&amp;quot;TRUE&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;B&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;go wp=&amp;quot;C&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;while cond=&amp;quot;5 &amp;gt; stage_time&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/while&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In this example, we run an infinite loop, lettin the aircraft try to go via waypoints &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; and waiting for 5 seconds before repeating.&lt;br /&gt;
&lt;br /&gt;
Bounded loops are written with the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; tag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;0&amp;quot; to=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where the body of the loop will be run four times.&lt;br /&gt;
&lt;br /&gt;
The variable of a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop can be used inside expressions appearing as attributes of the stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot; alt=&amp;quot;ground_alt+50*$i&amp;quot; until=&amp;quot;stage_time&amp;gt;10&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the aircraft will circle around waypoint '''HOME''' for 10 seconds at and altitude above ground of 50m, 10 seconds at altitude 100 meter (50+50), ... until 250m (5x +50).&lt;br /&gt;
&lt;br /&gt;
Note: Two bounded loops using the same control variable are not allowed in the same block.&lt;br /&gt;
&lt;br /&gt;
=== Navigation modes ===&lt;br /&gt;
&lt;br /&gt;
Navigation modes give the description of the desired trajectory in 3D. While the horizontal mode is specified through&lt;br /&gt;
''stages'', the vertical control is specified with various attributes of these stages. The current available navigation stages are&lt;br /&gt;
* attitude : just keep a fixed attitude;&lt;br /&gt;
* heading : keep a given course;&lt;br /&gt;
* go : go to a given waypoint;&lt;br /&gt;
* path : list of waypoints linked by ''go''&lt;br /&gt;
* circle : circle around a waypoint;&lt;br /&gt;
* oval : two half circles with a straight between two nav points&lt;br /&gt;
* eight : fly a figure of eight through a waypoint and around another&lt;br /&gt;
* stay : hold the position (hard to realize for a fixed-wing aircraft);&lt;br /&gt;
* follow : follow another aircraft;&lt;br /&gt;
* xyz : circle around a point moveable with the RC transmitter stick (obsolete with the datalink).&lt;br /&gt;
&lt;br /&gt;
The vertical control is achieved using the &amp;lt;tt&amp;gt;vmode&amp;lt;/tt&amp;gt; attribute of these stages. The possible values are &lt;br /&gt;
* '''alt''' (the default) : the autopilot keeps the desired altitude which is the altitude of the waypoint (if any) or the altitude specified with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute;&lt;br /&gt;
* '''climb''' : the autopilot keeps the desired vertical speed specified with the &amp;lt;tt&amp;gt;climb&amp;lt;/tt&amp;gt; attribute (in m/s);&lt;br /&gt;
* '''throttle''' : the autopilots sets the desired throttle specified with the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute (between 0 and 1);&lt;br /&gt;
* '''glide''' : the autopilot keeps the desired slope between two waypoints&lt;br /&gt;
&lt;br /&gt;
The default control is done with the throttle. However, setting the &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute to '''auto''' and the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute to a constant allows a vertical control only by controlling the attitude of the A/C.&lt;br /&gt;
The &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute also can be set to any value (in degrees) while the throttle control is in use: it usually affects the airspeed of the aircraft.  &lt;br /&gt;
&lt;br /&gt;
The different navigation modes are detailed in the next sections.&lt;br /&gt;
&lt;br /&gt;
=== Attitude ===&lt;br /&gt;
&lt;br /&gt;
Element &amp;lt;tt&amp;gt;attitude&amp;lt;/tt&amp;gt; is the navigation mode which corresponds to the current lowest control loop for horizontal mode.&lt;br /&gt;
The autopilot then keeps a constant attitude. The &amp;lt;tt&amp;gt;roll&amp;lt;/tt&amp;gt; attribute is required (in degrees, positive to put right wing low).&lt;br /&gt;
&lt;br /&gt;
To fly away, at constant airspeed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;, throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To fly around, holding a given altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;30&amp;quot; alt=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is not a ''safe'' navigation mode since the geographic position of the plane is not controlled. However, this mode is useful to tune the roll attitude control loop.&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;heading&amp;lt;/tt&amp;gt; primitive is relative to the second level loop for horizontal mode in the autopilot which will keep the given &amp;lt;tt&amp;gt;course&amp;lt;/tt&amp;gt;, a required attribute (in degrees, clockwise, north=0, east=90).&lt;br /&gt;
&lt;br /&gt;
One example to takeoff, following the QFU, 80% throttle, nose up (15 degrees) until height of 30m is reached:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;heading course=&amp;quot;QFU&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.8&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;(GetPosAlt() &amp;gt; ground_alt+30)&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Go ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitive is probably the most useful one. Basically, the autopilot will try to join a given waypoint (&amp;lt;tt&amp;gt;wp&amp;lt;/tt&amp;gt;, the only required attribute). So the simplest thing you can ask for is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go wp=&amp;quot;HOME&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
which will set the '''HOME''' waypoint as the desired target position. Note than since &amp;lt;tt&amp;gt;vmode=&amp;quot;alt&amp;quot;&amp;lt;/tt&amp;gt; is the default, the altitude of the target waypoint is also taken into account. The navigation will switch to the next stage as soon as the target is reached.&lt;br /&gt;
&lt;br /&gt;
It is usually not a good idea to try to join a waypoint without asking for a precise trajectory, i.e. a given line.&lt;br /&gt;
Setting the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute to '''route''', the navigation will go over a segment joining two waypoints:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target altitude is the altitude of the target waypoint; it can also be set with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute. The following example keeps an altitude with fixed throttle:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp2&amp;quot; wp=&amp;quot;wp3&amp;quot; hmode=&amp;quot;route&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.75&amp;quot; alt=&amp;quot;ground_alt+100&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attributes related to the vertical control can also be set to replace the default altitude mode:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; vmode=&amp;quot;climb&amp;quot; climb=&amp;quot;1.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;tt&amp;gt;approaching_time&amp;lt;/tt&amp;gt; (in seconds) attribute helps to decide when the target is ''reached''. It can be set&lt;br /&gt;
to '''0''' to go over the target waypoint (default value is the '''CARROT''' time, set in the airframe configuration file).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; approaching_time=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Path ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;path&amp;lt;/tt&amp;gt; primitive is just a shorthand expression for a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives. A list of waypoints defined with the &amp;lt;tt&amp;gt;wpts&amp;lt;/tt&amp;gt; attribute is pre-processed into a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives with the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute. For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp1, wp2, wp3&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other attributes are optional:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp3, wp1, wp2&amp;quot; approaching_time=&amp;quot;1&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circle ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; primitive is the second main navigation mode: the trajectory is defined as a circle around a given waypoint with a given radius:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
A positive radius makes the UAS move clockwise, a negative counter-clockwise.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;until&amp;lt;/tt&amp;gt; attribute may be used to control the end of the stage. The following example defines an ascending trajectory at constant throttle, nose up (15 degrees), over growing circles, until the battery level is low:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;wp1&amp;quot; radius=&amp;quot;50+(GetPosAlt()-ground_alt)/2&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.75&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;10&amp;gt;PowerVoltage()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Oval ===&lt;br /&gt;
The oval consists of two half circles that are connected with two straight lines. This flight path is usefull when a IMU is used because the straights allow for level flight. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &amp;lt;oval p1=&amp;quot;1&amp;quot; p2=&amp;quot;2&amp;quot; radius=&amp;quot;nav_radius&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Eight ===&lt;br /&gt;
Fly a figure of eight that consists of two straight legs that pass though the center and the center of the half circle at the end of the two legs is in the turn around  waypoint. The altitude of the center waypoint is used for the entire figure. The turn around waypoint is moved to match radius given. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;  &amp;lt;eight center=&amp;quot;1&amp;quot; radius=&amp;quot;nav_radius&amp;quot; turn_around=&amp;quot;2&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Follow ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;follow&amp;lt;/tt&amp;gt; is a special primitive which makes the UAS follow another UAS (real or simulated, named with its &amp;lt;tt&amp;gt;ac_id&amp;lt;/tt&amp;gt;) at a given &amp;lt;tt&amp;gt;distance&amp;lt;/tt&amp;gt; (in meters) behind and at a given &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; (in meters) above.&lt;br /&gt;
&lt;br /&gt;
In this example, the autopilot will try to follow A/C number '''4''', staying '''50'''m behind and '''20'''m above.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;follow ac_id=&amp;quot;4&amp;quot; distance=&amp;quot;50&amp;quot; height=&amp;quot;20&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;traffic_info.c&amp;lt;/tt&amp;gt; file is required by this feature and the &amp;lt;tt&amp;gt;TRAFFIC_INFO&amp;lt;/tt&amp;gt; flag has to be set to enable it. Then, the following lines must be added in the airframe file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stay ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;stay&amp;lt;/tt&amp;gt; is a mode for UAS's able to hover:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;stay wp=&amp;quot;HOME&amp;quot; alt=&amp;quot;10&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XYZ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xyz&amp;lt;/tt&amp;gt; is a special mode where the UAS circles around a user moveable waypoint. This waypoint is moved with the RC sticks:&lt;br /&gt;
* YAW channel controls the point over the west-east axis;&lt;br /&gt;
* PITCH channel controls the point over the south-north axis;&lt;br /&gt;
* ROLL channel controls the altitude.&lt;br /&gt;
&lt;br /&gt;
Example (default radius is '''100'''):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;xyz radius=&amp;quot;40&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Set ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt; element is a dangerous one which should be used only by expert users: it is used to directly set an internal variable of the autopilot. For example, you can change the value of the default ground altitude, a variable used by the home mode failsafe procedure (and maybe by your own flight plan):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;set var=&amp;quot;ground_alt&amp;quot; value=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This directive is extremely powerful and has great potential for error - use with caution.&lt;br /&gt;
&lt;br /&gt;
=== Call ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;call&amp;lt;/tt&amp;gt; allows the user to define its own navigation procedures in C. The &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt; must be a call to a boolean function which must return TRUE as long as the stage is not completed (a function which should be called only once would then return immediately FALSE).&lt;br /&gt;
This feature is illustrated with the '''line''' pattern:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line(WP_1, WP_2, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;nav_line_init()&amp;lt;/tt&amp;gt; returns FALSE and &amp;lt;tt&amp;gt;nav_line()&amp;lt;/tt&amp;gt; always returns TRUE (this stage never ends).&lt;br /&gt;
Such functions usually are defined in a supplementary C file which must be specified in the airframe file (in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section)&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += nav_line.c&lt;br /&gt;
 sim.srcs += nav_line.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
These functions also must be declared in a header file which must be mentioned in the header element of the flight plan:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;header&amp;gt;&lt;br /&gt;
#include &amp;quot;nav_line.h&amp;quot;&lt;br /&gt;
  &amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
These C source file and H header file must be located in the &amp;lt;tt&amp;gt;sw/airborne&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
You can also call functions before or after each execution of the block (this means continuously on each iteration of each stage of the block, not just when entering o exiting the block).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Examples ==&lt;br /&gt;
Parameters used in a flight plan can be computed expressions. In this example, the plane is asked to perform 5 circles at progressively increasing altitudes for exactly one minute at each altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;&lt;br /&gt;
          alt=&amp;quot;ground_alt + 50*$i&amp;quot;&lt;br /&gt;
          until=&amp;quot;stage_time &amp;gt; 60&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Immobilize Actuators === &lt;br /&gt;
&lt;br /&gt;
h_ctl setpoints variable are set by the h_ctl_attitude_loop() (from fw_h_ctl.c) loop) which can be disabled with the&lt;br /&gt;
h_ctl_disabled flag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_aileron_setpoint&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_elevator_setpoint&amp;quot; value=&amp;quot;MAX_PPRZ/2&amp;quot;/&amp;gt;&lt;br /&gt;
 .... waiting for a condition ...&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
&lt;br /&gt;
Procedures are libraries which can be included in flight plans. They are composed of waypoints, sectors and blocks. The header of a procedure may contain some parameters which are replaced by arguments when the procedure is included.&lt;br /&gt;
&lt;br /&gt;
Extract of the DTD: a procedure is a sequence of parameters, waypoints, ...:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!ELEMENT procedure (param*,header?,waypoints?,sectors?,exceptions?,blocks?)&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;param&amp;lt;/tt&amp;gt;eter is just a name. A parameter is optional if it is declared with a default value.&lt;br /&gt;
An example with a required and an optional parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;alt&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;radius&amp;quot; default_value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Procedures are called with the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; element in a flight plan. A procedure cannot be included twice or by another procedure. A procedure call requires:&lt;br /&gt;
&lt;br /&gt;
* the name of the procedure file, the name given to this inclusion; &lt;br /&gt;
* values for the parameters;&lt;br /&gt;
* backlinks for block name exits of the procedure.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the corresponding procedure '''landing.xml''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE procedure SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;procedure&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;AF&amp;quot; x=&amp;quot;177.4&amp;quot; y=&amp;quot;45.1&amp;quot; alt=&amp;quot;30&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;TD&amp;quot; x=&amp;quot;28.8&amp;quot; y=&amp;quot;57.0&amp;quot; alt=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;168.8&amp;quot; y=&amp;quot;-13.8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;blocks&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 &amp;gt; fabs(GetPosAlt()- WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/block&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/blocks&amp;gt;&lt;br /&gt;
  &amp;lt;/procedure&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the name of procedure '''land''' block will be renamed into '''landing.land''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing.land&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
will jump to this procedure block.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a go-around condition in your landing procedure. You would write it&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;go-around&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
then you must link this block exit with one of your block (e.g. &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt;). So you would include the procedure as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;with from=&amp;quot;go-around&amp;quot; to=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/include&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
There are many ways to skin a cat just as there are many ways to craft your flight plan. Following the best practices tips can save you from a lot of frustration and mishap.&lt;br /&gt;
&lt;br /&gt;
* Simulate your flight plan before taking it to the sky. Flight plans should always be carefully tested prior to flight, take a look at the [[Simulation|simulation]] page for details on how to simulate your plan.&lt;br /&gt;
* Make an subdirectory in the Flight_plan directory with your own name and add your flight plans there. Make sure that the location of the DTD is correct, e.g by using relative directory double dots as in &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;../flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Take a good look at other flight plans included with Paparazzi. To learn from example flight plans please visit the [[Flight_Plan_Examples|flight plan examples]] page&lt;br /&gt;
* There are several option to build failsafe features into you flightplan, [[Failsafe|for some examples visit the Failsafe page]].&lt;br /&gt;
* Some flight plan examples define waypoint locations using relative coordinates. These are relative positions from the fixed lat and lon in the header of the flight plan. When simulating your flight plan the aircraft always use the lat/lon as defined in the flight plan since a regular simulation has no notion of you current position of you local PC where you simulate on. This is something to keep in mind if you test your flight plan in real flights.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18708</id>
		<title>Flight Plans</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18708"/>
		<updated>2014-06-05T03:17:07Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Call */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''flight plan''' is a XML document which one can create and store aboard an autopilot. The flight plan will describe how you want your aircraft to travel if released into into the wild blue yonder.&lt;br /&gt;
&lt;br /&gt;
== DTD and Structure ==&lt;br /&gt;
&lt;br /&gt;
The formal description of the flight plan file is given in the [http://en.wikipedia.org/wiki/Document_Type_Definition '''DTD'''] (located in &amp;lt;tt&amp;gt;conf/flight_plans/flight_plan.dtd&amp;lt;/tt&amp;gt;). This&lt;br /&gt;
DTD must be referenced in the header of your flight plan XML document using the following line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flight plans are stored in the &amp;lt;tt&amp;gt;conf/flight_plans&amp;lt;/tt&amp;gt; directory. The [[Flight_Plan_Editor|flight plan editor]] can be used to create basic flight plans via the GUI.&lt;br /&gt;
&lt;br /&gt;
Extract from the [http://en.wikipedia.org/wiki/Document_Type_Definition DTD]:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!ELEMENT flight_plan (header?,waypoints,sectors?,include*,exceptions?,blocks)&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''A flight plan is composed of two mandatory elements: [[#waypoints|waypoints]] and [[#blocks|blocks]]'''&lt;br /&gt;
&lt;br /&gt;
The root &amp;lt;tt&amp;gt;flight_plan&amp;lt;/tt&amp;gt; element is specified with several attributes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;'''&amp;lt;flight_plan name lat0 lon0 ground_alt security_height home_mode_height qfu alt max_dist_from_home&amp;gt;'''&amp;lt;/tt&amp;gt;&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''name'''&amp;lt;/tt&amp;gt;: The name of the mission (a text string)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''lat0, lon0'''&amp;lt;/tt&amp;gt;: Defines the latitude and longitude coordinates of the reference point {0,0} in WGS84 degree coordinates&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;: The ground altitude (in meters), Above Sea Level where you are flying. It defines the &amp;lt;tt&amp;gt;GROUND_ALT&amp;lt;/tt&amp;gt; constant value which can be used in combination with a waypoint &amp;lt;height&amp;gt; parameter to define a waypoint height&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;:  The height (over &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;) used by the circle-home failsafe procedure and in other flight procedures such as formation flight and anti-collision avoidance. Warnings are produced if you place a waypoint lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; (usually the case for the landing point)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; (optional): This optional attribute available since v4.2 allows to override &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; as failsafe height in home mode. If &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; Is set lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;, the later is used. This attribute is useful if you need to return home at a high altitude rather than a low altitude.&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''qfu'''&amp;lt;/tt&amp;gt; (optional): defines the global constant &amp;lt;tt&amp;gt;QFU&amp;lt;/tt&amp;gt;. It usually is the magnetic heading in degrees (north=0, east=90) of the runway, the opposite of wind direction. This constant may be used in the mission description. It is also used by the simulator as the original course of the aircraft. So if you want to take off and climb to the West you would use qfu=270. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''alt'''&amp;lt;/tt&amp;gt;: The default altitude of waypoints ([[Altitude_definitions|Above Sea Level]]). So if your ground altitude is 400 then alt needs to be a value greater than ground altitude and above any obstructions in the flight plan. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''max_dist_from_home'''&amp;lt;/tt&amp;gt;: A radius representing the maximum allowed distance (in meters) from the HOME waypoint. Exceeding this value (ie flying outside the circle with this radius) will trigger an exception. It is up to you to define the block to be executed (ie what to do) for the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Here is an '''example''' of such a line in the top of a flight plan:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan alt=&amp;quot;250&amp;quot; ground_alt=&amp;quot;185&amp;quot; lat0=&amp;quot;43.46223&amp;quot; lon0=&amp;quot;1.27289&amp;quot; name=&amp;quot;Example Muret&amp;quot; max_dist_from_home=&amp;quot;300&amp;quot; qfu=&amp;quot;270&amp;quot; security_height=&amp;quot;25&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a flight plan could also contain optional &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt;'s and &amp;lt;tt&amp;gt;exceptions&amp;lt;/tt&amp;gt; cases.&lt;br /&gt;
&lt;br /&gt;
In English the above flight plan says the name is Example Muret. The reference coordinates for the 0,0 point is: 43.46223 (lat) and 1.27289 (long). The flying site 0,0 location is 185m above sea level. The security height is 25m above 0,0 point or 210m above sea level. The default (ie if not defined in a waypoint this alt is used) altitude is 250m (above sea level). The home mode block altitude is defined to be 150m above sea level. Also, for security, a circle is defined with a radius that's 300m from 0,0 position. This is the max_dist_from_home value. Fly 301m from 0,0 and an exception is triggered. A useful block is to trigger/go to the home mode block and return to home when the aircraft flies outside the safety circle. Example flight plans are helpful for study before you build your own from scratch.&lt;br /&gt;
&lt;br /&gt;
== Waypoints ==&lt;br /&gt;
&lt;br /&gt;
The waypoints are the geographic locations used to specify the trajectories. A waypoint is specified by it's name and coordinates:&lt;br /&gt;
 &amp;lt;tt&amp;gt;''' &amp;lt;waypoint name wpx wpy [alt] [height]/&amp;gt; '''&amp;lt;/tt&amp;gt;&lt;br /&gt;
where wpx and wpy are real positional coordinates ( &amp;lt;tt&amp;gt;'''lat/lon'''&amp;lt;/tt&amp;gt; )  '''or''' UTM coordinates ( &amp;lt;tt&amp;gt;'''utm_x0/utm_y0'''&amp;lt;/tt&amp;gt; ) '''or''' relative coordinates ( &amp;lt;tt&amp;gt;'''x/y'''&amp;lt;/tt&amp;gt; ) in meters from your reference point {0,0} .  &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; is an optional parameter and can be used to assign an altitude to a particular waypoint that is different from the globally defined &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; parameter of the flightplan. The &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; attribute can be used to set the waypoint height relative to the [[Altitude_definitions|ground altitude]] (&amp;lt;tt&amp;gt;ground_alt&amp;lt;/tt&amp;gt;) of the flight plan for this waypoint.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;HOME&amp;quot; x=&amp;quot;0.0&amp;quot; y=&amp;quot;30.0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;BRIDGEOVERRIVER&amp;quot; x=&amp;quot;-100.0&amp;quot; y=&amp;quot;60.0&amp;quot; alt=&amp;quot;270.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MyBarn&amp;quot; x=&amp;quot;-130.0&amp;quot; y=&amp;quot;217.5&amp;quot; alt=&amp;quot;3000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;3&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;4&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50.&amp;quot; alt=&amp;quot;ground_alt + 50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYHELPERSPOT&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;60&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYOTHERHELPERSPOT&amp;quot; x=&amp;quot;-70.0&amp;quot; y=&amp;quot;90&amp;quot; height=&amp;quot;70.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOWER&amp;quot; lat=&amp;quot;48.858249&amp;quot; lon=&amp;quot;2.294494&amp;quot; height=&amp;quot;324.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MountainCAFE&amp;quot; utm_x0=&amp;quot;360284.8&amp;quot; utm_y0=&amp;quot;4813595.5&amp;quot; alt=&amp;quot;1965.&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* Waypoints are easily adjusted with the [[Flight_Plan_Editor|flight plan editor]].&lt;br /&gt;
* If a waypoint name starts with an underscore ( _ ), the waypoint is '''not displayed''' in the GCS, except in editor mode.&lt;br /&gt;
* The maximum number of waypoints is 254.&lt;br /&gt;
* A waypoint named &amp;lt;tt&amp;gt;HOME&amp;lt;/tt&amp;gt; is required if the failsafe HOME mode procedure is used.&lt;br /&gt;
&lt;br /&gt;
== Sectors ==&lt;br /&gt;
&lt;br /&gt;
Flat ''Sectors'' can be described as an area defined by list of waypoint corners. Such an area will be displayed in the Ground Control Station (GCS) by colored lines connecting the cornerpoints.&lt;br /&gt;
A function is generated to check if a point, usually the aircraft itself, is ''inside'' this sector. Currently, this feature requires that the polygon is &amp;lt;b&amp;gt;convex&amp;lt;/b&amp;gt; and described in a &amp;lt;b&amp;gt;clockwise&amp;lt;/b&amp;gt; order. For a sector named &amp;lt;tt&amp;gt;MyBigGarden&amp;lt;/tt&amp;gt; the generated function for the example here would be &amp;lt;tt&amp;gt;bool_t InsideMyBigGarden(float x, float y);&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; are east and north coordinated, in meters, relative to the geographic reference of the flight plan. If the flight plan is dynamically relocated, such a sector will be relocated but the display is currently not updated on the GCS. It would be great if one would help improving that part of the source code. Note that sector names are not allowed to contain spaces.&lt;br /&gt;
&lt;br /&gt;
For example, with the following element in a flight plan.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;MyBigGarden&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is then possible to add an exception clause to your flightplan. For example if the aircraft for some reason flies outside this, defined by us, sector the airframe will fly to a standby waypoint. The exclamation mark (!) means the boolean operator &amp;lt;tt&amp;gt;NOT&amp;lt;/tt&amp;gt; in this example. In regular language one would describe &amp;quot;If my airframe is NOT inside the MyBigGarden sector anymore then deroute it to the standby waypoint. In Flightplan &amp;quot;Speak&amp;quot; this is written like: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;exception cond=&amp;quot;! InsideMyBigGarden(GetPosX(), GetPosY())&amp;quot; deroute=&amp;quot;standby&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: editing of the waypoints of the sector during the flight will not dynamically update the inside function. It will always check if the position is inside the original sector.&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* A nice option in the corner notation is that one can add an underscore ( _ ) in front of the name; a corner or waypoint name that starts with an underscore is not displayed in the GCS. Only in editor mode it is visible. It is visible in editor mode, because if you the could not see it, it also would be not possible to edit or drag the corner or waypoint to another position.&lt;br /&gt;
* The color indicating the sector borders is not fixed but can be defined by oneself if wished for via the color attribute.&lt;br /&gt;
&lt;br /&gt;
== Includes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; is used to add some flight plan elements defined in an external procedure. It’s useful to include pre-written procedures with only few arguments and then clarify the flight plan.&lt;br /&gt;
Here is the structure:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;include name procedure&amp;gt; [&amp;lt;arg name value /&amp;gt;]*[&amp;lt;with from to /&amp;gt;]*&amp;lt;/include&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; attribute of the include element will be used in this flight plan to prefix the blocks of the &amp;lt;tt&amp;gt;procedure&amp;lt;/tt&amp;gt;, the XML referenced file.&lt;br /&gt;
Named arguments may be given with their value in the &amp;lt;tt&amp;gt;arg&amp;lt;/tt&amp;gt; elements. The &amp;lt;tt&amp;gt;with&amp;lt;/tt&amp;gt; tag allows to link labels (e.g. attribute of a deroute instruction or of an exception) from the procedure to blocks of the main flight plan.&lt;br /&gt;
Then, each block of the procedure is like any block of the flight plan and is designated with a dotted identifier: block &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; of a procedure named &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; is named &amp;lt;tt&amp;gt;b.p&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;includes&amp;gt;&lt;br /&gt;
    &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/includes&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Blocks ==&lt;br /&gt;
&lt;br /&gt;
Block elements are the main part of a flight plan: they describe each unit of the mission.&lt;br /&gt;
They are made of various primitives, called stages and exceptions, you can put one after the other. When a&lt;br /&gt;
stage (or a block) is finished, the autopilot goes to the next one. The behaviour after the last stage of the last block is undefined. &lt;br /&gt;
&lt;br /&gt;
As described in the DTD, the &amp;lt;tt&amp;gt;blocks&amp;lt;/tt&amp;gt; element is composed of &amp;lt;tt&amp;gt;block&amp;lt;/tt&amp;gt; elements which are sequence of ''stages'':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT blocks (block+)&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT block  (exception|while|heading|attitude|go|xyz|set|call|circle|deroute|stay|follow|survey_rectangle|for|return|eight|oval|home|path)*&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle radius=&amp;quot;75&amp;quot; wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add a button in the [[GCS#Strips|strip of the aircraft]] with the attribute &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This button will activate the block. If the attribute &amp;lt;tt&amp;gt;group&amp;lt;/tt&amp;gt; is specified, all strip buttons of the same group will be placed vertically on top of each other.&lt;br /&gt;
&lt;br /&gt;
In the same way, a key shortcut can be specified:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block key=&amp;quot;D&amp;quot; name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Modifiers are allowed, using the syntax of [http://library.gnome.org/devel/gtk/2.15/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse GTK accelerators].&lt;br /&gt;
&lt;br /&gt;
An icon can be specified to display the button. The &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt; label then is a tooltip for the icon. The icon must be an image file available in the directory &amp;lt;tt&amp;gt;data/pictures/gcs_icons&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot; strip_button=&amp;quot;Takeoff&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expressions ====&lt;br /&gt;
&lt;br /&gt;
Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C expression is restricted to &lt;br /&gt;
* numeric constants&lt;br /&gt;
* some internal autopilot variables (not fully documented, see examples)&lt;br /&gt;
* Some binary operators: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, ==, +, -, /, *&lt;br /&gt;
* Some utility functions&lt;br /&gt;
&lt;br /&gt;
Some examples of usable expressions are given in the next sections.&lt;br /&gt;
=== Initialization  Blocks ===&lt;br /&gt;
Most flight plans will have three blocks of flight plan initialization blocks. It is good practice to follow this example below if you first start learing to create flightplans&lt;br /&gt;
&lt;br /&gt;
The first block waits until the GPS fix has been established, as shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Wait GPS&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The second block updates the local waypoints with respect to the UAV.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Geo init&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;LessThan(NavBlockTime(), 10)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;NavSetGroundReferenceHere()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This next block prevents the UAV from starting the engine and taking off. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Holding point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!--set var=&amp;quot;nav_mode&amp;quot; value=&amp;quot;NAV_MODE_ROLL&amp;quot;/--&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;attitude roll=&amp;quot;0&amp;quot; throttle=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exceptions ===&lt;br /&gt;
&lt;br /&gt;
The flight manager can handle exceptions. They consist in conditions checked periodically (at the same pace as the navigation control), allowing the control to jump to a given block. Here is the syntax of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;...&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; is an expression and &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the name of the block we want to switch to as soon as the condition is true.&lt;br /&gt;
&lt;br /&gt;
Here are some example of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;10 &amp;gt; PowerVoltage()&amp;quot; deroute=&amp;quot;go_down&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(ground_alt+10 &amp;gt; GetPosAlt())&amp;quot; deroute=&amp;quot;go_up&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(autopilot_flight_time &amp;gt; 840)&amp;quot; deroute=&amp;quot;quick_land&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions can be local to a block or global to the flight plan, in the &amp;lt;tt&amp;gt;&amp;lt;exceptions&amp;gt;&amp;lt;/tt&amp;gt; element. In the following example, time since last reception of a message from the ground station is monitored and the navigation is switched to the &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt; block if no message have been received for 22s. This exception is valid for '''all''' the blocks.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan ...&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt; ... &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;exceptions&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;datalink_time &amp;gt; 22&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/exceptions&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt; ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deroute ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the ''goto'' directive of the flight plan; it switches the navigation to the given block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this primitive should not be used to execute loops which are provided by the following elements.&lt;br /&gt;
&lt;br /&gt;
=== Loops ===&lt;br /&gt;
&lt;br /&gt;
Unbounded loops are written with &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; elements whose &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; attribute is a boolean expression.&lt;br /&gt;
Children  of &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; are stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;while cond=&amp;quot;TRUE&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;B&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;go wp=&amp;quot;C&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;while cond=&amp;quot;5 &amp;gt; stage_time&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/while&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In this example, we run an infinite loop, lettin the aircraft try to go via waypoints &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; and waiting for 5 seconds before repeating.&lt;br /&gt;
&lt;br /&gt;
Bounded loops are written with the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; tag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;0&amp;quot; to=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where the body of the loop will be run four times.&lt;br /&gt;
&lt;br /&gt;
The variable of a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop can be used inside expressions appearing as attributes of the stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot; alt=&amp;quot;ground_alt+50*$i&amp;quot; until=&amp;quot;stage_time&amp;gt;10&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the aircraft will circle around waypoint '''HOME''' for 10 seconds at and altitude above ground of 50m, 10 seconds at altitude 100 meter (50+50), ... until 250m (5x +50).&lt;br /&gt;
&lt;br /&gt;
Note: Two bounded loops using the same control variable are not allowed in the same block.&lt;br /&gt;
&lt;br /&gt;
=== Navigation modes ===&lt;br /&gt;
&lt;br /&gt;
Navigation modes give the description of the desired trajectory in 3D. While the horizontal mode is specified through&lt;br /&gt;
''stages'', the vertical control is specified with various attributes of these stages. The current available navigation stages are&lt;br /&gt;
* attitude : just keep a fixed attitude;&lt;br /&gt;
* heading : keep a given course;&lt;br /&gt;
* go : go to a given waypoint;&lt;br /&gt;
* path : list of waypoints linked by ''go''&lt;br /&gt;
* circle : circle around a waypoint;&lt;br /&gt;
* oval : two half circles with a straight between two nav points&lt;br /&gt;
* eight : fly a figure of eight through a waypoint and around another&lt;br /&gt;
* stay : hold the position (hard to realize for a fixed-wing aircraft);&lt;br /&gt;
* follow : follow another aircraft;&lt;br /&gt;
* xyz : circle around a point moveable with the RC transmitter stick (obsolete with the datalink).&lt;br /&gt;
&lt;br /&gt;
The vertical control is achieved using the &amp;lt;tt&amp;gt;vmode&amp;lt;/tt&amp;gt; attribute of these stages. The possible values are &lt;br /&gt;
* '''alt''' (the default) : the autopilot keeps the desired altitude which is the altitude of the waypoint (if any) or the altitude specified with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute;&lt;br /&gt;
* '''climb''' : the autopilot keeps the desired vertical speed specified with the &amp;lt;tt&amp;gt;climb&amp;lt;/tt&amp;gt; attribute (in m/s);&lt;br /&gt;
* '''throttle''' : the autopilots sets the desired throttle specified with the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute (between 0 and 1);&lt;br /&gt;
* '''glide''' : the autopilot keeps the desired slope between two waypoints&lt;br /&gt;
&lt;br /&gt;
The default control is done with the throttle. However, setting the &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute to '''auto''' and the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute to a constant allows a vertical control only by controlling the attitude of the A/C.&lt;br /&gt;
The &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute also can be set to any value (in degrees) while the throttle control is in use: it usually affects the airspeed of the aircraft.  &lt;br /&gt;
&lt;br /&gt;
The different navigation modes are detailed in the next sections.&lt;br /&gt;
&lt;br /&gt;
=== Attitude ===&lt;br /&gt;
&lt;br /&gt;
Element &amp;lt;tt&amp;gt;attitude&amp;lt;/tt&amp;gt; is the navigation mode which corresponds to the current lowest control loop for horizontal mode.&lt;br /&gt;
The autopilot then keeps a constant attitude. The &amp;lt;tt&amp;gt;roll&amp;lt;/tt&amp;gt; attribute is required (in degrees, positive to put right wing low).&lt;br /&gt;
&lt;br /&gt;
To fly away, at constant airspeed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;, throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To fly around, holding a given altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;30&amp;quot; alt=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is not a ''safe'' navigation mode since the geographic position of the plane is not controlled. However, this mode is useful to tune the roll attitude control loop.&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;heading&amp;lt;/tt&amp;gt; primitive is relative to the second level loop for horizontal mode in the autopilot which will keep the given &amp;lt;tt&amp;gt;course&amp;lt;/tt&amp;gt;, a required attribute (in degrees, clockwise, north=0, east=90).&lt;br /&gt;
&lt;br /&gt;
One example to takeoff, following the QFU, 80% throttle, nose up (15 degrees) until height of 30m is reached:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;heading course=&amp;quot;QFU&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.8&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;(GetPosAlt() &amp;gt; ground_alt+30)&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Go ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitive is probably the most useful one. Basically, the autopilot will try to join a given waypoint (&amp;lt;tt&amp;gt;wp&amp;lt;/tt&amp;gt;, the only required attribute). So the simplest thing you can ask for is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go wp=&amp;quot;HOME&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
which will set the '''HOME''' waypoint as the desired target position. Note than since &amp;lt;tt&amp;gt;vmode=&amp;quot;alt&amp;quot;&amp;lt;/tt&amp;gt; is the default, the altitude of the target waypoint is also taken into account. The navigation will switch to the next stage as soon as the target is reached.&lt;br /&gt;
&lt;br /&gt;
It is usually not a good idea to try to join a waypoint without asking for a precise trajectory, i.e. a given line.&lt;br /&gt;
Setting the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute to '''route''', the navigation will go over a segment joining two waypoints:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target altitude is the altitude of the target waypoint; it can also be set with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute. The following example keeps an altitude with fixed throttle:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp2&amp;quot; wp=&amp;quot;wp3&amp;quot; hmode=&amp;quot;route&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.75&amp;quot; alt=&amp;quot;ground_alt+100&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attributes related to the vertical control can also be set to replace the default altitude mode:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; vmode=&amp;quot;climb&amp;quot; climb=&amp;quot;1.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;tt&amp;gt;approaching_time&amp;lt;/tt&amp;gt; (in seconds) attribute helps to decide when the target is ''reached''. It can be set&lt;br /&gt;
to '''0''' to go over the target waypoint (default value is the '''CARROT''' time, set in the airframe configuration file).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; approaching_time=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Path ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;path&amp;lt;/tt&amp;gt; primitive is just a shorthand expression for a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives. A list of waypoints defined with the &amp;lt;tt&amp;gt;wpts&amp;lt;/tt&amp;gt; attribute is pre-processed into a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives with the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute. For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp1, wp2, wp3&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other attributes are optional:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp3, wp1, wp2&amp;quot; approaching_time=&amp;quot;1&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circle ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; primitive is the second main navigation mode: the trajectory is defined as a circle around a given waypoint with a given radius:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
A positive radius makes the UAS move clockwise, a negative counter-clockwise.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;until&amp;lt;/tt&amp;gt; attribute may be used to control the end of the stage. The following example defines an ascending trajectory at constant throttle, nose up (15 degrees), over growing circles, until the battery level is low:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;wp1&amp;quot; radius=&amp;quot;50+(GetPosAlt()-ground_alt)/2&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.75&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;10&amp;gt;PowerVoltage()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Oval ===&lt;br /&gt;
The oval consists of two half circles that are connected with two straight lines. This flight path is usefull when a IMU is used because the straights allow for level flight. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &amp;lt;oval p1=&amp;quot;1&amp;quot; p2=&amp;quot;2&amp;quot; radius=&amp;quot;nav_radius&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Eight ===&lt;br /&gt;
Fly a figure of eight that consists of two straight legs that pass though the center and the center of the half circle at the end of the two legs is in the turn around  waypoint. The altitude of the center waypoint is used for the entire figure. The turn around waypoint is moved to match radius given. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;  &amp;lt;eight center=&amp;quot;1&amp;quot; radius=&amp;quot;nav_radius&amp;quot; turn_around=&amp;quot;2&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Follow ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;follow&amp;lt;/tt&amp;gt; is a special primitive which makes the UAS follow another UAS (real or simulated, named with its &amp;lt;tt&amp;gt;ac_id&amp;lt;/tt&amp;gt;) at a given &amp;lt;tt&amp;gt;distance&amp;lt;/tt&amp;gt; (in meters) behind and at a given &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; (in meters) above.&lt;br /&gt;
&lt;br /&gt;
In this example, the autopilot will try to follow A/C number '''4''', staying '''50'''m behind and '''20'''m above.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;follow ac_id=&amp;quot;4&amp;quot; distance=&amp;quot;50&amp;quot; height=&amp;quot;20&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;traffic_info.c&amp;lt;/tt&amp;gt; file is required by this feature and the &amp;lt;tt&amp;gt;TRAFFIC_INFO&amp;lt;/tt&amp;gt; flag has to be set to enable it. Then, the following lines must be added in the airframe file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stay ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;stay&amp;lt;/tt&amp;gt; is a mode for UAS's able to hover:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;stay wp=&amp;quot;HOME&amp;quot; alt=&amp;quot;10&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XYZ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xyz&amp;lt;/tt&amp;gt; is a special mode where the UAS circles around a user moveable waypoint. This waypoint is moved with the RC sticks:&lt;br /&gt;
* YAW channel controls the point over the west-east axis;&lt;br /&gt;
* PITCH channel controls the point over the south-north axis;&lt;br /&gt;
* ROLL channel controls the altitude.&lt;br /&gt;
&lt;br /&gt;
Example (default radius is '''100'''):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;xyz radius=&amp;quot;40&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Set ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt; element is a dangerous one which should be used only by expert users: it is used to directly set an internal variable of the autopilot. For example, you can change the value of the default ground altitude, a variable used by the home mode failsafe procedure (and maybe by your own flight plan):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;set var=&amp;quot;ground_alt&amp;quot; value=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This directive is extremely powerful and has great potential for error - use with caution.&lt;br /&gt;
&lt;br /&gt;
=== Call ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;call&amp;lt;/tt&amp;gt; allows the user to define its own navigation procedures in C. The &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt; must be a call to a boolean function which must return TRUE as long as the stage is not completed (a function which should be called only once would then return immediately FALSE).&lt;br /&gt;
This feature is illustrated with the '''line''' pattern:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line(WP_1, WP_2, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;nav_line_init()&amp;lt;/tt&amp;gt; returns FALSE and &amp;lt;tt&amp;gt;nav_line()&amp;lt;/tt&amp;gt; always returns TRUE (this stage never ends).&lt;br /&gt;
Such functions usually are defined in a supplementary C file which must be specified in the airframe file (in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section)&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += nav_line.c&lt;br /&gt;
 sim.srcs += nav_line.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
These functions also must be declared in a header file which must be mentioned in the header element of the flight plan:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;header&amp;gt;&lt;br /&gt;
#include &amp;quot;nav_line.h&amp;quot;&lt;br /&gt;
  &amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
These C source file and H header file must be located in the &amp;lt;tt&amp;gt;sw/airborne&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
You can also call functions before or after each execution of the block (this means continuosly on each iteration of each stage of the block, not just when entering o exiting the block).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Examples ==&lt;br /&gt;
Parameters used in a flight plan can be computed expressions. In this example, the plane is asked to perform 5 circles at progressively increasing altitudes for exactly one minute at each altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;&lt;br /&gt;
          alt=&amp;quot;ground_alt + 50*$i&amp;quot;&lt;br /&gt;
          until=&amp;quot;stage_time &amp;gt; 60&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Immobilize Actuators === &lt;br /&gt;
&lt;br /&gt;
h_ctl setpoints variable are set by the h_ctl_attitude_loop() (from fw_h_ctl.c) loop) which can be disabled with the&lt;br /&gt;
h_ctl_disabled flag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_aileron_setpoint&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_elevator_setpoint&amp;quot; value=&amp;quot;MAX_PPRZ/2&amp;quot;/&amp;gt;&lt;br /&gt;
 .... waiting for a condition ...&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
&lt;br /&gt;
Procedures are libraries which can be included in flight plans. They are composed of waypoints, sectors and blocks. The header of a procedure may contain some parameters which are replaced by arguments when the procedure is included.&lt;br /&gt;
&lt;br /&gt;
Extract of the DTD: a procedure is a sequence of parameters, waypoints, ...:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!ELEMENT procedure (param*,header?,waypoints?,sectors?,exceptions?,blocks?)&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;param&amp;lt;/tt&amp;gt;eter is just a name. A parameter is optional if it is declared with a default value.&lt;br /&gt;
An example with a required and an optional parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;alt&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;radius&amp;quot; default_value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Procedures are called with the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; element in a flight plan. A procedure cannot be included twice or by another procedure. A procedure call requires:&lt;br /&gt;
&lt;br /&gt;
* the name of the procedure file, the name given to this inclusion; &lt;br /&gt;
* values for the parameters;&lt;br /&gt;
* backlinks for block name exits of the procedure.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the corresponding procedure '''landing.xml''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE procedure SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;procedure&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;AF&amp;quot; x=&amp;quot;177.4&amp;quot; y=&amp;quot;45.1&amp;quot; alt=&amp;quot;30&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;TD&amp;quot; x=&amp;quot;28.8&amp;quot; y=&amp;quot;57.0&amp;quot; alt=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;168.8&amp;quot; y=&amp;quot;-13.8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;blocks&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 &amp;gt; fabs(GetPosAlt()- WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/block&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/blocks&amp;gt;&lt;br /&gt;
  &amp;lt;/procedure&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the name of procedure '''land''' block will be renamed into '''landing.land''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing.land&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
will jump to this procedure block.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a go-around condition in your landing procedure. You would write it&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;go-around&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
then you must link this block exit with one of your block (e.g. &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt;). So you would include the procedure as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;with from=&amp;quot;go-around&amp;quot; to=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/include&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
There are many ways to skin a cat just as there are many ways to craft your flight plan. Following the best practices tips can save you from a lot of frustration and mishap.&lt;br /&gt;
&lt;br /&gt;
* Simulate your flight plan before taking it to the sky. Flight plans should always be carefully tested prior to flight, take a look at the [[Simulation|simulation]] page for details on how to simulate your plan.&lt;br /&gt;
* Make an subdirectory in the Flight_plan directory with your own name and add your flight plans there. Make sure that the location of the DTD is correct, e.g by using relative directory double dots as in &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;../flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Take a good look at other flight plans included with Paparazzi. To learn from example flight plans please visit the [[Flight_Plan_Examples|flight plan examples]] page&lt;br /&gt;
* There are several option to build failsafe features into you flightplan, [[Failsafe|for some examples visit the Failsafe page]].&lt;br /&gt;
* Some flight plan examples define waypoint locations using relative coordinates. These are relative positions from the fixed lat and lon in the header of the flight plan. When simulating your flight plan the aircraft always use the lat/lon as defined in the flight plan since a regular simulation has no notion of you current position of you local PC where you simulate on. This is something to keep in mind if you test your flight plan in real flights.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18707</id>
		<title>Flight Plans</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18707"/>
		<updated>2014-06-05T03:16:39Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Call */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''flight plan''' is a XML document which one can create and store aboard an autopilot. The flight plan will describe how you want your aircraft to travel if released into into the wild blue yonder.&lt;br /&gt;
&lt;br /&gt;
== DTD and Structure ==&lt;br /&gt;
&lt;br /&gt;
The formal description of the flight plan file is given in the [http://en.wikipedia.org/wiki/Document_Type_Definition '''DTD'''] (located in &amp;lt;tt&amp;gt;conf/flight_plans/flight_plan.dtd&amp;lt;/tt&amp;gt;). This&lt;br /&gt;
DTD must be referenced in the header of your flight plan XML document using the following line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flight plans are stored in the &amp;lt;tt&amp;gt;conf/flight_plans&amp;lt;/tt&amp;gt; directory. The [[Flight_Plan_Editor|flight plan editor]] can be used to create basic flight plans via the GUI.&lt;br /&gt;
&lt;br /&gt;
Extract from the [http://en.wikipedia.org/wiki/Document_Type_Definition DTD]:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!ELEMENT flight_plan (header?,waypoints,sectors?,include*,exceptions?,blocks)&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''A flight plan is composed of two mandatory elements: [[#waypoints|waypoints]] and [[#blocks|blocks]]'''&lt;br /&gt;
&lt;br /&gt;
The root &amp;lt;tt&amp;gt;flight_plan&amp;lt;/tt&amp;gt; element is specified with several attributes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;'''&amp;lt;flight_plan name lat0 lon0 ground_alt security_height home_mode_height qfu alt max_dist_from_home&amp;gt;'''&amp;lt;/tt&amp;gt;&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''name'''&amp;lt;/tt&amp;gt;: The name of the mission (a text string)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''lat0, lon0'''&amp;lt;/tt&amp;gt;: Defines the latitude and longitude coordinates of the reference point {0,0} in WGS84 degree coordinates&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;: The ground altitude (in meters), Above Sea Level where you are flying. It defines the &amp;lt;tt&amp;gt;GROUND_ALT&amp;lt;/tt&amp;gt; constant value which can be used in combination with a waypoint &amp;lt;height&amp;gt; parameter to define a waypoint height&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;:  The height (over &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;) used by the circle-home failsafe procedure and in other flight procedures such as formation flight and anti-collision avoidance. Warnings are produced if you place a waypoint lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; (usually the case for the landing point)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; (optional): This optional attribute available since v4.2 allows to override &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; as failsafe height in home mode. If &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; Is set lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;, the later is used. This attribute is useful if you need to return home at a high altitude rather than a low altitude.&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''qfu'''&amp;lt;/tt&amp;gt; (optional): defines the global constant &amp;lt;tt&amp;gt;QFU&amp;lt;/tt&amp;gt;. It usually is the magnetic heading in degrees (north=0, east=90) of the runway, the opposite of wind direction. This constant may be used in the mission description. It is also used by the simulator as the original course of the aircraft. So if you want to take off and climb to the West you would use qfu=270. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''alt'''&amp;lt;/tt&amp;gt;: The default altitude of waypoints ([[Altitude_definitions|Above Sea Level]]). So if your ground altitude is 400 then alt needs to be a value greater than ground altitude and above any obstructions in the flight plan. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''max_dist_from_home'''&amp;lt;/tt&amp;gt;: A radius representing the maximum allowed distance (in meters) from the HOME waypoint. Exceeding this value (ie flying outside the circle with this radius) will trigger an exception. It is up to you to define the block to be executed (ie what to do) for the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Here is an '''example''' of such a line in the top of a flight plan:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan alt=&amp;quot;250&amp;quot; ground_alt=&amp;quot;185&amp;quot; lat0=&amp;quot;43.46223&amp;quot; lon0=&amp;quot;1.27289&amp;quot; name=&amp;quot;Example Muret&amp;quot; max_dist_from_home=&amp;quot;300&amp;quot; qfu=&amp;quot;270&amp;quot; security_height=&amp;quot;25&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a flight plan could also contain optional &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt;'s and &amp;lt;tt&amp;gt;exceptions&amp;lt;/tt&amp;gt; cases.&lt;br /&gt;
&lt;br /&gt;
In English the above flight plan says the name is Example Muret. The reference coordinates for the 0,0 point is: 43.46223 (lat) and 1.27289 (long). The flying site 0,0 location is 185m above sea level. The security height is 25m above 0,0 point or 210m above sea level. The default (ie if not defined in a waypoint this alt is used) altitude is 250m (above sea level). The home mode block altitude is defined to be 150m above sea level. Also, for security, a circle is defined with a radius that's 300m from 0,0 position. This is the max_dist_from_home value. Fly 301m from 0,0 and an exception is triggered. A useful block is to trigger/go to the home mode block and return to home when the aircraft flies outside the safety circle. Example flight plans are helpful for study before you build your own from scratch.&lt;br /&gt;
&lt;br /&gt;
== Waypoints ==&lt;br /&gt;
&lt;br /&gt;
The waypoints are the geographic locations used to specify the trajectories. A waypoint is specified by it's name and coordinates:&lt;br /&gt;
 &amp;lt;tt&amp;gt;''' &amp;lt;waypoint name wpx wpy [alt] [height]/&amp;gt; '''&amp;lt;/tt&amp;gt;&lt;br /&gt;
where wpx and wpy are real positional coordinates ( &amp;lt;tt&amp;gt;'''lat/lon'''&amp;lt;/tt&amp;gt; )  '''or''' UTM coordinates ( &amp;lt;tt&amp;gt;'''utm_x0/utm_y0'''&amp;lt;/tt&amp;gt; ) '''or''' relative coordinates ( &amp;lt;tt&amp;gt;'''x/y'''&amp;lt;/tt&amp;gt; ) in meters from your reference point {0,0} .  &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; is an optional parameter and can be used to assign an altitude to a particular waypoint that is different from the globally defined &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; parameter of the flightplan. The &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; attribute can be used to set the waypoint height relative to the [[Altitude_definitions|ground altitude]] (&amp;lt;tt&amp;gt;ground_alt&amp;lt;/tt&amp;gt;) of the flight plan for this waypoint.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;HOME&amp;quot; x=&amp;quot;0.0&amp;quot; y=&amp;quot;30.0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;BRIDGEOVERRIVER&amp;quot; x=&amp;quot;-100.0&amp;quot; y=&amp;quot;60.0&amp;quot; alt=&amp;quot;270.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MyBarn&amp;quot; x=&amp;quot;-130.0&amp;quot; y=&amp;quot;217.5&amp;quot; alt=&amp;quot;3000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;3&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;4&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50.&amp;quot; alt=&amp;quot;ground_alt + 50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYHELPERSPOT&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;60&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYOTHERHELPERSPOT&amp;quot; x=&amp;quot;-70.0&amp;quot; y=&amp;quot;90&amp;quot; height=&amp;quot;70.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOWER&amp;quot; lat=&amp;quot;48.858249&amp;quot; lon=&amp;quot;2.294494&amp;quot; height=&amp;quot;324.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MountainCAFE&amp;quot; utm_x0=&amp;quot;360284.8&amp;quot; utm_y0=&amp;quot;4813595.5&amp;quot; alt=&amp;quot;1965.&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* Waypoints are easily adjusted with the [[Flight_Plan_Editor|flight plan editor]].&lt;br /&gt;
* If a waypoint name starts with an underscore ( _ ), the waypoint is '''not displayed''' in the GCS, except in editor mode.&lt;br /&gt;
* The maximum number of waypoints is 254.&lt;br /&gt;
* A waypoint named &amp;lt;tt&amp;gt;HOME&amp;lt;/tt&amp;gt; is required if the failsafe HOME mode procedure is used.&lt;br /&gt;
&lt;br /&gt;
== Sectors ==&lt;br /&gt;
&lt;br /&gt;
Flat ''Sectors'' can be described as an area defined by list of waypoint corners. Such an area will be displayed in the Ground Control Station (GCS) by colored lines connecting the cornerpoints.&lt;br /&gt;
A function is generated to check if a point, usually the aircraft itself, is ''inside'' this sector. Currently, this feature requires that the polygon is &amp;lt;b&amp;gt;convex&amp;lt;/b&amp;gt; and described in a &amp;lt;b&amp;gt;clockwise&amp;lt;/b&amp;gt; order. For a sector named &amp;lt;tt&amp;gt;MyBigGarden&amp;lt;/tt&amp;gt; the generated function for the example here would be &amp;lt;tt&amp;gt;bool_t InsideMyBigGarden(float x, float y);&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; are east and north coordinated, in meters, relative to the geographic reference of the flight plan. If the flight plan is dynamically relocated, such a sector will be relocated but the display is currently not updated on the GCS. It would be great if one would help improving that part of the source code. Note that sector names are not allowed to contain spaces.&lt;br /&gt;
&lt;br /&gt;
For example, with the following element in a flight plan.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;MyBigGarden&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is then possible to add an exception clause to your flightplan. For example if the aircraft for some reason flies outside this, defined by us, sector the airframe will fly to a standby waypoint. The exclamation mark (!) means the boolean operator &amp;lt;tt&amp;gt;NOT&amp;lt;/tt&amp;gt; in this example. In regular language one would describe &amp;quot;If my airframe is NOT inside the MyBigGarden sector anymore then deroute it to the standby waypoint. In Flightplan &amp;quot;Speak&amp;quot; this is written like: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;exception cond=&amp;quot;! InsideMyBigGarden(GetPosX(), GetPosY())&amp;quot; deroute=&amp;quot;standby&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: editing of the waypoints of the sector during the flight will not dynamically update the inside function. It will always check if the position is inside the original sector.&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* A nice option in the corner notation is that one can add an underscore ( _ ) in front of the name; a corner or waypoint name that starts with an underscore is not displayed in the GCS. Only in editor mode it is visible. It is visible in editor mode, because if you the could not see it, it also would be not possible to edit or drag the corner or waypoint to another position.&lt;br /&gt;
* The color indicating the sector borders is not fixed but can be defined by oneself if wished for via the color attribute.&lt;br /&gt;
&lt;br /&gt;
== Includes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; is used to add some flight plan elements defined in an external procedure. It’s useful to include pre-written procedures with only few arguments and then clarify the flight plan.&lt;br /&gt;
Here is the structure:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;include name procedure&amp;gt; [&amp;lt;arg name value /&amp;gt;]*[&amp;lt;with from to /&amp;gt;]*&amp;lt;/include&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; attribute of the include element will be used in this flight plan to prefix the blocks of the &amp;lt;tt&amp;gt;procedure&amp;lt;/tt&amp;gt;, the XML referenced file.&lt;br /&gt;
Named arguments may be given with their value in the &amp;lt;tt&amp;gt;arg&amp;lt;/tt&amp;gt; elements. The &amp;lt;tt&amp;gt;with&amp;lt;/tt&amp;gt; tag allows to link labels (e.g. attribute of a deroute instruction or of an exception) from the procedure to blocks of the main flight plan.&lt;br /&gt;
Then, each block of the procedure is like any block of the flight plan and is designated with a dotted identifier: block &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; of a procedure named &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; is named &amp;lt;tt&amp;gt;b.p&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;includes&amp;gt;&lt;br /&gt;
    &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/includes&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Blocks ==&lt;br /&gt;
&lt;br /&gt;
Block elements are the main part of a flight plan: they describe each unit of the mission.&lt;br /&gt;
They are made of various primitives, called stages and exceptions, you can put one after the other. When a&lt;br /&gt;
stage (or a block) is finished, the autopilot goes to the next one. The behaviour after the last stage of the last block is undefined. &lt;br /&gt;
&lt;br /&gt;
As described in the DTD, the &amp;lt;tt&amp;gt;blocks&amp;lt;/tt&amp;gt; element is composed of &amp;lt;tt&amp;gt;block&amp;lt;/tt&amp;gt; elements which are sequence of ''stages'':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT blocks (block+)&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT block  (exception|while|heading|attitude|go|xyz|set|call|circle|deroute|stay|follow|survey_rectangle|for|return|eight|oval|home|path)*&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle radius=&amp;quot;75&amp;quot; wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add a button in the [[GCS#Strips|strip of the aircraft]] with the attribute &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This button will activate the block. If the attribute &amp;lt;tt&amp;gt;group&amp;lt;/tt&amp;gt; is specified, all strip buttons of the same group will be placed vertically on top of each other.&lt;br /&gt;
&lt;br /&gt;
In the same way, a key shortcut can be specified:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block key=&amp;quot;D&amp;quot; name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Modifiers are allowed, using the syntax of [http://library.gnome.org/devel/gtk/2.15/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse GTK accelerators].&lt;br /&gt;
&lt;br /&gt;
An icon can be specified to display the button. The &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt; label then is a tooltip for the icon. The icon must be an image file available in the directory &amp;lt;tt&amp;gt;data/pictures/gcs_icons&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot; strip_button=&amp;quot;Takeoff&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expressions ====&lt;br /&gt;
&lt;br /&gt;
Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C expression is restricted to &lt;br /&gt;
* numeric constants&lt;br /&gt;
* some internal autopilot variables (not fully documented, see examples)&lt;br /&gt;
* Some binary operators: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, ==, +, -, /, *&lt;br /&gt;
* Some utility functions&lt;br /&gt;
&lt;br /&gt;
Some examples of usable expressions are given in the next sections.&lt;br /&gt;
=== Initialization  Blocks ===&lt;br /&gt;
Most flight plans will have three blocks of flight plan initialization blocks. It is good practice to follow this example below if you first start learing to create flightplans&lt;br /&gt;
&lt;br /&gt;
The first block waits until the GPS fix has been established, as shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Wait GPS&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The second block updates the local waypoints with respect to the UAV.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Geo init&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;LessThan(NavBlockTime(), 10)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;NavSetGroundReferenceHere()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This next block prevents the UAV from starting the engine and taking off. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Holding point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!--set var=&amp;quot;nav_mode&amp;quot; value=&amp;quot;NAV_MODE_ROLL&amp;quot;/--&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;attitude roll=&amp;quot;0&amp;quot; throttle=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exceptions ===&lt;br /&gt;
&lt;br /&gt;
The flight manager can handle exceptions. They consist in conditions checked periodically (at the same pace as the navigation control), allowing the control to jump to a given block. Here is the syntax of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;...&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; is an expression and &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the name of the block we want to switch to as soon as the condition is true.&lt;br /&gt;
&lt;br /&gt;
Here are some example of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;10 &amp;gt; PowerVoltage()&amp;quot; deroute=&amp;quot;go_down&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(ground_alt+10 &amp;gt; GetPosAlt())&amp;quot; deroute=&amp;quot;go_up&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(autopilot_flight_time &amp;gt; 840)&amp;quot; deroute=&amp;quot;quick_land&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions can be local to a block or global to the flight plan, in the &amp;lt;tt&amp;gt;&amp;lt;exceptions&amp;gt;&amp;lt;/tt&amp;gt; element. In the following example, time since last reception of a message from the ground station is monitored and the navigation is switched to the &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt; block if no message have been received for 22s. This exception is valid for '''all''' the blocks.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan ...&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt; ... &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;exceptions&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;datalink_time &amp;gt; 22&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/exceptions&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt; ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deroute ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the ''goto'' directive of the flight plan; it switches the navigation to the given block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this primitive should not be used to execute loops which are provided by the following elements.&lt;br /&gt;
&lt;br /&gt;
=== Loops ===&lt;br /&gt;
&lt;br /&gt;
Unbounded loops are written with &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; elements whose &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; attribute is a boolean expression.&lt;br /&gt;
Children  of &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; are stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;while cond=&amp;quot;TRUE&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;B&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;go wp=&amp;quot;C&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;while cond=&amp;quot;5 &amp;gt; stage_time&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/while&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In this example, we run an infinite loop, lettin the aircraft try to go via waypoints &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; and waiting for 5 seconds before repeating.&lt;br /&gt;
&lt;br /&gt;
Bounded loops are written with the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; tag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;0&amp;quot; to=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where the body of the loop will be run four times.&lt;br /&gt;
&lt;br /&gt;
The variable of a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop can be used inside expressions appearing as attributes of the stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot; alt=&amp;quot;ground_alt+50*$i&amp;quot; until=&amp;quot;stage_time&amp;gt;10&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the aircraft will circle around waypoint '''HOME''' for 10 seconds at and altitude above ground of 50m, 10 seconds at altitude 100 meter (50+50), ... until 250m (5x +50).&lt;br /&gt;
&lt;br /&gt;
Note: Two bounded loops using the same control variable are not allowed in the same block.&lt;br /&gt;
&lt;br /&gt;
=== Navigation modes ===&lt;br /&gt;
&lt;br /&gt;
Navigation modes give the description of the desired trajectory in 3D. While the horizontal mode is specified through&lt;br /&gt;
''stages'', the vertical control is specified with various attributes of these stages. The current available navigation stages are&lt;br /&gt;
* attitude : just keep a fixed attitude;&lt;br /&gt;
* heading : keep a given course;&lt;br /&gt;
* go : go to a given waypoint;&lt;br /&gt;
* path : list of waypoints linked by ''go''&lt;br /&gt;
* circle : circle around a waypoint;&lt;br /&gt;
* oval : two half circles with a straight between two nav points&lt;br /&gt;
* eight : fly a figure of eight through a waypoint and around another&lt;br /&gt;
* stay : hold the position (hard to realize for a fixed-wing aircraft);&lt;br /&gt;
* follow : follow another aircraft;&lt;br /&gt;
* xyz : circle around a point moveable with the RC transmitter stick (obsolete with the datalink).&lt;br /&gt;
&lt;br /&gt;
The vertical control is achieved using the &amp;lt;tt&amp;gt;vmode&amp;lt;/tt&amp;gt; attribute of these stages. The possible values are &lt;br /&gt;
* '''alt''' (the default) : the autopilot keeps the desired altitude which is the altitude of the waypoint (if any) or the altitude specified with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute;&lt;br /&gt;
* '''climb''' : the autopilot keeps the desired vertical speed specified with the &amp;lt;tt&amp;gt;climb&amp;lt;/tt&amp;gt; attribute (in m/s);&lt;br /&gt;
* '''throttle''' : the autopilots sets the desired throttle specified with the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute (between 0 and 1);&lt;br /&gt;
* '''glide''' : the autopilot keeps the desired slope between two waypoints&lt;br /&gt;
&lt;br /&gt;
The default control is done with the throttle. However, setting the &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute to '''auto''' and the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute to a constant allows a vertical control only by controlling the attitude of the A/C.&lt;br /&gt;
The &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute also can be set to any value (in degrees) while the throttle control is in use: it usually affects the airspeed of the aircraft.  &lt;br /&gt;
&lt;br /&gt;
The different navigation modes are detailed in the next sections.&lt;br /&gt;
&lt;br /&gt;
=== Attitude ===&lt;br /&gt;
&lt;br /&gt;
Element &amp;lt;tt&amp;gt;attitude&amp;lt;/tt&amp;gt; is the navigation mode which corresponds to the current lowest control loop for horizontal mode.&lt;br /&gt;
The autopilot then keeps a constant attitude. The &amp;lt;tt&amp;gt;roll&amp;lt;/tt&amp;gt; attribute is required (in degrees, positive to put right wing low).&lt;br /&gt;
&lt;br /&gt;
To fly away, at constant airspeed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;, throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To fly around, holding a given altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;30&amp;quot; alt=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is not a ''safe'' navigation mode since the geographic position of the plane is not controlled. However, this mode is useful to tune the roll attitude control loop.&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;heading&amp;lt;/tt&amp;gt; primitive is relative to the second level loop for horizontal mode in the autopilot which will keep the given &amp;lt;tt&amp;gt;course&amp;lt;/tt&amp;gt;, a required attribute (in degrees, clockwise, north=0, east=90).&lt;br /&gt;
&lt;br /&gt;
One example to takeoff, following the QFU, 80% throttle, nose up (15 degrees) until height of 30m is reached:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;heading course=&amp;quot;QFU&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.8&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;(GetPosAlt() &amp;gt; ground_alt+30)&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Go ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitive is probably the most useful one. Basically, the autopilot will try to join a given waypoint (&amp;lt;tt&amp;gt;wp&amp;lt;/tt&amp;gt;, the only required attribute). So the simplest thing you can ask for is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go wp=&amp;quot;HOME&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
which will set the '''HOME''' waypoint as the desired target position. Note than since &amp;lt;tt&amp;gt;vmode=&amp;quot;alt&amp;quot;&amp;lt;/tt&amp;gt; is the default, the altitude of the target waypoint is also taken into account. The navigation will switch to the next stage as soon as the target is reached.&lt;br /&gt;
&lt;br /&gt;
It is usually not a good idea to try to join a waypoint without asking for a precise trajectory, i.e. a given line.&lt;br /&gt;
Setting the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute to '''route''', the navigation will go over a segment joining two waypoints:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target altitude is the altitude of the target waypoint; it can also be set with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute. The following example keeps an altitude with fixed throttle:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp2&amp;quot; wp=&amp;quot;wp3&amp;quot; hmode=&amp;quot;route&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.75&amp;quot; alt=&amp;quot;ground_alt+100&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attributes related to the vertical control can also be set to replace the default altitude mode:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; vmode=&amp;quot;climb&amp;quot; climb=&amp;quot;1.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;tt&amp;gt;approaching_time&amp;lt;/tt&amp;gt; (in seconds) attribute helps to decide when the target is ''reached''. It can be set&lt;br /&gt;
to '''0''' to go over the target waypoint (default value is the '''CARROT''' time, set in the airframe configuration file).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; approaching_time=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Path ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;path&amp;lt;/tt&amp;gt; primitive is just a shorthand expression for a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives. A list of waypoints defined with the &amp;lt;tt&amp;gt;wpts&amp;lt;/tt&amp;gt; attribute is pre-processed into a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives with the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute. For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp1, wp2, wp3&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other attributes are optional:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp3, wp1, wp2&amp;quot; approaching_time=&amp;quot;1&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circle ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; primitive is the second main navigation mode: the trajectory is defined as a circle around a given waypoint with a given radius:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
A positive radius makes the UAS move clockwise, a negative counter-clockwise.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;until&amp;lt;/tt&amp;gt; attribute may be used to control the end of the stage. The following example defines an ascending trajectory at constant throttle, nose up (15 degrees), over growing circles, until the battery level is low:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;wp1&amp;quot; radius=&amp;quot;50+(GetPosAlt()-ground_alt)/2&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.75&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;10&amp;gt;PowerVoltage()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Oval ===&lt;br /&gt;
The oval consists of two half circles that are connected with two straight lines. This flight path is usefull when a IMU is used because the straights allow for level flight. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &amp;lt;oval p1=&amp;quot;1&amp;quot; p2=&amp;quot;2&amp;quot; radius=&amp;quot;nav_radius&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Eight ===&lt;br /&gt;
Fly a figure of eight that consists of two straight legs that pass though the center and the center of the half circle at the end of the two legs is in the turn around  waypoint. The altitude of the center waypoint is used for the entire figure. The turn around waypoint is moved to match radius given. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;  &amp;lt;eight center=&amp;quot;1&amp;quot; radius=&amp;quot;nav_radius&amp;quot; turn_around=&amp;quot;2&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Follow ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;follow&amp;lt;/tt&amp;gt; is a special primitive which makes the UAS follow another UAS (real or simulated, named with its &amp;lt;tt&amp;gt;ac_id&amp;lt;/tt&amp;gt;) at a given &amp;lt;tt&amp;gt;distance&amp;lt;/tt&amp;gt; (in meters) behind and at a given &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; (in meters) above.&lt;br /&gt;
&lt;br /&gt;
In this example, the autopilot will try to follow A/C number '''4''', staying '''50'''m behind and '''20'''m above.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;follow ac_id=&amp;quot;4&amp;quot; distance=&amp;quot;50&amp;quot; height=&amp;quot;20&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;traffic_info.c&amp;lt;/tt&amp;gt; file is required by this feature and the &amp;lt;tt&amp;gt;TRAFFIC_INFO&amp;lt;/tt&amp;gt; flag has to be set to enable it. Then, the following lines must be added in the airframe file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stay ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;stay&amp;lt;/tt&amp;gt; is a mode for UAS's able to hover:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;stay wp=&amp;quot;HOME&amp;quot; alt=&amp;quot;10&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XYZ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xyz&amp;lt;/tt&amp;gt; is a special mode where the UAS circles around a user moveable waypoint. This waypoint is moved with the RC sticks:&lt;br /&gt;
* YAW channel controls the point over the west-east axis;&lt;br /&gt;
* PITCH channel controls the point over the south-north axis;&lt;br /&gt;
* ROLL channel controls the altitude.&lt;br /&gt;
&lt;br /&gt;
Example (default radius is '''100'''):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;xyz radius=&amp;quot;40&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Set ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt; element is a dangerous one which should be used only by expert users: it is used to directly set an internal variable of the autopilot. For example, you can change the value of the default ground altitude, a variable used by the home mode failsafe procedure (and maybe by your own flight plan):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;set var=&amp;quot;ground_alt&amp;quot; value=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This directive is extremely powerful and has great potential for error - use with caution.&lt;br /&gt;
&lt;br /&gt;
=== Call ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;call&amp;lt;/tt&amp;gt; allows the user to define its own navigation procedures in C. The &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt; must be a call to a boolean function which must return TRUE as long as the stage is not completed (a function which should be called only once would then return immediately FALSE).&lt;br /&gt;
This feature is illustrated with the '''line''' pattern:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line(WP_1, WP_2, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;nav_line_init()&amp;lt;/tt&amp;gt; returns FALSE and &amp;lt;tt&amp;gt;nav_line()&amp;lt;/tt&amp;gt; always returns TRUE (this stage never ends).&lt;br /&gt;
Such functions usually are defined in a supplementary C file which must be specified in the airframe file (in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section)&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += nav_line.c&lt;br /&gt;
 sim.srcs += nav_line.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
These functions also must be declared in a header file which must be mentioned in the header element of the flight plan:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;header&amp;gt;&lt;br /&gt;
#include &amp;quot;nav_line.h&amp;quot;&lt;br /&gt;
  &amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
These C source file and H header file must be located in the &amp;lt;tt&amp;gt;sw/airborne&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
You can also call functions before or after each execution of the block (this means continually on each iteration of each stage of the block, not just when entering o exiting the block).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Examples ==&lt;br /&gt;
Parameters used in a flight plan can be computed expressions. In this example, the plane is asked to perform 5 circles at progressively increasing altitudes for exactly one minute at each altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;&lt;br /&gt;
          alt=&amp;quot;ground_alt + 50*$i&amp;quot;&lt;br /&gt;
          until=&amp;quot;stage_time &amp;gt; 60&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Immobilize Actuators === &lt;br /&gt;
&lt;br /&gt;
h_ctl setpoints variable are set by the h_ctl_attitude_loop() (from fw_h_ctl.c) loop) which can be disabled with the&lt;br /&gt;
h_ctl_disabled flag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_aileron_setpoint&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_elevator_setpoint&amp;quot; value=&amp;quot;MAX_PPRZ/2&amp;quot;/&amp;gt;&lt;br /&gt;
 .... waiting for a condition ...&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
&lt;br /&gt;
Procedures are libraries which can be included in flight plans. They are composed of waypoints, sectors and blocks. The header of a procedure may contain some parameters which are replaced by arguments when the procedure is included.&lt;br /&gt;
&lt;br /&gt;
Extract of the DTD: a procedure is a sequence of parameters, waypoints, ...:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!ELEMENT procedure (param*,header?,waypoints?,sectors?,exceptions?,blocks?)&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;param&amp;lt;/tt&amp;gt;eter is just a name. A parameter is optional if it is declared with a default value.&lt;br /&gt;
An example with a required and an optional parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;alt&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;radius&amp;quot; default_value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Procedures are called with the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; element in a flight plan. A procedure cannot be included twice or by another procedure. A procedure call requires:&lt;br /&gt;
&lt;br /&gt;
* the name of the procedure file, the name given to this inclusion; &lt;br /&gt;
* values for the parameters;&lt;br /&gt;
* backlinks for block name exits of the procedure.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the corresponding procedure '''landing.xml''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE procedure SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;procedure&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;AF&amp;quot; x=&amp;quot;177.4&amp;quot; y=&amp;quot;45.1&amp;quot; alt=&amp;quot;30&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;TD&amp;quot; x=&amp;quot;28.8&amp;quot; y=&amp;quot;57.0&amp;quot; alt=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;168.8&amp;quot; y=&amp;quot;-13.8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;blocks&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 &amp;gt; fabs(GetPosAlt()- WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/block&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/blocks&amp;gt;&lt;br /&gt;
  &amp;lt;/procedure&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the name of procedure '''land''' block will be renamed into '''landing.land''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing.land&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
will jump to this procedure block.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a go-around condition in your landing procedure. You would write it&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;go-around&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
then you must link this block exit with one of your block (e.g. &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt;). So you would include the procedure as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;with from=&amp;quot;go-around&amp;quot; to=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/include&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
There are many ways to skin a cat just as there are many ways to craft your flight plan. Following the best practices tips can save you from a lot of frustration and mishap.&lt;br /&gt;
&lt;br /&gt;
* Simulate your flight plan before taking it to the sky. Flight plans should always be carefully tested prior to flight, take a look at the [[Simulation|simulation]] page for details on how to simulate your plan.&lt;br /&gt;
* Make an subdirectory in the Flight_plan directory with your own name and add your flight plans there. Make sure that the location of the DTD is correct, e.g by using relative directory double dots as in &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;../flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Take a good look at other flight plans included with Paparazzi. To learn from example flight plans please visit the [[Flight_Plan_Examples|flight plan examples]] page&lt;br /&gt;
* There are several option to build failsafe features into you flightplan, [[Failsafe|for some examples visit the Failsafe page]].&lt;br /&gt;
* Some flight plan examples define waypoint locations using relative coordinates. These are relative positions from the fixed lat and lon in the header of the flight plan. When simulating your flight plan the aircraft always use the lat/lon as defined in the flight plan since a regular simulation has no notion of you current position of you local PC where you simulate on. This is something to keep in mind if you test your flight plan in real flights.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=18706</id>
		<title>Rotorcraft Configuration</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=18706"/>
		<updated>2014-06-05T02:30:38Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Autopilot modes */ details on horiz guidance for hover modes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Airframe_Configuration&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This page describes configuration options &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;lt;b&amp;gt;specific to the rotorcraft firmware&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt; in the [[Airframe_Configuration|airframe file]].&lt;br /&gt;
&lt;br /&gt;
== Firmware and Hardware definitions ==&lt;br /&gt;
&lt;br /&gt;
This is one example of a pretty standard quadcopter firmware definition:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;nps&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot; board=&amp;quot;lisa_m_1.0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;radio_control&amp;quot; type=&amp;quot;ppm&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot;     type=&amp;quot;mkk&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;imu&amp;quot;           type=&amp;quot;aspirin_v1.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;gps&amp;quot;           type=&amp;quot;ublox&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;ahrs&amp;quot;          type=&amp;quot;int_cmpl_quat&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;stabilization&amp;quot; type=&amp;quot;int_quat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Select your Board ===&lt;br /&gt;
Make sure you use the &amp;lt;b&amp;gt;rotorcraft [[Airframe_Configuration#Firmware|firmware]]&amp;lt;/b&amp;gt; and choose the correct board, e.g.&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;sim&amp;quot; 	board=&amp;quot;pc&amp;quot;/&amp;gt;       &amp;lt;!-- For simulation --&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot; 	board=&amp;quot;lisa_m_2.0&amp;quot;/&amp;gt; &amp;lt;!-- Select your board here --&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The ap board name can be found in /conf/boards.&lt;br /&gt;
&lt;br /&gt;
=== Actuators ===&lt;br /&gt;
You have to specify which ESCs you have by adding the appropriate [[Subsystem/actuators|actuators subsystem.]]&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot; board=&amp;quot;booz_1.0&amp;quot;/&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;mkk&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Control Loops ===&lt;br /&gt;
See the [[Subsystem/stabilization|stabilization subsystem]] page to choose which attitude control algorithm to use and how to configure them.&lt;br /&gt;
&lt;br /&gt;
The [[Control Loops]] page has some diagrams.&lt;br /&gt;
&lt;br /&gt;
=== INS ===&lt;br /&gt;
The INS (Integrated Navigation System) subsystem contains estimations filter to e.g. fuse GPS and IMU data for better position and speed estimates.&lt;br /&gt;
The INS subsystem is optional in &amp;lt;= v4.2.&lt;br /&gt;
&lt;br /&gt;
Since v4.9x the INS subsystem is mandatory, to use the same as in v4.2 omit the type.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot; board=&amp;quot;booz_1.0&amp;quot;/&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;ins&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot; board=&amp;quot;booz_1.0&amp;quot;/&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;ins&amp;quot; type=&amp;quot;hff&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;GPS_LAG=0.2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Motor Arming ==&lt;br /&gt;
By default the motors are armed with zero-throttle and full yaw. The motors are never started if AHRS is not aligned (disable it with AUTOPILOT_DISABLE_AHRS_KILL).&lt;br /&gt;
&lt;br /&gt;
Other arming sequences can be configured:&lt;br /&gt;
* USE_KILL_SWITCH_FOR_MOTOR_ARMING defined (to 1):&lt;br /&gt;
** switch kill switch off to arm the motors&lt;br /&gt;
** if kill switch is off during startup, you need to kill again first, then unkill to start&lt;br /&gt;
** throttle needs to be down, other sticks centered to start motors&lt;br /&gt;
** need to be in manual mode to start the motors&lt;br /&gt;
&lt;br /&gt;
* USE_THROTTLE_FOR_MOTOR_ARMING defined (to 1):&lt;br /&gt;
** automatically start motors when applying throttle&lt;br /&gt;
** if throttle was not down at startup, you need to put throttle down again first&lt;br /&gt;
** other sticks need to be centered to start motors&lt;br /&gt;
** need to be in manual mode to start the motors&lt;br /&gt;
&lt;br /&gt;
== Autopilot modes ==&lt;br /&gt;
For rotorcrafts we have a lot of different modes that can be mapped to your 3-position switch (Manual, Auto1, Auto2).&lt;br /&gt;
The horizontal and vertical mode can be set differently as the following possible modes indicate (in parenthesis are the abbreviations displayed in the [[GCS#Strips|GCS]] strip).&lt;br /&gt;
&lt;br /&gt;
'''Limiting max thrust via RC'''&amp;lt;br&amp;gt;&lt;br /&gt;
Modes with 'automatic' thrust control (e.g. x_Z_HOLD and NAV) let you limit the maximum thrust via RC by default. So you should push your throttle stick up after entering such a mode so the vertical controller has some &amp;quot;room&amp;quot; to stabilize the altitude. Should something weird happen you can limit the max thrust by taking throttle back.&amp;lt;br&amp;gt; You can turn this behavior off by defining '''NO_RC_THRUST_LIMIT'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_FAILSAFE (SAFE) :&lt;br /&gt;
This is a failsafe mode that gets triggered if:&lt;br /&gt;
* RC signal is lost (and you are not in KILL or NAV mode)&lt;br /&gt;
* GPS and RC is lost in NAV mode&lt;br /&gt;
The standard behaviour is that autopilot will level the rotorcraft out (setpoints to zero pitch and roll angles) and descend at 0.5m/s downwards. But this behavior can also be changed to something else ofcourse.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_KILL (KILL) :&lt;br /&gt;
Motors are simply switched off.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RATE_DIRECT (RATE) :&lt;br /&gt;
This is basically the &amp;quot;most&amp;quot; manual mode you can get. You control not the attitude (roll and pitch angles) but the rotation rate. You also set the throttle directly with your RC.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_DIRECT (ATT) :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles), but the throttle directly proportional to your stick position.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RATE_RC_CLIMB (R_RCC) :&lt;br /&gt;
You control the rotation rate and the vertical speed according to your throttle stick position.&amp;lt;br&amp;gt;If you have your throttle stick in the middle position, the altitude is kept, down goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it can recenter itself.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_RC_CLIMB (A_RCC) :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles) and the vertical speed according to your throttle stick position.&amp;lt;br&amp;gt;If you have your throttle stick in the middle position the altitude is kept, if you move the stick down it goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it recenter itself.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_CLIMB (ATT_C) :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles) and the vertical speed. The vertical speed is set via fms (e.g. joystick).&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RATE_Z_HOLD (R_ZH) :&lt;br /&gt;
You control the rotation rate and it holds the altitude you were at when entering this mode.&amp;lt;br&amp;gt;Your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_Z_HOLD (A_ZH) :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles) and it holds the altitude you were at when entering this mode.&amp;lt;br&amp;gt;Your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_DIRECT (HOVER) :&lt;br /&gt;
The rotorcraft hovers at the horizontal position you were at when entering this mode (position control). You still set the throttle directly with your RC. Yaw command on the RC allows for heading change. If USE_SPEED_REF=1 then pitch and roll commands in the RC control speed according to max speed set with REF_MAX_SPEED in the GUIDANCE_H section of airframe file.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_CLIMB (HOV_C) :&lt;br /&gt;
The rotorcraft hovers at the position you were at when entering this mode (position control). RC commands work the same as in HOVER mode. The vertical speed is set via fms (e.g. joystick).&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_Z_HOLD (H_ZH):&lt;br /&gt;
The rotorcraft hovers at the 3D position you were at when entering this mode (position and altitude control).  RC commands work the same as in HOVER mode. &amp;lt;br&amp;gt;Your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_NAV (NAV) :&lt;br /&gt;
Full navigation mode. The rotorcraft follows your flightplan.&amp;lt;br&amp;gt;If you have a valid RC signal, your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RC_DIRECT (RC_D) :&lt;br /&gt;
Safety pilot direct commands for helicopter.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_CARE_FREE_DIRECT (CF):&lt;br /&gt;
Safety pilot direct commands for helicopter, but the roll and pitch commands are based on the yaw angle when entering this mode.&lt;br /&gt;
&lt;br /&gt;
== XML Parameters ==&lt;br /&gt;
&lt;br /&gt;
=== Mode ===&lt;br /&gt;
In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;MODE&amp;quot; prefix=&amp;quot;MODE_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MANUAL&amp;quot; value=&amp;quot;AP_MODE_ATTITUDE_DIRECT&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO1&amp;quot; value=&amp;quot;AP_MODE_ATTITUDE_Z_HOLD&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO2&amp;quot; value=&amp;quot;AP_MODE_NAV&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Commands ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;commands&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; lists the abstract commands you need to control the aircraft. For most multicopter you just need:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;commands&amp;gt;&lt;br /&gt;
    &amp;lt;axis name=&amp;quot;PITCH&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;axis name=&amp;quot;ROLL&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;axis name=&amp;quot;YAW&amp;quot; failsafe_value=&amp;quot;0 /&amp;gt;&lt;br /&gt;
    &amp;lt;axis name=&amp;quot;THRUST&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/commands&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each command is also associated with a failsafe value which will be used if no controller is active, for example during initialization of the autopilot board.&lt;br /&gt;
&lt;br /&gt;
=== Motor Mixing ===&lt;br /&gt;
&lt;br /&gt;
This section describes the &amp;quot;mixing&amp;quot; used for your particular multirotor configuration. This section is needed for all ESCs except &amp;quot;asctec_v1&amp;quot; wich do their mixing themselves.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:800px&amp;quot;&amp;gt;&lt;br /&gt;
Used since '''v5.0''', for previous version see [[Rotorcraft_Configuration#Supervision|Supervision]].&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;Differences with the older supervision (used prior to '''v4.9_devel-164-gdb0d004'''):&lt;br /&gt;
* names: SUPERVISION -&amp;gt; MOTOR_MIXING&lt;br /&gt;
* independent of the actuators, needs to be loaded in the subsystems and call in the command_laws section&lt;br /&gt;
* internal values have '''pprz''' format (int16, between [-9600; 9600])&lt;br /&gt;
* min and max are not needed, coming from the servos definition&lt;br /&gt;
* trim are renamed with more explicit names&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This subsystem takes ''roll'', ''pitch'', ''yaw'' and ''thrust'' commands as inputs and &amp;quot;mixes&amp;quot; them to get the final commands for your individual motors according to the layout of them. See [[RotorcraftMixing]] for the details behind this.&lt;br /&gt;
&lt;br /&gt;
Note that after mixing the separate motor commands can &amp;quot;saturate&amp;quot;, meaning you can't simply give negative thrust or more than the maximum. If a saturation is reached (desired motor command outside of possible MIN_MOTOR/MAX_MOTOR range), a saturation offset is applied to all motors in order to give attitude commands a higher priority than thrust. This offset is limited to ''MOTOR_MIXING_MAX_SATURATION_OFFSET'' (default is 10% of maximum command).&lt;br /&gt;
&lt;br /&gt;
See also [https://github.com/paparazzi/paparazzi/issues/385 issue #385].&lt;br /&gt;
&lt;br /&gt;
In '''firmware''' section:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;subsystem name=&amp;quot;motor_mixing&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configuration of the motor mixing:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;MIXING&amp;quot; prefix=&amp;quot;MOTOR_MIXING_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_ROLL&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_PITCH&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_YAW&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB_MOTOR&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SCALE&amp;quot; value=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{  0  ,    0,  256, -256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256, -256,    0,    0 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256, -256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; ''TRIM_ROLL'' : trim added to roll command&lt;br /&gt;
; ''TRIM_PITCH'' : trim added to pitch command&lt;br /&gt;
; ''TRIM_YAW'' : trim added to yaw command&lt;br /&gt;
; x''_COEF'' : roll/pitch/yaw/thrust coefficients, see [[RotorcraftMixing]] for details or the examples below&lt;br /&gt;
&lt;br /&gt;
In '''command_laws''' section (placed after section MIXING):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;command_laws&amp;gt;&lt;br /&gt;
    &amp;lt;call fun=&amp;quot;motor_mixing_run(autopilot_motors_on, FALSE, values)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;FRONT&amp;quot; value=&amp;quot;motor_mixing.commands[0]/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;BACK&amp;quot;  value=&amp;quot;motor_mixing.commands[1]/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;RIGHT&amp;quot; value=&amp;quot;motor_mixing.commands[2]/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;LEFT&amp;quot;  value=&amp;quot;motor_mixing.commands[3]/&amp;gt;&lt;br /&gt;
  &amp;lt;/command_laws&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mixing Examples ====&lt;br /&gt;
&lt;br /&gt;
Hint: If your rotors are spinning '''opposite''' to the '''direction''' shown in the picture, '''reverse signs''' in the YAW_COEF line.&lt;br /&gt;
&lt;br /&gt;
; Plus Cross : [[Image:cross_plus_simple.png|200px]]&lt;br /&gt;
Assuming that the order of motors, described in the &amp;quot;servos&amp;quot; section is FRONT, BACK, LEFT, RIGHT.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{    0,    0,  256, -256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256, -256,    0,    0 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256, -256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Time Cross : [[Image:cross_time_simple.png|200px]]&lt;br /&gt;
Assuming that the order of motors, described in the &amp;quot;servos&amp;quot; section is NE, SE, SW, NW.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{ -256, -256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256, -256, -256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256,  256, -256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Octo (time cross): [[Image:octo.jpg|border|200px]]&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{  106, -106, -256, -256, -106,  106,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256,  256,  106, -106, -256, -256, -106,  106 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256,  256, -256,  256, -256,  256, -256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256,  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Octo (plus cross): rotor 1 on x-axis (image anyone?)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{    0, -181, -256, -181,    0,  181,  256,  181 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256,  181,    0, -181, -256, -181,    0,  181 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256,  256, -256,  256, -256,  256, -256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256,  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to compute mixing for a special configuration, please see the [[RotorcraftMixing]] page.&lt;br /&gt;
&lt;br /&gt;
=== Supervision ===&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Prior to '''v5.0''' motor mixing was called supervision. Click expand to see the details.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Valid before '''v4.9_devel-164-gdb0d004'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;SUPERVISION&amp;quot; prefix=&amp;quot;SUPERVISION_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;STOP_MOTOR&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt; &amp;lt;!-- this defaults to zero, set to a different value if needed, e.g. for pwm controllers --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MIN_MOTOR&amp;quot; value=&amp;quot;3&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MAX_MOTOR&amp;quot; value=&amp;quot;200&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_A&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_E&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TRIM_R&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB_MOTOR&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SCALE&amp;quot; value=&amp;quot;256&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{  0  ,    0,  256, -256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256, -256,    0,    0 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -256, -256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; ''STOP_MOTOR'' : actuator specific command value to stop the motors&lt;br /&gt;
; ''MIN_MOTOR'' : actuator specific command value for idling motors&lt;br /&gt;
; ''MAX_MOTOR'' : actuator specific command value for maximum power&lt;br /&gt;
; ''TRIM_A'' : trim added to roll command&lt;br /&gt;
; ''TRIM_E'' : trim added to pitch command&lt;br /&gt;
; ''TRIM_R'' : trim added to yaw command&lt;br /&gt;
; x''_COEF'' : roll/pitch/yaw/thrust coefficients, see [[RotorcraftMixing]] for details or the examples in the above Motor Mixing section&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Guidance ===&lt;br /&gt;
There are two sets of parameters for guidance: vertical (altitude) and horizontal (position).&lt;br /&gt;
&lt;br /&gt;
==== vertical guidance ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;GUIDANCE_V&amp;quot; prefix=&amp;quot;GUIDANCE_V_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;HOVER_KP&amp;quot;    value=&amp;quot;150&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;HOVER_KD&amp;quot;    value=&amp;quot;80&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;HOVER_KI&amp;quot;    value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- optional parameters --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADAPT_THROTTLE_ENABLED&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MIN_ZD&amp;quot; value=&amp;quot;-3.0&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_ZD&amp;quot; value=&amp;quot;3.0&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MAX_RC_CLIMB_SPEED&amp;quot; value=&amp;quot;-3.0&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MAX_RC_DESCENT_SPEED&amp;quot; value=&amp;quot;3.0&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; ''HOVER_K''x : PID parameters for vertical hover control loop&lt;br /&gt;
; ''NOMINAL_HOVER_THROTTLE'' : expected throttle percentage needed for hovering (default is 0.4 = 40%)&lt;br /&gt;
; ''ADAPT_THROTTLE_ENABLED'' : enable adaptive nominal hover throttle estimation (default is TRUE, set to FALSE to disable)&lt;br /&gt;
; ''REF_MIN_ZD'' : vertical speed reference lower limit (since z-down is positive -&amp;gt; max speed upwards) (default -3.0m/s)&lt;br /&gt;
; ''REF_MAX_ZD'' : vertical speed reference upper limit (since z-down is positive -&amp;gt; max speed downwards) (default 3.0m/s)&lt;br /&gt;
; ''MAX_RC_CLIMB_SPEED'' : climb speed at max RC input in RC_CLIMB mode (default is ''REF_MIN_ZD'')&lt;br /&gt;
; ''MAX_RC_DESCENT_SPEED'' : descent speed at max RC input in RC_CLIMB mode (default is ''REF_MAX_ZD'')&lt;br /&gt;
&lt;br /&gt;
==== horizontal guidance ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;GUIDANCE_H&amp;quot; prefix=&amp;quot;GUIDANCE_H_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PGAIN&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DGAIN&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IGAIN&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- optional parameters --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AGAIN&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;VGAIN&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;MAX_BANK&amp;quot; value=&amp;quot;20&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_SPEED_REF&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_SPEED&amp;quot; value=&amp;quot;5.0&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_ACCEL&amp;quot; value=&amp;quot;5.66&amp;quot; unit=&amp;quot;m/s2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_OMEGA&amp;quot; value=&amp;quot;67&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_ZETA&amp;quot; value=&amp;quot;0.85&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_TAU&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;APPROX_FORCE_BY_THRUST&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; [PID]''GAIN'' : PID gains for horizontal control&lt;br /&gt;
; ''AGAIN'' : acceleration feedforward gain (default 0)&lt;br /&gt;
; ''VGAIN'' : velocity feedforward gain (default 0)&lt;br /&gt;
; ''MAX_BANK'' : maximum roll/pitch angle that is set from horizontal guidance (default 20deg, max 40deg)&lt;br /&gt;
; ''USE_SPEED_REF'' : since v5.1, give velocity commands via RC in GUIDANCE_H_MODE_HOVER (default: TRUE)&lt;br /&gt;
; ''REF_MAX_SPEED'' : maximum reference horizontal speed in m/s (default 5.0m/s)&lt;br /&gt;
; ''REF_MAX_ACCEL'' : maximum reference horizontal acceleration in m/s² (default tanf(RadOfDeg(30.))*9.81 = 5.66)&lt;br /&gt;
; ''REF_OMEGA'' : second order model natural frequency&lt;br /&gt;
; ''REF_ZETA'' : second order model damping&lt;br /&gt;
; ''REF_TAU'' : first order time constant&lt;br /&gt;
; ''APPROX_FORCE_BY_THRUST'' : try to better approximate force commands by taking thrust into account (default FALSE, set to TRUE to use it)&lt;br /&gt;
&lt;br /&gt;
=== Simulation ===&lt;br /&gt;
See [[NPS]] (New Paparazzi Sim).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Airframe_Configuration]] [[Category:User_Documentation]] [[Category:Rotorcraft]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Module/GPS_UBlox_UCenter&amp;diff=18703</id>
		<title>Module/GPS UBlox UCenter</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Module/GPS_UBlox_UCenter&amp;diff=18703"/>
		<updated>2014-06-03T02:52:01Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Debug */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Modules&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
If you use a µ-blox GPS without flash memory, this module will take over the task of initializing the GPS for you when you power your autopilot.&lt;br /&gt;
&lt;br /&gt;
It has auto-baudrate to detect the current GPS baudrate, and configures all message rates and communication ports. The module will send a DEBUG message (ID 26) that indicates the firmware version in your GPS, the previous baudrate, and the reply for each configuration step. To enable and view the message, you will need to define DEBUG_GPS_UBX_UCENTER as TRUE in your [[Airframe_Configuration|airframe configuration]] file and select to receive that message in your [[Telemetry|telemetry]] file. See the example below for more details.&lt;br /&gt;
&lt;br /&gt;
It will configure the following settings:&lt;br /&gt;
* set baudrate to GPS_BAUD (typically either 38400 or 57600)&lt;br /&gt;
* enable the NAV_POSLLH, NAV_VELNED, NAV_STATUS, NAV_SVINFO, NAV_SOL&lt;br /&gt;
* disable UTM on old Lea4P by not sending NAV_POSUTM&lt;br /&gt;
* enable SBAS&lt;br /&gt;
* configure it to 3D only fix&lt;br /&gt;
* set the internal dynamic model to Airborne 2G&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Basic ==&lt;br /&gt;
&lt;br /&gt;
Add the gps_ubx_ucenter [[Modules|module]] to the &amp;quot;modules&amp;quot; section in your aircraft configuration file:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advanced ==&lt;br /&gt;
&lt;br /&gt;
You can specify to a different dynamic model for the u-blox.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;GPS_UBX_NAV5_DYNAMICS&amp;quot; value=&amp;quot;NAV5_DYN_PORTABLE&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Additional details on GPS_UBX_NAV5_DYNAMICS'''&lt;br /&gt;
&lt;br /&gt;
The ublox GPS uses a dynamics model (motion model) to filter the noisy GPS readings and produce smoother results. The dynamics&lt;br /&gt;
model will affect what positions and speeds are accurately tracked by GPS. Generally, it is recommend to use NAV5_DYN_PORTABLE for quadcopters and NAV5_DYN_AIRBORNE_2G for fixed wings.&lt;br /&gt;
&lt;br /&gt;
The follow is taken from the ublox protocol specification document:&lt;br /&gt;
&lt;br /&gt;
u-blox positioning technology supports different dynamic platform models to adjust the navigation engine to&lt;br /&gt;
the expected application environment. These platform settings can be changed dynamically without performing&lt;br /&gt;
a power cycle or reset. The settings improve the receiver's interpretation of the measurements and thus provide&lt;br /&gt;
a more accurate position output. Setting the receiver to an unsuitable platform model for the given application&lt;br /&gt;
environment results in a loss of receiver performance and position accuracy.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ '''Dynamic Platform Model'''&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_PORTABLE&lt;br /&gt;
| Applications with low acceleration, e.g. portable devices. Suitable for most situations. MAX Altitude [m]: 12000, MAX Velocity [m/s]: 310, MAX Vertical Velocity [m/s]: 50, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_STATIONARY&lt;br /&gt;
| Used in timing applications (antenna must be stationary) or other stationary applications. Velocity restricted to 0 m/s. Zero dynamics assumed. MAX Altitude [m]: 9000, MAX Velocity [m/s]: 10, MAX Vertical Velocity [m/s]: 6, Sanity check type: Altitude and Velocity, Max Position Deviation: Small&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_PEDESTRIAN&lt;br /&gt;
| Applications with low acceleration and speed, e.g. how a pedestrian would move. Low acceleration assumed. MAX Altitude [m]: 9000, MAX Velocity [m/s]: 30, MAX Vertical Velocity [m/s]: 20, Sanity check type: Altitude and Velocity, Max Position Deviation: Small&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AUTOMOTIVE&lt;br /&gt;
| Used for applications with equivalent dynamics to those of a passenger car. Low vertical acceleration assumed. MAX Altitude [m]: 6000 (5000 for firmware versions 6.00 and below), MAX Velocity [m/s]: 84 (62 for firmware versions 4.00 to 5.00), MAX Vertical Velocity [m/s]: 15, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_SEA&lt;br /&gt;
| Recommended for applications at sea, with zero vertical velocity. Zero vertical velocity assumed. Sea level assumed. MAX Altitude [m]: 500, MAX Velocity [m/s]: 25, MAX Vertical Velocity [m/s]: 5, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_1G&lt;br /&gt;
| Used for applications with a higher dynamic range and vertical acceleration than a passenger car. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 100, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_2G&lt;br /&gt;
| Recommended for typical airborne environment. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 250, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_4G&lt;br /&gt;
| Only recommended for extremely dynamic environments. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 500, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Debug ==&lt;br /&gt;
&lt;br /&gt;
You can specify to receive a DEBUG message over telemetry. Make changes to both the airframe and telemetry config files.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;GPS_UBX_NAV5_DYNAMICS&amp;quot; value=&amp;quot;NAV5_DYN_PORTABLE&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;DEBUG_GPS_UBX_UCENTER&amp;quot; value=&amp;quot;TRUE&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/telemetry/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     &amp;lt;message name=&amp;quot;DEBUG&amp;quot; period=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The debug messages has the following information:&lt;br /&gt;
* [0] Initial baudrate high&lt;br /&gt;
* [1] Initial baudrate low.  For example if the baud rate is 9600 you will see 9,6&lt;br /&gt;
* [2] ublox software verision high&lt;br /&gt;
* [3] ublox software version low&lt;br /&gt;
* [4] ublox hardware version high&lt;br /&gt;
* [5] ublox hardware version low&lt;br /&gt;
* [6] Always 0&lt;br /&gt;
* [7] Success of setting CFG-NAV5. For all of these a value of 0 indicates no response, 1 is success and 2 is command rejected by GPS.&lt;br /&gt;
* [8] Success of enable NAV-POSLLH&lt;br /&gt;
* [9] Success of enable NAV-VELNED&lt;br /&gt;
* [10] Success of enable NAV-STATUS&lt;br /&gt;
* [11] Success of enable NAV-SVINFO&lt;br /&gt;
* [12] Success of enable NAV-SOL&lt;br /&gt;
* [13] Success of disabling NAV-POSUTM (typically fails to 0 for non LEA-4P modules)&lt;br /&gt;
* [14] Success of enable SBAS&lt;br /&gt;
* [15] Success of setting CFG-RATE&lt;br /&gt;
* [16] Success of setting RXM-RAW (typically disabled - see USE_GPS_UBX_RXM_RAW flag to enable)&lt;br /&gt;
* [17] Success of setting RXM-SFRB (typically disabled - see USE_GPS_UBX_RXM_SFRB flag to enable)&lt;br /&gt;
* [18] Success of saving configuration to ublox memory&lt;br /&gt;
&lt;br /&gt;
If you get all zeroes then check cabling and try again. Make sure RX from the GPS is connected to TX on the autopilot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Module/GPS_UBlox_UCenter&amp;diff=18702</id>
		<title>Module/GPS UBlox UCenter</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Module/GPS_UBlox_UCenter&amp;diff=18702"/>
		<updated>2014-06-03T02:12:58Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Debug */ some clarifications and tips&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Modules&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
If you use a µ-blox GPS without flash memory, this module will take over the task of initializing the GPS for you when you power your autopilot.&lt;br /&gt;
&lt;br /&gt;
It has auto-baudrate to detect the current GPS baudrate, and configures all message rates and communication ports. The module will send a DEBUG message (ID 26) that indicates the firmware version in your GPS, the previous baudrate, and the reply for each configuration step. To enable and view the message, you will need to define DEBUG_GPS_UBX_UCENTER as TRUE in your [[Airframe_Configuration|airframe configuration]] file and select to receive that message in your [[Telemetry|telemetry]] file. See the example below for more details.&lt;br /&gt;
&lt;br /&gt;
It will configure the following settings:&lt;br /&gt;
* set baudrate to GPS_BAUD (typically either 38400 or 57600)&lt;br /&gt;
* enable the NAV_POSLLH, NAV_VELNED, NAV_STATUS, NAV_SVINFO, NAV_SOL&lt;br /&gt;
* disable UTM on old Lea4P by not sending NAV_POSUTM&lt;br /&gt;
* enable SBAS&lt;br /&gt;
* configure it to 3D only fix&lt;br /&gt;
* set the internal dynamic model to Airborne 2G&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Basic ==&lt;br /&gt;
&lt;br /&gt;
Add the gps_ubx_ucenter [[Modules|module]] to the &amp;quot;modules&amp;quot; section in your aircraft configuration file:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advanced ==&lt;br /&gt;
&lt;br /&gt;
You can specify to a different dynamic model for the u-blox.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;GPS_UBX_NAV5_DYNAMICS&amp;quot; value=&amp;quot;NAV5_DYN_PORTABLE&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Additional details on GPS_UBX_NAV5_DYNAMICS'''&lt;br /&gt;
&lt;br /&gt;
The ublox GPS uses a dynamics model (motion model) to filter the noisy GPS readings and produce smoother results. The dynamics&lt;br /&gt;
model will affect what positions and speeds are accurately tracked by GPS. Generally, it is recommend to use NAV5_DYN_PORTABLE for quadcopters and NAV5_DYN_AIRBORNE_2G for fixed wings.&lt;br /&gt;
&lt;br /&gt;
The follow is taken from the ublox protocol specification document:&lt;br /&gt;
&lt;br /&gt;
u-blox positioning technology supports different dynamic platform models to adjust the navigation engine to&lt;br /&gt;
the expected application environment. These platform settings can be changed dynamically without performing&lt;br /&gt;
a power cycle or reset. The settings improve the receiver's interpretation of the measurements and thus provide&lt;br /&gt;
a more accurate position output. Setting the receiver to an unsuitable platform model for the given application&lt;br /&gt;
environment results in a loss of receiver performance and position accuracy.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ '''Dynamic Platform Model'''&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_PORTABLE&lt;br /&gt;
| Applications with low acceleration, e.g. portable devices. Suitable for most situations. MAX Altitude [m]: 12000, MAX Velocity [m/s]: 310, MAX Vertical Velocity [m/s]: 50, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_STATIONARY&lt;br /&gt;
| Used in timing applications (antenna must be stationary) or other stationary applications. Velocity restricted to 0 m/s. Zero dynamics assumed. MAX Altitude [m]: 9000, MAX Velocity [m/s]: 10, MAX Vertical Velocity [m/s]: 6, Sanity check type: Altitude and Velocity, Max Position Deviation: Small&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_PEDESTRIAN&lt;br /&gt;
| Applications with low acceleration and speed, e.g. how a pedestrian would move. Low acceleration assumed. MAX Altitude [m]: 9000, MAX Velocity [m/s]: 30, MAX Vertical Velocity [m/s]: 20, Sanity check type: Altitude and Velocity, Max Position Deviation: Small&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AUTOMOTIVE&lt;br /&gt;
| Used for applications with equivalent dynamics to those of a passenger car. Low vertical acceleration assumed. MAX Altitude [m]: 6000 (5000 for firmware versions 6.00 and below), MAX Velocity [m/s]: 84 (62 for firmware versions 4.00 to 5.00), MAX Vertical Velocity [m/s]: 15, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_SEA&lt;br /&gt;
| Recommended for applications at sea, with zero vertical velocity. Zero vertical velocity assumed. Sea level assumed. MAX Altitude [m]: 500, MAX Velocity [m/s]: 25, MAX Vertical Velocity [m/s]: 5, Sanity check type: Altitude and Velocity, Max Position Deviation: Medium&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_1G&lt;br /&gt;
| Used for applications with a higher dynamic range and vertical acceleration than a passenger car. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 100, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_2G&lt;br /&gt;
| Recommended for typical airborne environment. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 250, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot; | NAV5_DYN_AIRBORNE_4G&lt;br /&gt;
| Only recommended for extremely dynamic environments. No 2D position fixes supported. MAX Altitude [m]: 50000, MAX Velocity [m/s]: 500, MAX Vertical Velocity [m/s]: 100, Sanity check type: Altitude, Max Position Deviation: Large&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Debug ==&lt;br /&gt;
&lt;br /&gt;
You can specify to receive a DEBUG message over telemetry. Make changes to both the airframe and telemetry config files.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;gps_ubx_ucenter.xml&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;GPS_UBX_NAV5_DYNAMICS&amp;quot; value=&amp;quot;NAV5_DYN_PORTABLE&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;define name=&amp;quot;DEBUG_GPS_UBX_UCENTER&amp;quot; value=&amp;quot;TRUE&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/telemetry/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
     &amp;lt;message name=&amp;quot;DEBUG&amp;quot; period=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The debug messages has the following information:&lt;br /&gt;
* [0] Initial baudrate high&lt;br /&gt;
* [1] Initial baudrate low.  For example if the baud rate is 9600 you will see 9,6&lt;br /&gt;
* [2] ublox software verision high&lt;br /&gt;
* [3] ublox software version low&lt;br /&gt;
* [4] ublox hardware version high&lt;br /&gt;
* [5] ublox hardware version low&lt;br /&gt;
* [6] Always 0&lt;br /&gt;
* [7] Success of setting CFG-NAV5&lt;br /&gt;
* [8] Success of enable NAV-POSLLH&lt;br /&gt;
* [9] Success of enable NAV-VELNED&lt;br /&gt;
* [10] Success of enable NAV-STATUS&lt;br /&gt;
* [11] Success of enable NAV-SVINFO&lt;br /&gt;
* [12] Success of enable NAV-SOL&lt;br /&gt;
* [13] Success of disabling NAV-POSUTM (typically fails to 0 for non LEA-4P modules)&lt;br /&gt;
* [14] Success of enable SBAS&lt;br /&gt;
* [15] Success of setting CFG-RATE&lt;br /&gt;
* [16] Success of setting RXM-RAW (typically disabled - see USE_GPS_UBX_RXM_RAW flag to enable)&lt;br /&gt;
* [17] Success of setting RXM-SFRB (typically disabled - see USE_GPS_UBX_RXM_SFRB flag to enable)&lt;br /&gt;
* [18] Success of saving configuration to ublox memory&lt;br /&gt;
&lt;br /&gt;
If you get all zeroes then check cabling and try again. Make sure RX from the GPS is connected to TX on the autopilot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18627</id>
		<title>Flight Plans</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18627"/>
		<updated>2014-05-13T01:19:16Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Sectors */ typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''flight plan''' is a XML document which one can create and store aboard an autopilot. The flight plan will describe how you want your aircraft to travel if released into into the wild blue yonder.&lt;br /&gt;
&lt;br /&gt;
== DTD and Structure ==&lt;br /&gt;
&lt;br /&gt;
The formal description of the flight plan file is given in the [http://en.wikipedia.org/wiki/Document_Type_Definition '''DTD'''] (located in &amp;lt;tt&amp;gt;conf/flight_plans/flight_plan.dtd&amp;lt;/tt&amp;gt;). This&lt;br /&gt;
DTD must be referenced in the header of your flight plan XML document using the following line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flight plans are stored in the &amp;lt;tt&amp;gt;conf/flight_plans&amp;lt;/tt&amp;gt; directory. The [[Flight_Plan_Editor|flight plan editor]] can be used to create basic flight plans via the GUI.&lt;br /&gt;
&lt;br /&gt;
Extract from the [http://en.wikipedia.org/wiki/Document_Type_Definition DTD]:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!ELEMENT flight_plan (header?,waypoints,sectors?,include*,exceptions?,blocks)&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''A flight plan is composed of two mandatory elements: [[#waypoints|waypoints]] and [[#blocks|blocks]]'''&lt;br /&gt;
&lt;br /&gt;
The root &amp;lt;tt&amp;gt;flight_plan&amp;lt;/tt&amp;gt; element is specified with several attributes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;'''&amp;lt;flight_plan name lat0 lon0 ground_alt security_height home_mode_height qfu alt max_dist_from_home&amp;gt;'''&amp;lt;/tt&amp;gt;&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''name'''&amp;lt;/tt&amp;gt;: The name of the mission (a text string)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''lat0, lon0'''&amp;lt;/tt&amp;gt;: Defines the latitude and longitude coordinates of the reference point {0,0} in WGS84 degree coordinates&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;: The ground altitude (in meters), Above Sea Level where you are flying. It defines the &amp;lt;tt&amp;gt;GROUND_ALT&amp;lt;/tt&amp;gt; constant value which can be used in combination with a waypoint &amp;lt;height&amp;gt; parameter to define a waypoint height&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;:  The height (over &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;) used by the circle-home failsafe procedure and in other flight procedures such as formation flight and anti-collision avoidance. Warnings are produced if you place a waypoint lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; (usually the case for the landing point)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; (optional): This optional attribute available since v4.2 allows to override &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; as failsafe height in home mode. If &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; Is set lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;, the later is used. This attribute is useful if you need to return home at a high altitude rather than a low altitude.&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''qfu'''&amp;lt;/tt&amp;gt; (optional): defines the global constant &amp;lt;tt&amp;gt;QFU&amp;lt;/tt&amp;gt;. It usually is the magnetic heading in degrees (north=0, east=90) of the runway, the opposite of wind direction. This constant may be used in the mission description. It is also used by the simulator as the original course of the aircraft. So if you want to take off and climb to the West you would use qfu=270. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''alt'''&amp;lt;/tt&amp;gt;: The default altitude of waypoints ([[Altitude_definitions|Above Sea Level]]). So if your ground altitude is 400 then alt needs to be a value greater than ground altitude and above any obstructions in the flight plan. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''max_dist_from_home'''&amp;lt;/tt&amp;gt;: A radius representing the maximum allowed distance (in meters) from the HOME waypoint. Exceeding this value (ie flying outside the circle with this radius) will trigger an exception. It is up to you to define the block to be executed (ie what to do) for the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Here is an '''example''' of such a line in the top of a flight plan:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan alt=&amp;quot;250&amp;quot; ground_alt=&amp;quot;185&amp;quot; lat0=&amp;quot;43.46223&amp;quot; lon0=&amp;quot;1.27289&amp;quot; name=&amp;quot;Example Muret&amp;quot; max_dist_from_home=&amp;quot;300&amp;quot; qfu=&amp;quot;270&amp;quot; security_height=&amp;quot;25&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a flight plan could also contain optional &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt;'s and &amp;lt;tt&amp;gt;exceptions&amp;lt;/tt&amp;gt; cases.&lt;br /&gt;
&lt;br /&gt;
In English the above flight plan says the name is Example Muret. The reference coordinates for the 0,0 point is: 43.46223 (lat) and 1.27289 (long). The flying site 0,0 location is 185m above sea level. The security height is 25m above 0,0 point or 210m above sea level. The default (ie if not defined in a waypoint this alt is used) altitude is 250m (above sea level). The home mode block altitude is defined to be 150m above sea level. Also, for security, a circle is defined with a radius that's 300m from 0,0 position. This is the max_dist_from_home value. Fly 301m from 0,0 and an exception is triggered. A useful block is to trigger/go to the home mode block and return to home when the aircraft flies outside the safety circle. Example flight plans are helpful for study before you build your own from scratch.&lt;br /&gt;
&lt;br /&gt;
== Waypoints ==&lt;br /&gt;
&lt;br /&gt;
The waypoints are the geographic locations used to specify the trajectories. A waypoint is specified by it's name and coordinates:&lt;br /&gt;
 &amp;lt;tt&amp;gt;''' &amp;lt;waypoint name wpx wpy [alt] [height]/&amp;gt; '''&amp;lt;/tt&amp;gt;&lt;br /&gt;
where wpx and wpy are real positional coordinates ( &amp;lt;tt&amp;gt;'''lat/lon'''&amp;lt;/tt&amp;gt; )  '''or''' UTM coordinates ( &amp;lt;tt&amp;gt;'''utm_x0/utm_y0'''&amp;lt;/tt&amp;gt; ) '''or''' relative coordinates ( &amp;lt;tt&amp;gt;'''x/y'''&amp;lt;/tt&amp;gt; ) in meters from your reference point {0,0} .  &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; is an optional parameter and can be used to assign an altitude to a particular waypoint that is different from the globally defined &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; parameter of the flightplan. The &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; attribute can be used to set the waypoint height relative to the [[Altitude_definitions|ground altitude]] (&amp;lt;tt&amp;gt;ground_alt&amp;lt;/tt&amp;gt;) of the flight plan for this waypoint.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;HOME&amp;quot; x=&amp;quot;0.0&amp;quot; y=&amp;quot;30.0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;BRIDGEOVERRIVER&amp;quot; x=&amp;quot;-100.0&amp;quot; y=&amp;quot;60.0&amp;quot; alt=&amp;quot;270.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MyBarn&amp;quot; x=&amp;quot;-130.0&amp;quot; y=&amp;quot;217.5&amp;quot; alt=&amp;quot;3000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;3&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;4&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50.&amp;quot; alt=&amp;quot;ground_alt + 50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYHELPERSPOT&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;60&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYOTHERHELPERSPOT&amp;quot; x=&amp;quot;-70.0&amp;quot; y=&amp;quot;90&amp;quot; height=&amp;quot;70.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOWER&amp;quot; lat=&amp;quot;48.858249&amp;quot; lon=&amp;quot;2.294494&amp;quot; height=&amp;quot;324.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MountainCAFE&amp;quot; utm_x0=&amp;quot;360284.8&amp;quot; utm_y0=&amp;quot;4813595.5&amp;quot; alt=&amp;quot;1965.&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* Waypoints are easily adjusted with the [[Flight_Plan_Editor|flight plan editor]].&lt;br /&gt;
* If a waypoint name starts with an underscore ( _ ), the waypoint is '''not displayed''' in the GCS, except in editor mode.&lt;br /&gt;
* The maximum number of waypoints is 254.&lt;br /&gt;
* A waypoint named &amp;lt;tt&amp;gt;HOME&amp;lt;/tt&amp;gt; is required if the failsafe HOME mode procedure is used.&lt;br /&gt;
&lt;br /&gt;
== Sectors ==&lt;br /&gt;
&lt;br /&gt;
Flat ''Sectors'' can be described as an area defined by list of waypoint corners. Such an area will be displayed in the Ground Control Station (GCS) by colored lines connecting the cornerpoints.&lt;br /&gt;
A function is generated to check if a point, usually the aircraft itself, is ''inside'' this sector. Currently, this feature requires that the polygon is &amp;lt;b&amp;gt;convex&amp;lt;/b&amp;gt; and described in a &amp;lt;b&amp;gt;clockwise&amp;lt;/b&amp;gt; order. For a sector named &amp;lt;tt&amp;gt;MyBigGarden&amp;lt;/tt&amp;gt; the generated function for the example here would be &amp;lt;tt&amp;gt;bool_t InsideMyBigGarden(float x, float y);&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; are east and north coordinated, in meters, relative to the geographic reference of the flight plan. If the flight plan is dynamically relocated, such a sector will be relocated but the display is currently not updated on the GCS. It would be great if one would help improving that part of the source code. Note that sector names are not allowed to contain spaces.&lt;br /&gt;
&lt;br /&gt;
For example, with the following element in a flight plan.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;MyBigGarden&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is then possible to add an exception clause to your flightplan. For example if the aircraft for some reason flies outside this, defined by us, sector the airframe will fly to a standby waypoint. The exclamation mark (!) means the boolean operator &amp;lt;tt&amp;gt;NOT&amp;lt;/tt&amp;gt; in this example. In regular language one would describe &amp;quot;If my airframe is NOT inside the MyBigGarden sector anymore then deroute it to the standby waypoint. In Flightplan &amp;quot;Speak&amp;quot; this is written like: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;exception cond=&amp;quot;! InsideMyBigGarden(GetPosX(), GetPosY())&amp;quot; deroute=&amp;quot;standby&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: editing of the waypoints of the sector during the flight will not dynamically update the inside function. It will always check if the position is inside the original sector.&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* A nice option in the corner notation is that one can add an underscore ( _ ) in front of the name; a corner or waypoint name that starts with an underscore is not displayed in the GCS. Only in editor mode it is visible. It is visible in editor mode, because if you the could not see it, it also would be not possible to edit or drag the corner or waypoint to another position.&lt;br /&gt;
* The color indicating the sector borders is not fixed but can be defined by oneself if wished for via the color attribute.&lt;br /&gt;
&lt;br /&gt;
== Includes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; is used to add some flight plan elements defined in an external procedure. It’s useful to include pre-written procedures with only few arguments and then clarify the flight plan.&lt;br /&gt;
Here is the structure:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;include name procedure&amp;gt; [&amp;lt;arg name value /&amp;gt;]*[&amp;lt;with from to /&amp;gt;]*&amp;lt;/include&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; attribute of the include element will be used in this flight plan to prefix the blocks of the &amp;lt;tt&amp;gt;procedure&amp;lt;/tt&amp;gt;, the XML referenced file.&lt;br /&gt;
Named arguments may be given with their value in the &amp;lt;tt&amp;gt;arg&amp;lt;/tt&amp;gt; elements. The &amp;lt;tt&amp;gt;with&amp;lt;/tt&amp;gt; tag allows to link labels (e.g. attribute of a deroute instruction or of an exception) from the procedure to blocks of the main flight plan.&lt;br /&gt;
Then, each block of the procedure is like any block of the flight plan and is designated with a dotted identifier: block &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; of a procedure named &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; is named &amp;lt;tt&amp;gt;b.p&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;includes&amp;gt;&lt;br /&gt;
    &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/includes&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Blocks ==&lt;br /&gt;
&lt;br /&gt;
Block elements are the main part of a flight plan: they describe each unit of the mission.&lt;br /&gt;
They are made of various primitives, called stages and exceptions, you can put one after the other. When a&lt;br /&gt;
stage (or a block) is finished, the autopilot goes to the next one. The behaviour after the last stage of the last block is undefined. &lt;br /&gt;
&lt;br /&gt;
As described in the DTD, the &amp;lt;tt&amp;gt;blocks&amp;lt;/tt&amp;gt; element is composed of &amp;lt;tt&amp;gt;block&amp;lt;/tt&amp;gt; elements which are sequence of ''stages'':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT blocks (block+)&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT block  (exception|while|heading|attitude|go|xyz|set|call|circle|deroute|stay|follow|survey_rectangle|for|return|eight|oval|home|path)*&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle radius=&amp;quot;75&amp;quot; wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add a button in the [[GCS#Strips|strip of the aircraft]] with the attribute &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This button will activate the block. If the attribute &amp;lt;tt&amp;gt;group&amp;lt;/tt&amp;gt; is specified, all strip buttons of the same group will be placed vertically on top of each other.&lt;br /&gt;
&lt;br /&gt;
In the same way, a key shortcut can be specified:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block key=&amp;quot;D&amp;quot; name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Modifiers are allowed, using the syntax of [http://library.gnome.org/devel/gtk/2.15/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse GTK accelerators].&lt;br /&gt;
&lt;br /&gt;
An icon can be specified to display the button. The &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt; label then is a tooltip for the icon. The icon must be an image file available in the directory &amp;lt;tt&amp;gt;data/pictures/gcs_icons&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot; strip_button=&amp;quot;Takeoff&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expressions ====&lt;br /&gt;
&lt;br /&gt;
Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C expression is restricted to &lt;br /&gt;
* numeric constants&lt;br /&gt;
* some internal autopilot variables (not fully documented, see examples)&lt;br /&gt;
* Some binary operators: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, ==, +, -, /, *&lt;br /&gt;
* Some utility functions&lt;br /&gt;
&lt;br /&gt;
Some examples of usable expressions are given in the next sections.&lt;br /&gt;
=== Initialization  Blocks ===&lt;br /&gt;
Most flight plans will have three blocks of flight plan initialization blocks. It is good practice to follow this example below if you first start learing to create flightplans&lt;br /&gt;
&lt;br /&gt;
The first block waits until the GPS fix has been established, as shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Wait GPS&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The second block updates the local waypoints with respect to the UAV.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Geo init&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;LessThan(NavBlockTime(), 10)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;NavSetGroundReferenceHere()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This next block prevents the UAV from starting the engine and taking off. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Holding point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!--set var=&amp;quot;nav_mode&amp;quot; value=&amp;quot;NAV_MODE_ROLL&amp;quot;/--&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;attitude roll=&amp;quot;0&amp;quot; throttle=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exceptions ===&lt;br /&gt;
&lt;br /&gt;
The flight manager can handle exceptions. They consist in conditions checked periodically (at the same pace as the navigation control), allowing the control to jump to a given block. Here is the syntax of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;...&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; is an expression and &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the name of the block we want to switch to as soon as the condition is true.&lt;br /&gt;
&lt;br /&gt;
Here are some example of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;10 &amp;gt; PowerVoltage()&amp;quot; deroute=&amp;quot;go_down&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(ground_alt+10 &amp;gt; GetPosAlt())&amp;quot; deroute=&amp;quot;go_up&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(autopilot_flight_time &amp;gt; 840)&amp;quot; deroute=&amp;quot;quick_land&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions can be local to a block or global to the flight plan, in the &amp;lt;tt&amp;gt;&amp;lt;exceptions&amp;gt;&amp;lt;/tt&amp;gt; element. In the following example, time since last reception of a message from the ground station is monitored and the navigation is switched to the &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt; block if no message have been received for 22s. This exception is valid for '''all''' the blocks.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan ...&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt; ... &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;exceptions&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;datalink_time &amp;gt; 22&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/exceptions&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt; ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deroute ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the ''goto'' directive of the flight plan; it switches the navigation to the given block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this primitive should not be used to execute loops which are provided by the following elements.&lt;br /&gt;
&lt;br /&gt;
=== Loops ===&lt;br /&gt;
&lt;br /&gt;
Unbounded loops are written with &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; elements whose &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; attribute is a boolean expression.&lt;br /&gt;
Children  of &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; are stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;while cond=&amp;quot;TRUE&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;B&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;go wp=&amp;quot;C&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;while cond=&amp;quot;5 &amp;gt; stage_time&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/while&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In this example, we run an infinite loop, lettin the aircraft try to go via waypoints &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; and waiting for 5 seconds before repeating.&lt;br /&gt;
&lt;br /&gt;
Bounded loops are written with the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; tag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;0&amp;quot; to=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where the body of the loop will be run four times.&lt;br /&gt;
&lt;br /&gt;
The variable of a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop can be used inside expressions appearing as attributes of the stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot; alt=&amp;quot;ground_alt+50*$i&amp;quot; until=&amp;quot;stage_time&amp;gt;10&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the aircraft will circle around waypoint '''HOME''' for 10 seconds at and altitude above ground of 50m, 10 seconds at altitude 100 meter (50+50), ... until 250m (5x +50).&lt;br /&gt;
&lt;br /&gt;
Note: Two bounded loops using the same control variable are not allowed in the same block.&lt;br /&gt;
&lt;br /&gt;
=== Navigation modes ===&lt;br /&gt;
&lt;br /&gt;
Navigation modes give the description of the desired trajectory in 3D. While the horizontal mode is specified through&lt;br /&gt;
''stages'', the vertical control is specified with various attributes of these stages. The current available navigation stages are&lt;br /&gt;
* attitude : just keep a fixed attitude;&lt;br /&gt;
* heading : keep a given course;&lt;br /&gt;
* go : go to a given waypoint;&lt;br /&gt;
* path : list of waypoints linked by ''go''&lt;br /&gt;
* circle : circle around a waypoint;&lt;br /&gt;
* oval : two half circles with a straight between two nav points&lt;br /&gt;
* eight : fly a figure of eight through a waypoint and around another&lt;br /&gt;
* stay : hold the position (hard to realize for a fixed-wing aircraft);&lt;br /&gt;
* follow : follow another aircraft;&lt;br /&gt;
* xyz : circle around a point moveable with the RC transmitter stick (obsolete with the datalink).&lt;br /&gt;
&lt;br /&gt;
The vertical control is achieved using the &amp;lt;tt&amp;gt;vmode&amp;lt;/tt&amp;gt; attribute of these stages. The possible values are &lt;br /&gt;
* '''alt''' (the default) : the autopilot keeps the desired altitude which is the altitude of the waypoint (if any) or the altitude specified with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute;&lt;br /&gt;
* '''climb''' : the autopilot keeps the desired vertical speed specified with the &amp;lt;tt&amp;gt;climb&amp;lt;/tt&amp;gt; attribute (in m/s);&lt;br /&gt;
* '''throttle''' : the autopilots sets the desired throttle specified with the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute (between 0 and 1);&lt;br /&gt;
* '''glide''' : the autopilot keeps the desired slope between two waypoints&lt;br /&gt;
&lt;br /&gt;
The default control is done with the throttle. However, setting the &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute to '''auto''' and the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute to a constant allows a vertical control only by controlling the attitude of the A/C.&lt;br /&gt;
The &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute also can be set to any value (in degrees) while the throttle control is in use: it usually affects the airspeed of the aircraft.  &lt;br /&gt;
&lt;br /&gt;
The different navigation modes are detailed in the next sections.&lt;br /&gt;
&lt;br /&gt;
=== Attitude ===&lt;br /&gt;
&lt;br /&gt;
Element &amp;lt;tt&amp;gt;attitude&amp;lt;/tt&amp;gt; is the navigation mode which corresponds to the current lowest control loop for horizontal mode.&lt;br /&gt;
The autopilot then keeps a constant attitude. The &amp;lt;tt&amp;gt;roll&amp;lt;/tt&amp;gt; attribute is required (in degrees, positive to put right wing low).&lt;br /&gt;
&lt;br /&gt;
To fly away, at constant airspeed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;, throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To fly around, holding a given altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;30&amp;quot; alt=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is not a ''safe'' navigation mode since the geographic position of the plane is not controlled. However, this mode is useful to tune the roll attitude control loop.&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;heading&amp;lt;/tt&amp;gt; primitive is relative to the second level loop for horizontal mode in the autopilot which will keep the given &amp;lt;tt&amp;gt;course&amp;lt;/tt&amp;gt;, a required attribute (in degrees, clockwise, north=0, east=90).&lt;br /&gt;
&lt;br /&gt;
One example to takeoff, following the QFU, 80% throttle, nose up (15 degrees) until height of 30m is reached:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;heading course=&amp;quot;QFU&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.8&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;(GetPosAlt() &amp;gt; ground_alt+30)&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Go ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitive is probably the most useful one. Basically, the autopilot will try to join a given waypoint (&amp;lt;tt&amp;gt;wp&amp;lt;/tt&amp;gt;, the only required attribute). So the simplest thing you can ask for is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go wp=&amp;quot;HOME&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
which will set the '''HOME''' waypoint as the desired target position. Note than since &amp;lt;tt&amp;gt;vmode=&amp;quot;alt&amp;quot;&amp;lt;/tt&amp;gt; is the default, the altitude of the target waypoint is also taken into account. The navigation will switch to the next stage as soon as the target is reached.&lt;br /&gt;
&lt;br /&gt;
It is usually not a good idea to try to join a waypoint without asking for a precise trajectory, i.e. a given line.&lt;br /&gt;
Setting the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute to '''route''', the navigation will go over a segment joining two waypoints:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target altitude is the altitude of the target waypoint; it can also be set with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute. The following example keeps an altitude with fixed throttle:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp2&amp;quot; wp=&amp;quot;wp3&amp;quot; hmode=&amp;quot;route&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.75&amp;quot; alt=&amp;quot;ground_alt+100&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attributes related to the vertical control can also be set to replace the default altitude mode:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; vmode=&amp;quot;climb&amp;quot; climb=&amp;quot;1.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;tt&amp;gt;approaching_time&amp;lt;/tt&amp;gt; (in seconds) attribute helps to decide when the target is ''reached''. It can be set&lt;br /&gt;
to '''0''' to go over the target waypoint (default value is the '''CARROT''' time, set in the airframe configuration file).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; approaching_time=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Path ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;path&amp;lt;/tt&amp;gt; primitive is just a shorthand expression for a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives. A list of waypoints defined with the &amp;lt;tt&amp;gt;wpts&amp;lt;/tt&amp;gt; attribute is pre-processed into a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives with the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute. For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp1, wp2, wp3&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other attributes are optional:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp3, wp1, wp2&amp;quot; approaching_time=&amp;quot;1&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circle ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; primitive is the second main navigation mode: the trajectory is defined as a circle around a given waypoint with a given radius:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
A positive radius makes the UAS move clockwise, a negative counter-clockwise.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;until&amp;lt;/tt&amp;gt; attribute may be used to control the end of the stage. The following example defines an ascending trajectory at constant throttle, nose up (15 degrees), over growing circles, until the battery level is low:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;wp1&amp;quot; radius=&amp;quot;50+(GetPosAlt()-ground_alt)/2&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.75&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;10&amp;gt;PowerVoltage()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Oval ===&lt;br /&gt;
The oval consists of two half circles that are connected with two straight lines. This flight path is usefull when a IMU is used because the straights allow for level flight. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &amp;lt;oval p1=&amp;quot;1&amp;quot; p2=&amp;quot;2&amp;quot; radius=&amp;quot;nav_radius&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Eight ===&lt;br /&gt;
Fly a figure of eight that consists of two straight legs that pass though the center and the center of the half circle at the end of the two legs is in the turn around  waypoint. The altitude of the center waypoint is used for the entire figure. The turn around waypoint is moved to match radius given. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;  &amp;lt;eight center=&amp;quot;1&amp;quot; radius=&amp;quot;nav_radius&amp;quot; turn_around=&amp;quot;2&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Follow ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;follow&amp;lt;/tt&amp;gt; is a special primitive which makes the UAS follow another UAS (real or simulated, named with its &amp;lt;tt&amp;gt;ac_id&amp;lt;/tt&amp;gt;) at a given &amp;lt;tt&amp;gt;distance&amp;lt;/tt&amp;gt; (in meters) behind and at a given &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; (in meters) above.&lt;br /&gt;
&lt;br /&gt;
In this example, the autopilot will try to follow A/C number '''4''', staying '''50'''m behind and '''20'''m above.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;follow ac_id=&amp;quot;4&amp;quot; distance=&amp;quot;50&amp;quot; height=&amp;quot;20&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;traffic_info.c&amp;lt;/tt&amp;gt; file is required by this feature and the &amp;lt;tt&amp;gt;TRAFFIC_INFO&amp;lt;/tt&amp;gt; flag has to be set to enable it. Then, the following lines must be added in the airframe file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stay ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;stay&amp;lt;/tt&amp;gt; is a mode for UAS's able to hover:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;stay wp=&amp;quot;HOME&amp;quot; alt=&amp;quot;10&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XYZ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xyz&amp;lt;/tt&amp;gt; is a special mode where the UAS circles around a user moveable waypoint. This waypoint is moved with the RC sticks:&lt;br /&gt;
* YAW channel controls the point over the west-east axis;&lt;br /&gt;
* PITCH channel controls the point over the south-north axis;&lt;br /&gt;
* ROLL channel controls the altitude.&lt;br /&gt;
&lt;br /&gt;
Example (default radius is '''100'''):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;xyz radius=&amp;quot;40&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Set ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt; element is a dangerous one which should be used only by expert users: it is used to directly set an internal variable of the autopilot. For example, you can change the value of the default ground altitude, a variable used by the home mode failsafe procedure (and maybe by your own flight plan):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;set var=&amp;quot;ground_alt&amp;quot; value=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This directive is extremely powerful and has great potential for error - use with caution.&lt;br /&gt;
&lt;br /&gt;
=== Call ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;call&amp;lt;/tt&amp;gt; allows the user to define its own navigation procedures in C. The &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt; must be a call to a boolean function which must return TRUE as long as the stage is not completed (a function which should be called only once would then return immediately FALSE).&lt;br /&gt;
This feature is illustrated with the '''line''' pattern:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line(WP_1, WP_2, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;nav_line_init()&amp;lt;/tt&amp;gt; returns FALSE and &amp;lt;tt&amp;gt;nav_line()&amp;lt;/tt&amp;gt; always returns TRUE (this stage never ends).&lt;br /&gt;
Such functions usually are defined in a supplementary C file which must be specified in the airframe file (in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section)&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += nav_line.c&lt;br /&gt;
 sim.srcs += nav_line.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
These functions also must be declared in a header file which must be mentioned in the header element of the flight plan:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;header&amp;gt;&lt;br /&gt;
#include &amp;quot;nav_line.h&amp;quot;&lt;br /&gt;
  &amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
These C source file and H header file must be located in the &amp;lt;tt&amp;gt;sw/airborne&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
You can also call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Examples ==&lt;br /&gt;
Parameters used in a flight plan can be computed expressions. In this example, the plane is asked to perform 5 circles at progressively increasing altitudes for exactly one minute at each altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var = &amp;quot;i&amp;quot; from = &amp;quot;1&amp;quot; to = &amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp = &amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;&lt;br /&gt;
          alt = &amp;quot;ground_alt+50*$i&amp;quot;&lt;br /&gt;
          until = &amp;quot;stage_time&amp;gt;60&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Immobilize Actuators === &lt;br /&gt;
&lt;br /&gt;
h_ctl setpoints variable are set by the h_ctl_attitude_loop() (from fw_h_ctl.c) loop) which can be disabled with the&lt;br /&gt;
h_ctl_disabled flag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_aileron_setpoint&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_elevator_setpoint&amp;quot; value=&amp;quot;MAX_PPRZ/2&amp;quot;/&amp;gt;&lt;br /&gt;
 .... waiting for a condition ...&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
&lt;br /&gt;
Procedures are libraries which can be included in flight plans. They are composed of waypoints, sectors and blocks. The header of a procedure may contain some parameters which are replaced by arguments when the procedure is included.&lt;br /&gt;
&lt;br /&gt;
Extract of the DTD: a procedure is a sequence of parameters, waypoints, ...:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!ELEMENT procedure (param*,header?,waypoints?,sectors?,exceptions?,blocks?)&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;param&amp;lt;/tt&amp;gt;eter is just a name. A parameter is optional if it is declared with a default value.&lt;br /&gt;
An example with a required and an optional parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;alt&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;radius&amp;quot; default_value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Procedures are called with the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; element in a flight plan. A procedure cannot be included twice or by another procedure. A procedure call requires:&lt;br /&gt;
&lt;br /&gt;
* the name of the procedure file, the name given to this inclusion; &lt;br /&gt;
* values for the parameters;&lt;br /&gt;
* backlinks for block name exits of the procedure.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the corresponding procedure '''landing.xml''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE procedure SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;procedure&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;AF&amp;quot; x=&amp;quot;177.4&amp;quot; y=&amp;quot;45.1&amp;quot; alt=&amp;quot;30&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;TD&amp;quot; x=&amp;quot;28.8&amp;quot; y=&amp;quot;57.0&amp;quot; alt=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;168.8&amp;quot; y=&amp;quot;-13.8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;blocks&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 &amp;gt; fabs(GetPosAlt()- WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/block&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/blocks&amp;gt;&lt;br /&gt;
  &amp;lt;/procedure&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the name of procedure '''land''' block will be renamed into '''landing.land''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing.land&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
will jump to this procedure block.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a go-around condition in your landing procedure. You would write it&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;go-around&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
then you must link this block exit with one of your block (e.g. &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt;). So you would include the procedure as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;with from=&amp;quot;go-around&amp;quot; to=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/include&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
There are many ways to skin a cat just as there are many ways to craft your flight plan. Following the best practices tips can save you from a lot of frustration and mishap.&lt;br /&gt;
&lt;br /&gt;
* Simulate your flight plan before taking it to the sky. Flight plans should always be carefully tested prior to flight, take a look at the [[Simulation|simulation]] page for details on how to simulate your plan.&lt;br /&gt;
* Make an subdirectory in the Flight_plan directory with your own name and add your flight plans there. Make sure that the location of the DTD is correct, e.g by using relative directory double dots as in &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;../flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Take a good look at other flight plans included with Paparazzi. To learn from example flight plans please visit the [[Flight_Plan_Examples|flight plan examples]] page&lt;br /&gt;
* There are several option to build failsafe features into you flightplan, [[Failsafe|for some examples visit the Failsafe page]].&lt;br /&gt;
* Some flight plan examples define waypoint locations using relative coordinates. These are relative positions from the fixed lat and lon in the header of the flight plan. When simulating your flight plan the aircraft always use the lat/lon as defined in the flight plan since a regular simulation has no notion of you current position of you local PC where you simulate on. This is something to keep in mind if you test your flight plan in real flights.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18626</id>
		<title>Flight Plans</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Flight_Plans&amp;diff=18626"/>
		<updated>2014-05-13T01:18:41Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Sectors */  insideSector() function has static positions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''flight plan''' is a XML document which one can create and store aboard an autopilot. The flight plan will describe how you want your aircraft to travel if released into into the wild blue yonder.&lt;br /&gt;
&lt;br /&gt;
== DTD and Structure ==&lt;br /&gt;
&lt;br /&gt;
The formal description of the flight plan file is given in the [http://en.wikipedia.org/wiki/Document_Type_Definition '''DTD'''] (located in &amp;lt;tt&amp;gt;conf/flight_plans/flight_plan.dtd&amp;lt;/tt&amp;gt;). This&lt;br /&gt;
DTD must be referenced in the header of your flight plan XML document using the following line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The flight plans are stored in the &amp;lt;tt&amp;gt;conf/flight_plans&amp;lt;/tt&amp;gt; directory. The [[Flight_Plan_Editor|flight plan editor]] can be used to create basic flight plans via the GUI.&lt;br /&gt;
&lt;br /&gt;
Extract from the [http://en.wikipedia.org/wiki/Document_Type_Definition DTD]:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!ELEMENT flight_plan (header?,waypoints,sectors?,include*,exceptions?,blocks)&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''A flight plan is composed of two mandatory elements: [[#waypoints|waypoints]] and [[#blocks|blocks]]'''&lt;br /&gt;
&lt;br /&gt;
The root &amp;lt;tt&amp;gt;flight_plan&amp;lt;/tt&amp;gt; element is specified with several attributes:&lt;br /&gt;
 &amp;lt;tt&amp;gt;'''&amp;lt;flight_plan name lat0 lon0 ground_alt security_height home_mode_height qfu alt max_dist_from_home&amp;gt;'''&amp;lt;/tt&amp;gt;&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''name'''&amp;lt;/tt&amp;gt;: The name of the mission (a text string)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''lat0, lon0'''&amp;lt;/tt&amp;gt;: Defines the latitude and longitude coordinates of the reference point {0,0} in WGS84 degree coordinates&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;: The ground altitude (in meters), Above Sea Level where you are flying. It defines the &amp;lt;tt&amp;gt;GROUND_ALT&amp;lt;/tt&amp;gt; constant value which can be used in combination with a waypoint &amp;lt;height&amp;gt; parameter to define a waypoint height&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;:  The height (over &amp;lt;tt&amp;gt;'''ground_alt'''&amp;lt;/tt&amp;gt;) used by the circle-home failsafe procedure and in other flight procedures such as formation flight and anti-collision avoidance. Warnings are produced if you place a waypoint lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; (usually the case for the landing point)&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; (optional): This optional attribute available since v4.2 allows to override &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt; as failsafe height in home mode. If &amp;lt;tt&amp;gt;'''home_mode_height'''&amp;lt;/tt&amp;gt; Is set lower than &amp;lt;tt&amp;gt;'''security_height'''&amp;lt;/tt&amp;gt;, the later is used. This attribute is useful if you need to return home at a high altitude rather than a low altitude.&lt;br /&gt;
; &amp;lt;tt&amp;gt;'''qfu'''&amp;lt;/tt&amp;gt; (optional): defines the global constant &amp;lt;tt&amp;gt;QFU&amp;lt;/tt&amp;gt;. It usually is the magnetic heading in degrees (north=0, east=90) of the runway, the opposite of wind direction. This constant may be used in the mission description. It is also used by the simulator as the original course of the aircraft. So if you want to take off and climb to the West you would use qfu=270. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''alt'''&amp;lt;/tt&amp;gt;: The default altitude of waypoints ([[Altitude_definitions|Above Sea Level]]). So if your ground altitude is 400 then alt needs to be a value greater than ground altitude and above any obstructions in the flight plan. &lt;br /&gt;
; &amp;lt;tt&amp;gt;'''max_dist_from_home'''&amp;lt;/tt&amp;gt;: A radius representing the maximum allowed distance (in meters) from the HOME waypoint. Exceeding this value (ie flying outside the circle with this radius) will trigger an exception. It is up to you to define the block to be executed (ie what to do) for the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Here is an '''example''' of such a line in the top of a flight plan:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan alt=&amp;quot;250&amp;quot; ground_alt=&amp;quot;185&amp;quot; lat0=&amp;quot;43.46223&amp;quot; lon0=&amp;quot;1.27289&amp;quot; name=&amp;quot;Example Muret&amp;quot; max_dist_from_home=&amp;quot;300&amp;quot; qfu=&amp;quot;270&amp;quot; security_height=&amp;quot;25&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that a flight plan could also contain optional &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt;'s and &amp;lt;tt&amp;gt;exceptions&amp;lt;/tt&amp;gt; cases.&lt;br /&gt;
&lt;br /&gt;
In English the above flight plan says the name is Example Muret. The reference coordinates for the 0,0 point is: 43.46223 (lat) and 1.27289 (long). The flying site 0,0 location is 185m above sea level. The security height is 25m above 0,0 point or 210m above sea level. The default (ie if not defined in a waypoint this alt is used) altitude is 250m (above sea level). The home mode block altitude is defined to be 150m above sea level. Also, for security, a circle is defined with a radius that's 300m from 0,0 position. This is the max_dist_from_home value. Fly 301m from 0,0 and an exception is triggered. A useful block is to trigger/go to the home mode block and return to home when the aircraft flies outside the safety circle. Example flight plans are helpful for study before you build your own from scratch.&lt;br /&gt;
&lt;br /&gt;
== Waypoints ==&lt;br /&gt;
&lt;br /&gt;
The waypoints are the geographic locations used to specify the trajectories. A waypoint is specified by it's name and coordinates:&lt;br /&gt;
 &amp;lt;tt&amp;gt;''' &amp;lt;waypoint name wpx wpy [alt] [height]/&amp;gt; '''&amp;lt;/tt&amp;gt;&lt;br /&gt;
where wpx and wpy are real positional coordinates ( &amp;lt;tt&amp;gt;'''lat/lon'''&amp;lt;/tt&amp;gt; )  '''or''' UTM coordinates ( &amp;lt;tt&amp;gt;'''utm_x0/utm_y0'''&amp;lt;/tt&amp;gt; ) '''or''' relative coordinates ( &amp;lt;tt&amp;gt;'''x/y'''&amp;lt;/tt&amp;gt; ) in meters from your reference point {0,0} .  &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; is an optional parameter and can be used to assign an altitude to a particular waypoint that is different from the globally defined &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; parameter of the flightplan. The &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; attribute can be used to set the waypoint height relative to the [[Altitude_definitions|ground altitude]] (&amp;lt;tt&amp;gt;ground_alt&amp;lt;/tt&amp;gt;) of the flight plan for this waypoint.&lt;br /&gt;
&lt;br /&gt;
An example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;HOME&amp;quot; x=&amp;quot;0.0&amp;quot; y=&amp;quot;30.0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;BRIDGEOVERRIVER&amp;quot; x=&amp;quot;-100.0&amp;quot; y=&amp;quot;60.0&amp;quot; alt=&amp;quot;270.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MyBarn&amp;quot; x=&amp;quot;-130.0&amp;quot; y=&amp;quot;217.5&amp;quot; alt=&amp;quot;3000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;3&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;4&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;50.&amp;quot; alt=&amp;quot;ground_alt + 50&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYHELPERSPOT&amp;quot; x=&amp;quot;-30.0&amp;quot; y=&amp;quot;60&amp;quot; height=&amp;quot;50.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;_MYOTHERHELPERSPOT&amp;quot; x=&amp;quot;-70.0&amp;quot; y=&amp;quot;90&amp;quot; height=&amp;quot;70.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOWER&amp;quot; lat=&amp;quot;48.858249&amp;quot; lon=&amp;quot;2.294494&amp;quot; height=&amp;quot;324.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;MountainCAFE&amp;quot; utm_x0=&amp;quot;360284.8&amp;quot; utm_y0=&amp;quot;4813595.5&amp;quot; alt=&amp;quot;1965.&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* Waypoints are easily adjusted with the [[Flight_Plan_Editor|flight plan editor]].&lt;br /&gt;
* If a waypoint name starts with an underscore ( _ ), the waypoint is '''not displayed''' in the GCS, except in editor mode.&lt;br /&gt;
* The maximum number of waypoints is 254.&lt;br /&gt;
* A waypoint named &amp;lt;tt&amp;gt;HOME&amp;lt;/tt&amp;gt; is required if the failsafe HOME mode procedure is used.&lt;br /&gt;
&lt;br /&gt;
== Sectors ==&lt;br /&gt;
&lt;br /&gt;
Flat ''Sectors'' can be described as an area defined by list of waypoint corners. Such an area will be displayed in the Ground Control Station (GCS) by colored lines connecting the cornerpoints.&lt;br /&gt;
A function is generated to check if a point, usually the aircraft itself, is ''inside'' this sector. Currently, this feature requires that the polygon is &amp;lt;b&amp;gt;convex&amp;lt;/b&amp;gt; and described in a &amp;lt;b&amp;gt;clockwise&amp;lt;/b&amp;gt; order. For a sector named &amp;lt;tt&amp;gt;MyBigGarden&amp;lt;/tt&amp;gt; the generated function for the example here would be &amp;lt;tt&amp;gt;bool_t InsideMyBigGarden(float x, float y);&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; are east and north coordinated, in meters, relative to the geographic reference of the flight plan. If the flight plan is dynamically relocated, such a sector will be relocated but the display is currently not updated on the GCS. It would be great if one would help improving that part of the source code. Note that sector names are not allowed to contain spaces.&lt;br /&gt;
&lt;br /&gt;
For example, with the following element in a flight plan.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;sectors&amp;gt;&lt;br /&gt;
    &amp;lt;sector name=&amp;quot;MyBigGarden&amp;quot; color=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_3&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;corner name=&amp;quot;_4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/sector&amp;gt;&lt;br /&gt;
  &amp;lt;/sectors&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is then possible to add an exception clause to your flightplan. For example if the aircraft for some reason flies outside this, defined by us, sector the airframe will fly to a standby waypoint. The exclamation mark (!) means the boolean operator &amp;lt;tt&amp;gt;NOT&amp;lt;/tt&amp;gt; in this example. In regular language one would describe &amp;quot;If my airframe is NOT inside the MyBigGarden sector anymore then deroute it to the standby waypoint. In Flightplan &amp;quot;Speak&amp;quot; this is written like: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;exception cond=&amp;quot;! InsideMyBigGarden(GetPosX(), GetPosY())&amp;quot; deroute=&amp;quot;standby&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: editing of the waypoints of the sector during the flight will not dinamycally update the inside function. It will always check if the position is inside the original sector.&lt;br /&gt;
&lt;br /&gt;
'''Tips'''&lt;br /&gt;
* A nice option in the corner notation is that one can add an underscore ( _ ) in front of the name; a corner or waypoint name that starts with an underscore is not displayed in the GCS. Only in editor mode it is visible. It is visible in editor mode, because if you the could not see it, it also would be not possible to edit or drag the corner or waypoint to another position.&lt;br /&gt;
* The color indicating the sector borders is not fixed but can be defined by oneself if wished for via the color attribute.&lt;br /&gt;
&lt;br /&gt;
== Includes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; is used to add some flight plan elements defined in an external procedure. It’s useful to include pre-written procedures with only few arguments and then clarify the flight plan.&lt;br /&gt;
Here is the structure:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;include name procedure&amp;gt; [&amp;lt;arg name value /&amp;gt;]*[&amp;lt;with from to /&amp;gt;]*&amp;lt;/include&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; attribute of the include element will be used in this flight plan to prefix the blocks of the &amp;lt;tt&amp;gt;procedure&amp;lt;/tt&amp;gt;, the XML referenced file.&lt;br /&gt;
Named arguments may be given with their value in the &amp;lt;tt&amp;gt;arg&amp;lt;/tt&amp;gt; elements. The &amp;lt;tt&amp;gt;with&amp;lt;/tt&amp;gt; tag allows to link labels (e.g. attribute of a deroute instruction or of an exception) from the procedure to blocks of the main flight plan.&lt;br /&gt;
Then, each block of the procedure is like any block of the flight plan and is designated with a dotted identifier: block &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; of a procedure named &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; is named &amp;lt;tt&amp;gt;b.p&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Here is an example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;includes&amp;gt;&lt;br /&gt;
    &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/includes&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Blocks ==&lt;br /&gt;
&lt;br /&gt;
Block elements are the main part of a flight plan: they describe each unit of the mission.&lt;br /&gt;
They are made of various primitives, called stages and exceptions, you can put one after the other. When a&lt;br /&gt;
stage (or a block) is finished, the autopilot goes to the next one. The behaviour after the last stage of the last block is undefined. &lt;br /&gt;
&lt;br /&gt;
As described in the DTD, the &amp;lt;tt&amp;gt;blocks&amp;lt;/tt&amp;gt; element is composed of &amp;lt;tt&amp;gt;block&amp;lt;/tt&amp;gt; elements which are sequence of ''stages'':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT blocks (block+)&amp;gt;&lt;br /&gt;
  &amp;lt;!ELEMENT block  (exception|while|heading|attitude|go|xyz|set|call|circle|deroute|stay|follow|survey_rectangle|for|return|eight|oval|home|path)*&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle radius=&amp;quot;75&amp;quot; wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add a button in the [[GCS#Strips|strip of the aircraft]] with the attribute &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This button will activate the block. If the attribute &amp;lt;tt&amp;gt;group&amp;lt;/tt&amp;gt; is specified, all strip buttons of the same group will be placed vertically on top of each other.&lt;br /&gt;
&lt;br /&gt;
In the same way, a key shortcut can be specified:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block key=&amp;quot;D&amp;quot; name=&amp;quot;descent&amp;quot; strip_button=&amp;quot;Descent&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; throttle=&amp;quot;0.0&amp;quot; pitch=&amp;quot;-15&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Modifiers are allowed, using the syntax of [http://library.gnome.org/devel/gtk/2.15/gtk-Keyboard-Accelerators.html#gtk-accelerator-parse GTK accelerators].&lt;br /&gt;
&lt;br /&gt;
An icon can be specified to display the button. The &amp;lt;tt&amp;gt;strip_button&amp;lt;/tt&amp;gt; label then is a tooltip for the icon. The icon must be an image file available in the directory &amp;lt;tt&amp;gt;data/pictures/gcs_icons&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;block name=&amp;quot;Takeoff&amp;quot; strip_icon=&amp;quot;takeoff.png&amp;quot; strip_button=&amp;quot;Takeoff&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expressions ====&lt;br /&gt;
&lt;br /&gt;
Most of the numeric attributes in stages are analyzed as C expressions. The syntax of this C expression is restricted to &lt;br /&gt;
* numeric constants&lt;br /&gt;
* some internal autopilot variables (not fully documented, see examples)&lt;br /&gt;
* Some binary operators: &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=, &amp;lt;&amp;gt;, ==, +, -, /, *&lt;br /&gt;
* Some utility functions&lt;br /&gt;
&lt;br /&gt;
Some examples of usable expressions are given in the next sections.&lt;br /&gt;
=== Initialization  Blocks ===&lt;br /&gt;
Most flight plans will have three blocks of flight plan initialization blocks. It is good practice to follow this example below if you first start learing to create flightplans&lt;br /&gt;
&lt;br /&gt;
The first block waits until the GPS fix has been established, as shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Wait GPS&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The second block updates the local waypoints with respect to the UAV.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Geo init&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;while cond=&amp;quot;LessThan(NavBlockTime(), 10)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;NavSetGroundReferenceHere()&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This next block prevents the UAV from starting the engine and taking off. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Holding point&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!--set var=&amp;quot;nav_mode&amp;quot; value=&amp;quot;NAV_MODE_ROLL&amp;quot;/--&amp;gt;&lt;br /&gt;
      &amp;lt;set value=&amp;quot;1&amp;quot; var=&amp;quot;kill_throttle&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;attitude roll=&amp;quot;0&amp;quot; throttle=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exceptions ===&lt;br /&gt;
&lt;br /&gt;
The flight manager can handle exceptions. They consist in conditions checked periodically (at the same pace as the navigation control), allowing the control to jump to a given block. Here is the syntax of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;...&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; is an expression and &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the name of the block we want to switch to as soon as the condition is true.&lt;br /&gt;
&lt;br /&gt;
Here are some example of exceptions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;10 &amp;gt; PowerVoltage()&amp;quot; deroute=&amp;quot;go_down&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(ground_alt+10 &amp;gt; GetPosAlt())&amp;quot; deroute=&amp;quot;go_up&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;exception cond=&amp;quot;(autopilot_flight_time &amp;gt; 840)&amp;quot; deroute=&amp;quot;quick_land&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions can be local to a block or global to the flight plan, in the &amp;lt;tt&amp;gt;&amp;lt;exceptions&amp;gt;&amp;lt;/tt&amp;gt; element. In the following example, time since last reception of a message from the ground station is monitored and the navigation is switched to the &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt; block if no message have been received for 22s. This exception is valid for '''all''' the blocks.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;flight_plan ...&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt; ... &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;exceptions&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;datalink_time &amp;gt; 22&amp;quot; deroute=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/exceptions&amp;gt;&lt;br /&gt;
  &amp;lt;blocks&amp;gt; ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deroute ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;deroute&amp;lt;/tt&amp;gt; is the ''goto'' directive of the flight plan; it switches the navigation to the given block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this primitive should not be used to execute loops which are provided by the following elements.&lt;br /&gt;
&lt;br /&gt;
=== Loops ===&lt;br /&gt;
&lt;br /&gt;
Unbounded loops are written with &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; elements whose &amp;lt;tt&amp;gt;cond&amp;lt;/tt&amp;gt; attribute is a boolean expression.&lt;br /&gt;
Children  of &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; are stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;while cond=&amp;quot;TRUE&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;A&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;go wp=&amp;quot;B&amp;quot;/&amp;gt; &lt;br /&gt;
    &amp;lt;go wp=&amp;quot;C&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;while cond=&amp;quot;5 &amp;gt; stage_time&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/while&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In this example, we run an infinite loop, lettin the aircraft try to go via waypoints &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; and waiting for 5 seconds before repeating.&lt;br /&gt;
&lt;br /&gt;
Bounded loops are written with the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; tag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;0&amp;quot; to=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where the body of the loop will be run four times.&lt;br /&gt;
&lt;br /&gt;
The variable of a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop can be used inside expressions appearing as attributes of the stages:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var=&amp;quot;i&amp;quot; from=&amp;quot;1&amp;quot; to=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot; alt=&amp;quot;ground_alt+50*$i&amp;quot; until=&amp;quot;stage_time&amp;gt;10&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the aircraft will circle around waypoint '''HOME''' for 10 seconds at and altitude above ground of 50m, 10 seconds at altitude 100 meter (50+50), ... until 250m (5x +50).&lt;br /&gt;
&lt;br /&gt;
Note: Two bounded loops using the same control variable are not allowed in the same block.&lt;br /&gt;
&lt;br /&gt;
=== Navigation modes ===&lt;br /&gt;
&lt;br /&gt;
Navigation modes give the description of the desired trajectory in 3D. While the horizontal mode is specified through&lt;br /&gt;
''stages'', the vertical control is specified with various attributes of these stages. The current available navigation stages are&lt;br /&gt;
* attitude : just keep a fixed attitude;&lt;br /&gt;
* heading : keep a given course;&lt;br /&gt;
* go : go to a given waypoint;&lt;br /&gt;
* path : list of waypoints linked by ''go''&lt;br /&gt;
* circle : circle around a waypoint;&lt;br /&gt;
* oval : two half circles with a straight between two nav points&lt;br /&gt;
* eight : fly a figure of eight through a waypoint and around another&lt;br /&gt;
* stay : hold the position (hard to realize for a fixed-wing aircraft);&lt;br /&gt;
* follow : follow another aircraft;&lt;br /&gt;
* xyz : circle around a point moveable with the RC transmitter stick (obsolete with the datalink).&lt;br /&gt;
&lt;br /&gt;
The vertical control is achieved using the &amp;lt;tt&amp;gt;vmode&amp;lt;/tt&amp;gt; attribute of these stages. The possible values are &lt;br /&gt;
* '''alt''' (the default) : the autopilot keeps the desired altitude which is the altitude of the waypoint (if any) or the altitude specified with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute;&lt;br /&gt;
* '''climb''' : the autopilot keeps the desired vertical speed specified with the &amp;lt;tt&amp;gt;climb&amp;lt;/tt&amp;gt; attribute (in m/s);&lt;br /&gt;
* '''throttle''' : the autopilots sets the desired throttle specified with the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute (between 0 and 1);&lt;br /&gt;
* '''glide''' : the autopilot keeps the desired slope between two waypoints&lt;br /&gt;
&lt;br /&gt;
The default control is done with the throttle. However, setting the &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute to '''auto''' and the &amp;lt;tt&amp;gt;throttle&amp;lt;/tt&amp;gt; attribute to a constant allows a vertical control only by controlling the attitude of the A/C.&lt;br /&gt;
The &amp;lt;tt&amp;gt;pitch&amp;lt;/tt&amp;gt; attribute also can be set to any value (in degrees) while the throttle control is in use: it usually affects the airspeed of the aircraft.  &lt;br /&gt;
&lt;br /&gt;
The different navigation modes are detailed in the next sections.&lt;br /&gt;
&lt;br /&gt;
=== Attitude ===&lt;br /&gt;
&lt;br /&gt;
Element &amp;lt;tt&amp;gt;attitude&amp;lt;/tt&amp;gt; is the navigation mode which corresponds to the current lowest control loop for horizontal mode.&lt;br /&gt;
The autopilot then keeps a constant attitude. The &amp;lt;tt&amp;gt;roll&amp;lt;/tt&amp;gt; attribute is required (in degrees, positive to put right wing low).&lt;br /&gt;
&lt;br /&gt;
To fly away, at constant airspeed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;0&amp;quot; vmode=&amp;quot;throttle&amp;quot;, throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To fly around, holding a given altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;attitude roll=&amp;quot;30&amp;quot; alt=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that it is not a ''safe'' navigation mode since the geographic position of the plane is not controlled. However, this mode is useful to tune the roll attitude control loop.&lt;br /&gt;
&lt;br /&gt;
=== Heading ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;heading&amp;lt;/tt&amp;gt; primitive is relative to the second level loop for horizontal mode in the autopilot which will keep the given &amp;lt;tt&amp;gt;course&amp;lt;/tt&amp;gt;, a required attribute (in degrees, clockwise, north=0, east=90).&lt;br /&gt;
&lt;br /&gt;
One example to takeoff, following the QFU, 80% throttle, nose up (15 degrees) until height of 30m is reached:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;heading course=&amp;quot;QFU&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.8&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;(GetPosAlt() &amp;gt; ground_alt+30)&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Go ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitive is probably the most useful one. Basically, the autopilot will try to join a given waypoint (&amp;lt;tt&amp;gt;wp&amp;lt;/tt&amp;gt;, the only required attribute). So the simplest thing you can ask for is&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go wp=&amp;quot;HOME&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
which will set the '''HOME''' waypoint as the desired target position. Note than since &amp;lt;tt&amp;gt;vmode=&amp;quot;alt&amp;quot;&amp;lt;/tt&amp;gt; is the default, the altitude of the target waypoint is also taken into account. The navigation will switch to the next stage as soon as the target is reached.&lt;br /&gt;
&lt;br /&gt;
It is usually not a good idea to try to join a waypoint without asking for a precise trajectory, i.e. a given line.&lt;br /&gt;
Setting the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute to '''route''', the navigation will go over a segment joining two waypoints:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target altitude is the altitude of the target waypoint; it can also be set with the &amp;lt;tt&amp;gt;alt&amp;lt;/tt&amp;gt; attribute. The following example keeps an altitude with fixed throttle:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp2&amp;quot; wp=&amp;quot;wp3&amp;quot; hmode=&amp;quot;route&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.75&amp;quot; alt=&amp;quot;ground_alt+100&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The attributes related to the vertical control can also be set to replace the default altitude mode:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; vmode=&amp;quot;climb&amp;quot; climb=&amp;quot;1.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;lt;tt&amp;gt;approaching_time&amp;lt;/tt&amp;gt; (in seconds) attribute helps to decide when the target is ''reached''. It can be set&lt;br /&gt;
to '''0''' to go over the target waypoint (default value is the '''CARROT''' time, set in the airframe configuration file).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;go from=&amp;quot;wp1&amp;quot; wp=&amp;quot;wp2&amp;quot; hmode=&amp;quot;route&amp;quot; approaching_time=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Path ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;path&amp;lt;/tt&amp;gt; primitive is just a shorthand expression for a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives. A list of waypoints defined with the &amp;lt;tt&amp;gt;wpts&amp;lt;/tt&amp;gt; attribute is pre-processed into a set of &amp;lt;tt&amp;gt;go&amp;lt;/tt&amp;gt; primitives with the &amp;lt;tt&amp;gt;hmode&amp;lt;/tt&amp;gt; attribute. For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp1, wp2, wp3&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other attributes are optional:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;path wpts=&amp;quot;wp3, wp1, wp2&amp;quot; approaching_time=&amp;quot;1&amp;quot; pitch=&amp;quot;auto&amp;quot; throttle=&amp;quot;0.5&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Circle ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; primitive is the second main navigation mode: the trajectory is defined as a circle around a given waypoint with a given radius:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
A positive radius makes the UAS move clockwise, a negative counter-clockwise.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;until&amp;lt;/tt&amp;gt; attribute may be used to control the end of the stage. The following example defines an ascending trajectory at constant throttle, nose up (15 degrees), over growing circles, until the battery level is low:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;circle wp=&amp;quot;wp1&amp;quot; radius=&amp;quot;50+(GetPosAlt()-ground_alt)/2&amp;quot; vmode=&amp;quot;throttle&amp;quot; throttle=&amp;quot;0.75&amp;quot; pitch=&amp;quot;15&amp;quot; until=&amp;quot;10&amp;gt;PowerVoltage()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Oval ===&lt;br /&gt;
The oval consists of two half circles that are connected with two straight lines. This flight path is usefull when a IMU is used because the straights allow for level flight. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &amp;lt;oval p1=&amp;quot;1&amp;quot; p2=&amp;quot;2&amp;quot; radius=&amp;quot;nav_radius&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Eight ===&lt;br /&gt;
Fly a figure of eight that consists of two straight legs that pass though the center and the center of the half circle at the end of the two legs is in the turn around  waypoint. The altitude of the center waypoint is used for the entire figure. The turn around waypoint is moved to match radius given. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;  &amp;lt;eight center=&amp;quot;1&amp;quot; radius=&amp;quot;nav_radius&amp;quot; turn_around=&amp;quot;2&amp;quot;/&amp;gt; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Follow ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;follow&amp;lt;/tt&amp;gt; is a special primitive which makes the UAS follow another UAS (real or simulated, named with its &amp;lt;tt&amp;gt;ac_id&amp;lt;/tt&amp;gt;) at a given &amp;lt;tt&amp;gt;distance&amp;lt;/tt&amp;gt; (in meters) behind and at a given &amp;lt;tt&amp;gt;height&amp;lt;/tt&amp;gt; (in meters) above.&lt;br /&gt;
&lt;br /&gt;
In this example, the autopilot will try to follow A/C number '''4''', staying '''50'''m behind and '''20'''m above.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;follow ac_id=&amp;quot;4&amp;quot; distance=&amp;quot;50&amp;quot; height=&amp;quot;20&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that the &amp;lt;tt&amp;gt;traffic_info.c&amp;lt;/tt&amp;gt; file is required by this feature and the &amp;lt;tt&amp;gt;TRAFFIC_INFO&amp;lt;/tt&amp;gt; flag has to be set to enable it. Then, the following lines must be added in the airframe file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.srcs += traffic_info.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;sim.CFLAGS += -DTRAFFIC_INFO&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stay ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;stay&amp;lt;/tt&amp;gt; is a mode for UAS's able to hover:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;stay wp=&amp;quot;HOME&amp;quot; alt=&amp;quot;10&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== XYZ ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;xyz&amp;lt;/tt&amp;gt; is a special mode where the UAS circles around a user moveable waypoint. This waypoint is moved with the RC sticks:&lt;br /&gt;
* YAW channel controls the point over the west-east axis;&lt;br /&gt;
* PITCH channel controls the point over the south-north axis;&lt;br /&gt;
* ROLL channel controls the altitude.&lt;br /&gt;
&lt;br /&gt;
Example (default radius is '''100'''):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;xyz radius=&amp;quot;40&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Set ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt; element is a dangerous one which should be used only by expert users: it is used to directly set an internal variable of the autopilot. For example, you can change the value of the default ground altitude, a variable used by the home mode failsafe procedure (and maybe by your own flight plan):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;set var=&amp;quot;ground_alt&amp;quot; value=&amp;quot;ground_alt+50&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This directive is extremely powerful and has great potential for error - use with caution.&lt;br /&gt;
&lt;br /&gt;
=== Call ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;call&amp;lt;/tt&amp;gt; allows the user to define its own navigation procedures in C. The &amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt; must be a call to a boolean function which must return TRUE as long as the stage is not completed (a function which should be called only once would then return immediately FALSE).&lt;br /&gt;
This feature is illustrated with the '''line''' pattern:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;call fun=&amp;quot;nav_line(WP_1, WP_2, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where &amp;lt;tt&amp;gt;nav_line_init()&amp;lt;/tt&amp;gt; returns FALSE and &amp;lt;tt&amp;gt;nav_line()&amp;lt;/tt&amp;gt; always returns TRUE (this stage never ends).&lt;br /&gt;
Such functions usually are defined in a supplementary C file which must be specified in the airframe file (in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section)&lt;br /&gt;
 &amp;lt;tt&amp;gt;ap.srcs += nav_line.c&lt;br /&gt;
 sim.srcs += nav_line.c&amp;lt;/tt&amp;gt;&lt;br /&gt;
These functions also must be declared in a header file which must be mentioned in the header element of the flight plan:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;header&amp;gt;&lt;br /&gt;
#include &amp;quot;nav_line.h&amp;quot;&lt;br /&gt;
  &amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
These C source file and H header file must be located in the &amp;lt;tt&amp;gt;sw/airborne&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
You can also call functions before or after each execution of the block:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;block name=&amp;quot;circlehome&amp;quot; pre_call=&amp;quot;function_to_call_before_circle()&amp;quot; post_call=&amp;quot;function_to_call_after_circle()&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp=&amp;quot;HOME&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced Examples ==&lt;br /&gt;
Parameters used in a flight plan can be computed expressions. In this example, the plane is asked to perform 5 circles at progressively increasing altitudes for exactly one minute at each altitude:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;for var = &amp;quot;i&amp;quot; from = &amp;quot;1&amp;quot; to = &amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;circle wp = &amp;quot;HOME&amp;quot; radius=&amp;quot;75&amp;quot;&lt;br /&gt;
          alt = &amp;quot;ground_alt+50*$i&amp;quot;&lt;br /&gt;
          until = &amp;quot;stage_time&amp;gt;60&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/for&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Immobilize Actuators === &lt;br /&gt;
&lt;br /&gt;
h_ctl setpoints variable are set by the h_ctl_attitude_loop() (from fw_h_ctl.c) loop) which can be disabled with the&lt;br /&gt;
h_ctl_disabled flag:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_aileron_setpoint&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_elevator_setpoint&amp;quot; value=&amp;quot;MAX_PPRZ/2&amp;quot;/&amp;gt;&lt;br /&gt;
 .... waiting for a condition ...&lt;br /&gt;
 &amp;lt;set var=&amp;quot;h_ctl_disabled&amp;quot; value=&amp;quot;FALSE&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
&lt;br /&gt;
Procedures are libraries which can be included in flight plans. They are composed of waypoints, sectors and blocks. The header of a procedure may contain some parameters which are replaced by arguments when the procedure is included.&lt;br /&gt;
&lt;br /&gt;
Extract of the DTD: a procedure is a sequence of parameters, waypoints, ...:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;!ELEMENT procedure (param*,header?,waypoints?,sectors?,exceptions?,blocks?)&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;param&amp;lt;/tt&amp;gt;eter is just a name. A parameter is optional if it is declared with a default value.&lt;br /&gt;
An example with a required and an optional parameter:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;alt&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;radius&amp;quot; default_value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Procedures are called with the &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; element in a flight plan. A procedure cannot be included twice or by another procedure. A procedure call requires:&lt;br /&gt;
&lt;br /&gt;
* the name of the procedure file, the name given to this inclusion; &lt;br /&gt;
* values for the parameters;&lt;br /&gt;
* backlinks for block name exits of the procedure.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the corresponding procedure '''landing.xml''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE procedure SYSTEM &amp;quot;flight_plan.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;procedure&amp;gt;&lt;br /&gt;
    &amp;lt;waypoints&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;AF&amp;quot; x=&amp;quot;177.4&amp;quot; y=&amp;quot;45.1&amp;quot; alt=&amp;quot;30&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;TD&amp;quot; x=&amp;quot;28.8&amp;quot; y=&amp;quot;57.0&amp;quot; alt=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;waypoint name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;168.8&amp;quot; y=&amp;quot;-13.8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;blocks&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-10), 10 &amp;gt; fabs(GetPosAlt()- WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/block&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/blocks&amp;gt;&lt;br /&gt;
  &amp;lt;/procedure&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the name of procedure '''land''' block will be renamed into '''landing.land''':&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;deroute block=&amp;quot;landing.land&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
will jump to this procedure block.&lt;br /&gt;
&lt;br /&gt;
Suppose you have a go-around condition in your landing procedure. You would write it&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;exception cond=&amp;quot;...&amp;quot; deroute=&amp;quot;go-around&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
then you must link this block exit with one of your block (e.g. &amp;lt;tt&amp;gt;Standby&amp;lt;/tt&amp;gt;). So you would include the procedure as follows:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;include name=&amp;quot;landing&amp;quot; procedure=&amp;quot;landing.xml&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;with from=&amp;quot;go-around&amp;quot; to=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/include&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tips and Tricks ==&lt;br /&gt;
&lt;br /&gt;
There are many ways to skin a cat just as there are many ways to craft your flight plan. Following the best practices tips can save you from a lot of frustration and mishap.&lt;br /&gt;
&lt;br /&gt;
* Simulate your flight plan before taking it to the sky. Flight plans should always be carefully tested prior to flight, take a look at the [[Simulation|simulation]] page for details on how to simulate your plan.&lt;br /&gt;
* Make an subdirectory in the Flight_plan directory with your own name and add your flight plans there. Make sure that the location of the DTD is correct, e.g by using relative directory double dots as in &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE flight_plan SYSTEM &amp;quot;../flight_plan.dtd&amp;quot;&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Take a good look at other flight plans included with Paparazzi. To learn from example flight plans please visit the [[Flight_Plan_Examples|flight plan examples]] page&lt;br /&gt;
* There are several option to build failsafe features into you flightplan, [[Failsafe|for some examples visit the Failsafe page]].&lt;br /&gt;
* Some flight plan examples define waypoint locations using relative coordinates. These are relative positions from the fixed lat and lon in the header of the flight plan. When simulating your flight plan the aircraft always use the lat/lon as defined in the flight plan since a regular simulation has no notion of you current position of you local PC where you simulate on. This is something to keep in mind if you test your flight plan in real flights.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18621</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18621"/>
		<updated>2014-05-10T05:37:23Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* mode: GUIDANCE_V_MODE_HOVER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB (speed control) ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB (speed control) ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER (altitude control) ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
z relates to altitude, zd to speed and zdd to acceleration&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.c'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18620</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18620"/>
		<updated>2014-05-10T05:37:07Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* mode: GUIDANCE_V_MODE_CLIMB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB (speed control) ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB (speed control) ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
z relates to altitude, zd to speed and zdd to acceleration&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.c'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18619</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18619"/>
		<updated>2014-05-10T05:36:53Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* mode: GUIDANCE_V_MODE_RC_CLIMB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB (speed control) ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
z relates to altitude, zd to speed and zdd to acceleration&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.c'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18618</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18618"/>
		<updated>2014-05-10T05:32:58Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* from z dot set point (desired speed) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
z relates to altitude, zd to speed and zdd to acceleration&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.c'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18617</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18617"/>
		<updated>2014-05-10T05:32:20Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Reference generators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
z relates to altitude, zd to speed and zdd to acceleration&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18616</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18616"/>
		<updated>2014-05-10T05:31:04Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* from z dot set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point (desired speed) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18615</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=18615"/>
		<updated>2014-05-10T05:30:37Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* from z set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Energy Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Total Energy (speed + height) control for fixed wing vehicles developed by the [http://www.mavlab.info MAVLab] of the Technical [http://www.tudelft.nl University] of Delft. An airspeed sensor is mandatory.&lt;br /&gt;
The energy control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop and is located in '''energy_ctrl.c'''.&lt;br /&gt;
&lt;br /&gt;
[[Image:Energycontrol.png|Energy Control loop]]&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point (desired altitude) ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop_V40.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
NOMINAL_HOVER_THROTTLE is the nominal thrust when hovering. It's calculated by default by an adaptative controller, in  '''guidance\guidance_v_adpt.h'''.&lt;br /&gt;
&lt;br /&gt;
Instead of the adaptative controller, NOMINAL_HOVER_TROTTLE can be set manually in the Airframe configuration file with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;define name=&amp;quot;NOMINAL_HOVER_THROTTLE&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value is found after flying manually in hover: NOMINAL_HOVER_THROTTLE= THRUST/MAX_PPRZ (THRUST:mean value of ROTORCRAFT_FP THRUST message in hover, MAX_PPRZ:9600) &lt;br /&gt;
&lt;br /&gt;
In most cases it makes more sense to not specify this explicitly and use the adaptive controller&lt;br /&gt;
&lt;br /&gt;
== Horizontal Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following horizontal modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_RATE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_RATE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_ATTITUDE ===&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_ATTITUDE.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
When this mode is entered, the measured position at the instance of initiation is set as guidance_h_pos_sp. This means that the rotorcraft will hover on that position.&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_HOVER.png]]&lt;br /&gt;
&lt;br /&gt;
rotation to body:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi_{cmd_{body}}= -\sin \psi \cdot x_{cmd_{earth}} + \cos \psi \cdot y_{cmd_{earth}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\theta_{cmd_{body}}= -\left( \cos \psi \cdot x_{cmd_{earth}} + \sin \psi \cdot y_{cmd_{earth}} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
The set points guidance_h_pos_sp (x and y coordinates) are obtained from the navigation carrot after a 'NED of ENU' transformation:&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.x = navigation_carrot.y&lt;br /&gt;
&lt;br /&gt;
guidance_h_pos_sp.y = navigation_carrot.x&lt;br /&gt;
&lt;br /&gt;
[[Image:GUIDANCE_H_MODE_NAV.png]]&lt;br /&gt;
&lt;br /&gt;
Rotation to body is the same as in GUIDANCE_H_MODE_HOVER.&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from euler attitude angle set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_att.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_attitude_ref_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
=== from pos set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&lt;br /&gt;
&lt;br /&gt;
Acceleration is set to zero when rate reaches min or max value.&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator is located in '''guidance/guidance_h_ref.h'''.&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_attitude_euler_int.c'''.&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''stabilization/stabilization_rate.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:guidance_horizontal_hover.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''.&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_horizontal_nav.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this loop is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18614</id>
		<title>Subsystem/actuators</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18614"/>
		<updated>2014-05-09T23:13:24Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* XML configuration */ remove example of pre-5.0 &amp;quot;supervision&amp;quot; stabilization&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Subsystems&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This subsystem only needs be explicitly specified for rotorcrafts where there are several different actuators implementations and you have to add the correct one depending on the ESCs you use.&lt;br /&gt;
&lt;br /&gt;
Currently possible actuators subsystems are&lt;br /&gt;
* ''mkk''&lt;br /&gt;
* ''asctec''&lt;br /&gt;
* ''asctec_v2''&lt;br /&gt;
* ''pwm''&lt;br /&gt;
* ''skiron''&lt;br /&gt;
* ''heli''&lt;br /&gt;
* ''ardrone2''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MKK ==&lt;br /&gt;
Mikrokopter ESCs&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
   &amp;lt;subsystem name=&amp;quot;actuators&amp;quot;     type=&amp;quot;mkk&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;configure name=&amp;quot;MKK_I2C_SCL_TIME&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt; &amp;lt;!-- only LPC21xx, optional, 150 is default, use 50 for 8 motors--&amp;gt;&lt;br /&gt;
   &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;I2C_TRANSACTION_QUEUE_LEN&amp;quot; value=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- default is 8, increase to 10 or more for 8 motors--&amp;gt;&lt;br /&gt;
 &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* ''MKK_I2C_SCL_TIME'' is specific to LPC21x based boards (e.g. booz) and has no effect for STM32 based boards (e.g. Lisa/M/L)&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
required defines in section ''ACTUATORS_MKK'':&lt;br /&gt;
* ''NB'': number of motors&lt;br /&gt;
* ''ADDR'': the I2C addresses of your motors&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;ACTUATORS_MKK&amp;quot; prefix=&amp;quot;ACTUATORS_MKK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADDR&amp;quot; value=&amp;quot;{ 0x52, 0x54, 0x56, 0x58 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The order of addresses in the list defines the numbering of motors! Warn on this during motor mixing!&lt;br /&gt;
&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
MKK specific values for SUPERVISION defines:&lt;br /&gt;
* ''STOP_MOTOR'' : 0, optional, as the default is already 0&lt;br /&gt;
* ''MIN_MOTOR'' : 3&lt;br /&gt;
* ''MAX_MOTOR'' : 200&lt;br /&gt;
&lt;br /&gt;
== Asctec v1 ==&lt;br /&gt;
These controllers already to the mixing themselves, so the [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]] section is not needed.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Asctec v2 ==&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec_v2&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
You need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== PWM Supervision ==&lt;br /&gt;
Only for stm32 based autopilot boards (eg. Lisa/M, Lisa/L)&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;pwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The define ''SERVO_HZ'' sets a higher update frequency for the pwm controllers which is needed for good response times on some ESCs. Some newer ESCs are said to work better with lower frequencies. More information should be added here.&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;servos min=&amp;quot;0&amp;quot; neutral=&amp;quot;0&amp;quot; max=&amp;quot;0xff&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;FRONT&amp;quot; no=&amp;quot;0&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;BACK&amp;quot; no=&amp;quot;1&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;LEFT&amp;quot; no=&amp;quot;2&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;RIGHT&amp;quot; no=&amp;quot;3&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== Dual PWM ==&lt;br /&gt;
This driver allows you to generate dual pulses to control for example double servos like those :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual linear servos.jpg]]&lt;br /&gt;
&lt;br /&gt;
The signal we want to generate look like that :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual_pulse.png]]&lt;br /&gt;
&lt;br /&gt;
During the time of a regular pwm pulse (20ms) we got two parts :&lt;br /&gt;
* the first 1 with a total period of 4ms. During that part we generate the first pulse that is going to control for exemple the first servo.&lt;br /&gt;
* the first 2 with a total period of 16ms. During that part we generate the second pulse that is going to control for exemple the second servo.&lt;br /&gt;
&lt;br /&gt;
=== How to use the driver ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;This module is only implemented on the lisa M and lisa S boards at the time of writing this documentation (28 mars 2014)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all you are going to need to add the subsystem that is going to generate those pulses :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot;   board=&amp;quot;lisa_s_0.1&amp;quot;&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;dualPwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;DUAL_PWM_ON&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
Then we will be able to add a servo block into the airframe file (in the same way we would for regular servos). But we have to specify the driver that we are using for thoses servos :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
  &amp;lt;servos driver=&amp;quot;DualPwm&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;SWITCH&amp;quot;  no=&amp;quot;3&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;pitchator&amp;quot;  no=&amp;quot;2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;The tricky part about this module is that it requires the use of the full timer (that was previously shared between multiple regular pwm). In order to reduce the wast of pins we can only put that type of servos on specifics pins :&lt;br /&gt;
* lisa S (version 0.1) : on the servos 2 and 3 (as shown above). The dual PWM will then but outputted on the 5th pin (yes that is not logical).&lt;br /&gt;
* lisa M (version 2.0) : on the servos 4 and 5. The dual PWM will be outputted on the 4th pin.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Subsystems]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Contributing&amp;diff=18613</id>
		<title>Contributing</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Contributing&amp;diff=18613"/>
		<updated>2014-05-09T01:21:13Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: add option for https fork and fix formatting of git urls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How to contribute ==&lt;br /&gt;
&lt;br /&gt;
It would be fantastic if you add you share to enhance the Paparazzi project. Help is always very welcome for aspects of the project. May this be documentation, wiki, maintenance, electronics or code contributions and fixes. There are lots of ways to contribute to Paparazzi and get involved. &lt;br /&gt;
&lt;br /&gt;
This page will give you a headstart to be able to contribute.&lt;br /&gt;
&lt;br /&gt;
=== Wiki ===&lt;br /&gt;
&lt;br /&gt;
Just create an account and you can start adding information, cleaning it up or just fixing some typo you just noticed :-)&lt;br /&gt;
&lt;br /&gt;
Some information and links on how to edit the wiki can be found at [[Help:Editing]].&lt;br /&gt;
&lt;br /&gt;
Please be aware of past edits and page histories. Try not to remove this; if you are moving/renaming a page, use the '''move''' tab at the top of a page. This ensures the revision history is moved with the page.&lt;br /&gt;
&lt;br /&gt;
=== Software development ===&lt;br /&gt;
&lt;br /&gt;
[[File:AGoodCombinationSTM32ProgressnDebugging.jpg|300px|thumb|Left|Learning Tools]]&lt;br /&gt;
&lt;br /&gt;
We use the distributed version control system [http://git-scm.com/ git]. The [http://github.com/paparazzi/paparazzi/ Papaprazzi master repository is hosted on Github].&lt;br /&gt;
&lt;br /&gt;
Also see the [[Git|Git wiki page]] for more details about setting up Git and cloning the source-code and data repository.&lt;br /&gt;
&lt;br /&gt;
Please also have a look at the [http://docs.paparazziuav.org/latest/styleguide.html Coding Style Guide].&lt;br /&gt;
&lt;br /&gt;
Here is the short version if you already know git:&lt;br /&gt;
# Create an account on [http://github.com/ github].&lt;br /&gt;
# Fork the [http://github.com/paparazzi/paparazzi/ papaprazzi repo] on github. (After logging in press the '''fork''' button).&lt;br /&gt;
# If you want to clone with SSH: '''git clone git@github.com:&amp;lt;yourname&amp;gt;/paparazzi.git'''&amp;lt;br/&amp;gt;Or with HTTPS: '''git clone &amp;lt;nowiki&amp;gt;https://github.com/&amp;lt;yourname&amp;gt;/paparazzi.git&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
# '''git remote add upstream &amp;lt;nowiki&amp;gt;https://github.com/paparazzi/paparazzi.git&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
# '''git fetch upstream'''&lt;br /&gt;
# checkout a new branch based on the development branch (master):&amp;lt;br/&amp;gt;'''git checkout -b my_new_feature upstream/master'''&lt;br /&gt;
# fix/code and commit in logical units&lt;br /&gt;
# push your feature/bugfix branch&lt;br /&gt;
# Send us a [http://help.github.com/pull-requests/ pull request] on github. (Or send patches to the mailing list).&lt;br /&gt;
&lt;br /&gt;
=== Defects and Features ===&lt;br /&gt;
To report Paparazzi defect, various issues and to submit a feature request use the simple [https://github.com/paparazzi/paparazzi/issues issue tracker on github].&lt;br /&gt;
&lt;br /&gt;
=== Continuous Integration Builds ===&lt;br /&gt;
There is a [http://paparazzi.gondwana.com.au build server] running quite some [[Builds/Tests|Continuous Integration tests]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Subsystem/stabilization&amp;diff=18612</id>
		<title>Subsystem/stabilization</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Subsystem/stabilization&amp;diff=18612"/>
		<updated>2014-05-08T21:18:24Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: fix names of types&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages hideprefix=always&amp;gt;Subsystems&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
== Stabilization subsystem ==&lt;br /&gt;
The ''stabilization'' subsystem provides the attitude controller for rotorcrafts.&lt;br /&gt;
&lt;br /&gt;
Currently possible attitude ''stabilization'' subsystem types are&lt;br /&gt;
* ''[[Subsystem/stabilization#Quaternion|int_quat]]''&lt;br /&gt;
* ''[[Subsystem/stabilization#Quaternion|float_quat]]''&lt;br /&gt;
* ''[[Subsystem/stabilization#Euler|int_euler]]''&lt;br /&gt;
* ''[[Subsystem/stabilization#Euler|float_euler]]''&lt;br /&gt;
&lt;br /&gt;
== Attitude Control Implementations ==&lt;br /&gt;
There are several different attitude control algorithm implementations.&lt;br /&gt;
&lt;br /&gt;
They use the same ''STABILIZATION_ATTITUDE'' xml configuration section:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;STABILIZATION_ATTITUDE&amp;quot; prefix=&amp;quot;STABILIZATION_ATTITUDE_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- setpoints --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_PHI&amp;quot;     value=&amp;quot;45.&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_THETA&amp;quot;   value=&amp;quot;45.&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_R&amp;quot;       value=&amp;quot;90.&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_A&amp;quot;     value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_E&amp;quot;     value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_R&amp;quot;     value=&amp;quot;250&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- reference --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_OMEGA_P&amp;quot;  value=&amp;quot;800&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_ZETA_P&amp;quot;   value=&amp;quot;0.85&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_P&amp;quot;    value=&amp;quot;400.&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_PDOT&amp;quot; value=&amp;quot;RadOfDeg(8000.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_OMEGA_Q&amp;quot;  value=&amp;quot;800&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_ZETA_Q&amp;quot;   value=&amp;quot;0.85&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_Q&amp;quot;    value=&amp;quot;400.&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_QDOT&amp;quot; value=&amp;quot;RadOfDeg(8000.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_OMEGA_R&amp;quot;  value=&amp;quot;500&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_ZETA_R&amp;quot;   value=&amp;quot;0.85&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_R&amp;quot;    value=&amp;quot;180.&amp;quot; unit=&amp;quot;deg/s&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_MAX_RDOT&amp;quot; value=&amp;quot;RadOfDeg(1800.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- feedback --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PHI_PGAIN&amp;quot;  value=&amp;quot;1000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PHI_DGAIN&amp;quot;  value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PHI_IGAIN&amp;quot;  value=&amp;quot;200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THETA_PGAIN&amp;quot;  value=&amp;quot;1000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THETA_DGAIN&amp;quot;  value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THETA_IGAIN&amp;quot;  value=&amp;quot;200&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PSI_PGAIN&amp;quot;  value=&amp;quot;500&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PSI_DGAIN&amp;quot;  value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PSI_IGAIN&amp;quot;  value=&amp;quot;10&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- feedforward --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PHI_DDGAIN&amp;quot;   value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THETA_DDGAIN&amp;quot; value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PSI_DDGAIN&amp;quot;   value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; ''SP_MAX_*'': maximum ''PHI''/''THETA'' (roll/pitch) angles and maximum angular velocity ''R'' around yaw axis&lt;br /&gt;
; ''DEADBAND_*'': RC stick deadband around the center for ''A'',''E'',''R'' (roll,pitch,yaw)&lt;br /&gt;
; ''REF_*'': parameters for the [[Control_Loops#Reference_generators_2|reference generator]]&lt;br /&gt;
; ''[PHI|THETA|PSI]_[PID]GAIN'': gains for the feedback control of the respective axis&lt;br /&gt;
; ''[PHI|THETA|PSI]_DDGAIN'': feedforward gains for the respective axis&lt;br /&gt;
&lt;br /&gt;
=== Quaternion ===&lt;br /&gt;
Attitude controllers using quaternions (no gimbal lock).&lt;br /&gt;
There is a fixed point implementation (recommended) and a floating point implementation for reference and testing.&lt;br /&gt;
&lt;br /&gt;
* fixed point: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;subsystem name=&amp;quot;stabilization&amp;quot; type=&amp;quot;int_quat&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
* floating point: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;subsystem name=&amp;quot;stabilization&amp;quot; type=&amp;quot;float_quat&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;stabilization&amp;quot; type=&amp;quot;int_quat&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the ''STABILIZATION_ATTITUDE'' xml configuration section as described above.&lt;br /&gt;
&lt;br /&gt;
=== Euler ===&lt;br /&gt;
Attitude controller using Euler Angles. Due to the inherent singularities (e.g. 90deg pitch) of the euler angles representation you can't use this controller if you want to fly in regimes close or at these singularities (e.g. acrobatics or transitioning vehicles).&lt;br /&gt;
See [[Control_Loops#Attitude_loop]] for diagrams of the control loop.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;stabilization&amp;quot; type=&amp;quot;int_euler&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the ''STABILIZATION_ATTITUDE'' xml configuration section as described above.&lt;br /&gt;
&lt;br /&gt;
== Rate Control ==&lt;br /&gt;
There is only one rate control implementation (which is included in the rotorcraft firmware by default). It allows you to fly a rotorcraft like a helicopter by controlling the angular rate directly instead of having (self-leveling) attitude control.&lt;br /&gt;
See [[Control_Loops#Rate_loop]] for diagrams of the control loop.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;STABILIZATION_RATE&amp;quot; prefix=&amp;quot;STABILIZATION_RATE_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- setpoints --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_P&amp;quot; value=&amp;quot;10000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_Q&amp;quot; value=&amp;quot;10000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SP_MAX_R&amp;quot; value=&amp;quot;10000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_P&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_Q&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEADBAND_R&amp;quot; value=&amp;quot;200&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REF_TAU&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- feedback --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;GAIN_P&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;GAIN_Q&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;GAIN_R&amp;quot; value=&amp;quot;350&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IGAIN_P&amp;quot; value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IGAIN_Q&amp;quot; value=&amp;quot;75&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IGAIN_R&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- feedforward --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DDGAIN_P&amp;quot; value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DDGAIN_Q&amp;quot; value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DDGAIN_R&amp;quot; value=&amp;quot;300&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Subsystems]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18611</id>
		<title>Subsystem/actuators</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Subsystem/actuators&amp;diff=18611"/>
		<updated>2014-05-08T21:07:31Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: fix pwm_supervision is not the correct name of the type pwm&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Subsystems&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This subsystem only needs be explicitly specified for rotorcrafts where there are several different actuators implementations and you have to add the correct one depending on the ESCs you use.&lt;br /&gt;
&lt;br /&gt;
Currently possible actuators subsystems are&lt;br /&gt;
* ''mkk''&lt;br /&gt;
* ''asctec''&lt;br /&gt;
* ''asctec_v2''&lt;br /&gt;
* ''pwm''&lt;br /&gt;
* ''skiron''&lt;br /&gt;
* ''heli''&lt;br /&gt;
* ''ardrone2''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== MKK ==&lt;br /&gt;
Mikrokopter ESCs&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
   &amp;lt;subsystem name=&amp;quot;actuators&amp;quot;     type=&amp;quot;mkk&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;configure name=&amp;quot;MKK_I2C_SCL_TIME&amp;quot; value=&amp;quot;50&amp;quot;/&amp;gt; &amp;lt;!-- only LPC21xx, optional, 150 is default, use 50 for 8 motors--&amp;gt;&lt;br /&gt;
   &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;I2C_TRANSACTION_QUEUE_LEN&amp;quot; value=&amp;quot;10&amp;quot;/&amp;gt; &amp;lt;!-- default is 8, increase to 10 or more for 8 motors--&amp;gt;&lt;br /&gt;
 &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* ''MKK_I2C_SCL_TIME'' is specific to LPC21x based boards (e.g. booz) and has no effect for STM32 based boards (e.g. Lisa/M/L)&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
required defines in section ''ACTUATORS_MKK'':&lt;br /&gt;
* ''NB'': number of motors&lt;br /&gt;
* ''ADDR'': the I2C addresses of your motors&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;section name=&amp;quot;ACTUATORS_MKK&amp;quot; prefix=&amp;quot;ACTUATORS_MKK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;NB&amp;quot; value=&amp;quot;4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADDR&amp;quot; value=&amp;quot;{ 0x52, 0x54, 0x56, 0x58 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The order of addresses in the list defines the numbering of motors! Warn on this during motor mixing!&lt;br /&gt;
&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
MKK specific values for SUPERVISION defines:&lt;br /&gt;
* ''STOP_MOTOR'' : 0, optional, as the default is already 0&lt;br /&gt;
* ''MIN_MOTOR'' : 3&lt;br /&gt;
* ''MAX_MOTOR'' : 200&lt;br /&gt;
&lt;br /&gt;
== Asctec v1 ==&lt;br /&gt;
These controllers already to the mixing themselves, so the [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]] section is not needed.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Asctec v2 ==&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;asctec_v2&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
You need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
&lt;br /&gt;
== PWM Supervision ==&lt;br /&gt;
Only for stm32 based autopilot boards (eg. Lisa/M, Lisa/L)&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;pwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;400&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The define ''SERVO_HZ'' sets a higher update frequency for the pwm controllers which is needed for good response times on some ESCs. Some newer ESCs are said to work better with lower frequencies. More information should be added here.&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;servos min=&amp;quot;0&amp;quot; neutral=&amp;quot;0&amp;quot; max=&amp;quot;0xff&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;FRONT&amp;quot; no=&amp;quot;0&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;BACK&amp;quot; no=&amp;quot;1&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;LEFT&amp;quot; no=&amp;quot;2&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;RIGHT&amp;quot; no=&amp;quot;3&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1000&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You also need the matching [[Rotorcraft_Configuration#Motor_Mixing|Motor Mixing section]].&lt;br /&gt;
Example PWM specific values for SUPERVISION defines:&lt;br /&gt;
* ''STOP_MOTOR'' : 800&lt;br /&gt;
* ''MIN_MOTOR'' : 1000&lt;br /&gt;
* ''MAX_MOTOR'' : 2000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dual PWM ==&lt;br /&gt;
This driver allows you to generate dual pulses to control for example double servos like those :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual linear servos.jpg]]&lt;br /&gt;
&lt;br /&gt;
The signal we want to generate look like that :&lt;br /&gt;
&lt;br /&gt;
[[File:Dual_pulse.png]]&lt;br /&gt;
&lt;br /&gt;
During the time of a regular pwm pulse (20ms) we got two parts :&lt;br /&gt;
* the first 1 with a total period of 4ms. During that part we generate the first pulse that is going to control for exemple the first servo.&lt;br /&gt;
* the first 2 with a total period of 16ms. During that part we generate the second pulse that is going to control for exemple the second servo.&lt;br /&gt;
&lt;br /&gt;
=== How to use the driver ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;This module is only implemented on the lisa M and lisa S boards at the time of writing this documentation (28 mars 2014)&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all you are going to need to add the subsystem that is going to generate those pulses :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;ap&amp;quot;   board=&amp;quot;lisa_s_0.1&amp;quot;&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;actuators&amp;quot; type=&amp;quot;dualPwm&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;DUAL_PWM_ON&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== XML configuration ===&lt;br /&gt;
Then we will be able to add a servo block into the airframe file (in the same way we would for regular servos). But we have to specify the driver that we are using for thoses servos :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
  &amp;lt;servos driver=&amp;quot;DualPwm&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;SWITCH&amp;quot;  no=&amp;quot;3&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;pitchator&amp;quot;  no=&amp;quot;2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''CAUTION!'''&amp;lt;/span&amp;gt; &amp;lt;b&amp;gt;The tricky part about this module is that it requires the use of the full timer (that was previously shared between multiple regular pwm). In order to reduce the wast of pins we can only put that type of servos on specifics pins :&lt;br /&gt;
* lisa S (version 0.1) : on the servos 2 and 3 (as shown above). The dual PWM will then but outputted on the 5th pin (yes that is not logical).&lt;br /&gt;
* lisa M (version 2.0) : on the servos 4 and 5. The dual PWM will be outputted on the 4th pin.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User_Documentation]] [[Category:Subsystems]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Lisa/M_v2.0&amp;diff=16349</id>
		<title>Lisa/M v2.0</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Lisa/M_v2.0&amp;diff=16349"/>
		<updated>2013-11-26T17:13:50Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Uploading new software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Autopilots&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:LisaM_V2_0_TopView.JPG|right|500px|Lisa/M V2.0 top view]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lisa/M is a small, general purpose autopilot designed with flexibility across multiple applications in mind. Small weight and size, with (optional) integrated [[AspirinIMU | Aspirin IMU]] and full size 0.1&amp;quot; servo headers make the Lisa/M suitable for both fixed-wing and rotorcraft vehicles. This autopilot is based on a STM32 processor for extensive peripheral connection and faster processing.&lt;br /&gt;
&lt;br /&gt;
A number of tutorials are being prepared for getting started with Lisa/M:&lt;br /&gt;
* [[Lisa/M/Tutorial/FixedWing|Fixedwing tutorial]]&lt;br /&gt;
* [[Lisa/M/Tutorial/RotorCraft|Rotorcraft tutorial]]&lt;br /&gt;
&lt;br /&gt;
Please join us in our quest to make the getting started information even more, eh... informative, by adjusting those pages with your own improvements.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
Lisa/M is based on the 64 pins STM32F105RCT6 [http://www.st.com/internet/mcu/product/221023.jsp connectivity line family] processor featuring 64k of RAM and 256k of FLASH. All the pins are exposed, providing access to the complete set of the STM32 peripherals.&lt;br /&gt;
NOTE: This MCU is different from LISA/L. Lisa/L is based on the 64 pins STM32F103RE processor featuring 64k of RAM and 512k of FLASH, which is part of the [http://www.st.com/internet/mcu/product/164485.jsp high-density performance line family].&lt;br /&gt;
&lt;br /&gt;
* STM32 microcontroller [http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00220364.pdf STM32F105RCT6 datasheet] with 256kB flash and 64kB RAM&lt;br /&gt;
* Pressure sensor [http://www.bosch-sensortec.com/content/language1/html/3477.htm BMP085] (optional as of 08/2012)&lt;br /&gt;
* 7 x Analog input channels&lt;br /&gt;
* 3 x Generic digital in-/out-puts&lt;br /&gt;
* 2 x 3.3V TTL UART (5V tolerant)&lt;br /&gt;
* 8 x Servo PPM outputs (only 6 if second I2C (I2C1) bus in use)&lt;br /&gt;
* 1 x CAN bus&lt;br /&gt;
* 1 x [http://en.wikipedia.org/wiki/Serial_Peripheral_Interface SPI] bus&lt;br /&gt;
* 1 x [http://en.wikipedia.org/wiki/I2c I&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;C] bus (2 x when using only the first 6 Servo PPM outputs)&lt;br /&gt;
* 1 x Micro USB&lt;br /&gt;
* 4 x status LEDs with attached test point&lt;br /&gt;
* 10.8 grams (0.4 oz) (with Aspirin IMU mounted)&lt;br /&gt;
* 9.9 grams (0.35 oz) (without Aspirin IMU mounted)&lt;br /&gt;
* ~34mm x ~60mm x ~10mm&lt;br /&gt;
* 4 layers PCB design&lt;br /&gt;
&lt;br /&gt;
With mounted Aspirin IMU has the following additional sensors on board:&lt;br /&gt;
&lt;br /&gt;
* 3 Axis Gyroscope&lt;br /&gt;
* 3 Axis Accelerometer&lt;br /&gt;
* 3 Axis Magnetometer&lt;br /&gt;
* Barometer MS5611 (as of Aspirin v2.1)&lt;br /&gt;
&lt;br /&gt;
NOTE:&lt;br /&gt;
'''Lisa/M has pads for the BMP085 pressure sensor. Lias/M 2 boards made before August 2012 had the BMP085 sensor mounted. Boards made after August 2012 do not have the sensor mounted as they are designed to be used with Aspirin 2.1 which has the new MS5611-01BA03 barometric pressure sensor.'''&lt;br /&gt;
&lt;br /&gt;
The drivers for the MS5611-01BA03 are '''work in progress''' and are available in the master branch of the Paparazzi codebase. All '''help''' with testing and improving the driver are '''very welcome'''!&lt;br /&gt;
&lt;br /&gt;
So, except for a GPS unit you have all necessary sensors for full attitude and altitude stabilization in an extremely small package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=200px heights=200px&amp;gt;&lt;br /&gt;
Image:LisaM_V2_0_TopView.JPG|Lisa/M V2.0 top view&lt;br /&gt;
Image:LisaM_V2_0_BottomView.JPG|Lisa/M V2.0 bottom view&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pinout ==&lt;br /&gt;
Pins Name and Type are specified with respect to the Autopilot Board.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 100%&amp;quot;&amp;gt;&lt;br /&gt;
[[Image:LisaM_V2_0_top_labeled.png|900px]]&lt;br /&gt;
[[Image:LisaM_warning_label.png|200px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''SERVO1/2/3/4/5/6/7/8'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||SERVOx||OUT||Servo signal (PWM)(See Note 1 below)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|2||SV||PWR||Servo Bus Voltage Rail (conf w/ JP1)||style=&amp;quot;background:red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''JTAG'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||N/A||N/A||JTAG Debug Header (Pin 1 is +3V3)||style=&amp;quot;background:white; color:black&amp;quot;|None&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART3'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2||V_IN||PWR||UART Voltage (conf w/ JP6 and JP7)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||TX||OUT||USART3 Serial Output (3.3V level)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|4||RX||IN||USART3 Serial Input (3.3V level)(Pullup to Pin 2 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART1/5'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot (conf w/ JP8 and JP9)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||RX1||IN||USART1 Serial Input (3.3V level)(Pullup to Pin 2 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|4||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|5|| +3V3||PWR||3.3V Rail from autopilot (conf w/ JP8 and JP9)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|6||RX5||IN||UART5 Serial Input (3.3V level)(Pullup to Pin 5 voltage)(5V tolerant)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''GPIO'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||PC12||I/O||GPIO, connected to PC12 (5V tolerant)||style=&amp;quot;background:#FDC579; color:black&amp;quot;|Dark Tan&lt;br /&gt;
|-&lt;br /&gt;
|5||TRST||I/O||JTAG_TRST (also connected to LED1 cathode)||style=&amp;quot;background:#FED6B1; color:black&amp;quot;|Light Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''ANALOG2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| +5V||PWR||5V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||ADC4||I/O||by default connected to LED_4 cathode (Remove LED/resistor to use as ADC4)||style=&amp;quot;background:magenta; color:white&amp;quot;|Magenta&lt;br /&gt;
|-&lt;br /&gt;
|5||ADC6||I/O||by default connected to LED_3 cathode (Remove LED/resistor to use as ADC6)||style=&amp;quot;background:#FFA1B2; color:black&amp;quot;|Pink&lt;br /&gt;
|-&lt;br /&gt;
|6||BOOT0||I/O||BOOT0||style=&amp;quot;background:grey; color:black&amp;quot;|Grey&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''USB'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||N/A||N/A||USB (The USB connections are also available as 0.05&amp;quot; (1.27mm) through hole pads underneath the GPIO header)||style=&amp;quot;background:white; color:black&amp;quot;|None&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''I2C1 CAN'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| V_BATT||PWR||V_BATT Bus on autopilot, voltage divider for V_BAT_MEAS, (conf w/ JP2 to connect to V_IN)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| V_IN||PWR||Connected to autopilot voltage regulator inputs (conf w/ JP1, JP2 and JP3)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||CANL||I/O||CANL (5V level)||style=&amp;quot;background:orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|5||CANH||I/O||CANH (5V level)||style=&amp;quot;background:yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|6||SCL||I/O||SCL (5V level)(See Note 1 below)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|7||SDA||I/O||SDA (5V level)(See Note 1 below)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''SPI1'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||MOSI||Out||MOSI||style=&amp;quot;background:orange; color:white&amp;quot;|Orange&lt;br /&gt;
|-&lt;br /&gt;
|4||MISO||In||MISO||style=&amp;quot;background:yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|5||SCK||Out||SCK||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|6||SS||Out||SS||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|-&lt;br /&gt;
|7||DRDY||I/O||DRDY||style=&amp;quot;background:#FDC579; color:black&amp;quot;|Dark Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''ANALOG1'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3|| +5V||PWR||5V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|4||ADC1||In||ADC1 (or LED_6 if populated)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|5||ADC2||In||ADC2 (or LED_7 if populated)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|-&lt;br /&gt;
|6||ADC3||In||ADC3 (or LED_8 if populated)||style=&amp;quot;background:#FED6B1; color:black&amp;quot;|Light Tan&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||UART Voltage (conf w/ JP4 and JP5)||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||TX||OUT||USART2 Serial Output (3.3V level)||style=&amp;quot;background:Yellow; color:black&amp;quot;|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|4||RX||IN||USART2 Serial Input (3.3V level)('''NOT 5V TOLERANT''')(Pullup to Pin 2 voltage)||style=&amp;quot;background:Orange; color:white&amp;quot;|Orange&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''I2C2'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Pin #''!!width=&amp;quot;10%&amp;quot;|''Name''!!width=&amp;quot;10%&amp;quot;|''Type''!!''Description''!!width=&amp;quot;5%&amp;quot;|''Color''&lt;br /&gt;
|-&lt;br /&gt;
|1||GND||PWR||common ground||style=&amp;quot;background:black; color:white&amp;quot;|Black&lt;br /&gt;
|-&lt;br /&gt;
|2|| +3V3||PWR||3.3V Rail from autopilot||style=&amp;quot;background:Red; color:white&amp;quot;|Red&lt;br /&gt;
|-&lt;br /&gt;
|3||SCL||I/O||SCL (3.3V level)||style=&amp;quot;background:green; color:white&amp;quot;|Green&lt;br /&gt;
|-&lt;br /&gt;
|4||SDA||I/O||SDA (3.3V level)||style=&amp;quot;background:blue; color:white&amp;quot;|Blue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOTE 1''': SERVO7 and SERVO8 are directly connected to I2C1_SCL and I2C1_SDA lines. Therefore one has to choose, either use SERVO7 and SERVO8 '''OR''' have the I2C1 bus available, if that one needs to be used for whatever reason alongside the I2C2 bus. To use the servos 7 and 8 just set the  &amp;lt;define name=&amp;quot;USE_SERVOS_7AND8&amp;quot;/&amp;gt;  in your airframe file and you are good to go. For this to work one must make sure to have the latest Paparazzi sourcecode.&lt;br /&gt;
&lt;br /&gt;
=== LEDs ===&lt;br /&gt;
Lisa/M 2.0 has 5 LEDS (+1 power LED). There are 3 additional LEDs (LED_6, LED_7, LED_8) that are not populated by default (in favor of using ADC1-3 on the ANALOG1 connector).&lt;br /&gt;
By default the LEDs are use for:&lt;br /&gt;
; LED_1, red: ''SYS_TIME_LED'': blinks with 1Hz&lt;br /&gt;
; LED_2, green : ''AHRS_ALIGNER_LED'': blinks until the AHRS is aligned (gyro bias initilalized) and then stays on&lt;br /&gt;
; LED_3, green : ''GPS_LED'': blinking if trying to get a fix, on if 3D fix&lt;br /&gt;
; LED_4, red : ''RADIO_CONTROL_LED'': on if RC signal is ok&lt;br /&gt;
; LED_5, green : not set to anything by default&lt;br /&gt;
&lt;br /&gt;
=== Jumper Configuration ===&lt;br /&gt;
There are a number of jumpers on Lisa/M used to configure voltage levels and power input.&lt;br /&gt;
&lt;br /&gt;
The default configuration is UART3 VCC at V_IN, UART1/2/5 VCC at +3V3, with the V_SERVO servo voltage rail NOT connected to the autopilot V_IN rail, allowing one to power the autopilot and servos separately. The +5V regulator is NOT bypassed, allowing a regulated +5V on listed headers and for the CAN transceiver and I2C level shifter. The V_BATT connector is NOT connected to V_IN, so one can attach a battery voltage to the V_BATT pin to measure the battery voltage, if so desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=380px heights=205px&amp;gt;&lt;br /&gt;
Image:LisaM_V2_0_top_jumpers_and_leds.png | Lisa/M v2.0 Top Jumpers and LEDs&lt;br /&gt;
Image:LisaM_V2_0_bottom_jumpers.png | Lisa/M v2.0 Bottom Jumpers&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''Power Jumper Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP1||SERVO_BUS to V_IN||OPEN||Connects servo header voltage rail SERVO_BUS to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP2||V_BATT to V_IN||OPEN||Connects I2C1/CAN rail V_BATT to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP3||V_IN to +5V||OPEN||Connects autopilot input voltage V_IN rail to autopilot +5V rail, bypassing onboard 5V supply&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART3 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP6||UART3_VCC to V_IN||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART3 connector VCC to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP7||UART3_VCC to +3V3||OPEN||Connects UART3 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: UART3 GPS Connector is connected to V_IN, check your GPS input voltage before connecting!!!'''&lt;br /&gt;
&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP6 AND JP7 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART2 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP4||UART2_VCC to V_IN||OPEN||Connects UART2 connector VCC to autopilot input voltage V_IN rail '''SEE WARNING BELOW'''&lt;br /&gt;
|-&lt;br /&gt;
|JP5||UART2_VCC to +3V3||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART2 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: UART2 RX is NOT 5V TOLERANT. Thus, while possible to connect UART2_VCC to V_IN, DO NOT ATTEMPT THIS. Only use JP5 (the default).&lt;br /&gt;
&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP4 AND JP5 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''UART1 and UART5 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP8||UART1&amp;amp;5_VCC to V_IN||OPEN||Connects UART1 and UART5 connector VCC to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP9||UART1&amp;amp;5_VCC to +3V3||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART1 and UART5 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP8 AND JP9 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
There are additional jumpers on the board for expert or developer configurations, please see [[Lisa/M_v20#Schematic|schematic]] and [[Lisa/M_v20#Downloads|layout]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Powering the Board ===&lt;br /&gt;
&lt;br /&gt;
[[Image:LisaM_warning_label.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
The 3.3V regulator on Lisa/M is a [http://www.micrel.com/page.do?page=/product-info/products/mic5209.shtml MIC5209-3.3YM] capable of delivering up to 500mA. While it is possible to power this regulator with up to 16V, '''DO NOT''' do this. By default, the UART3 RX pin is pulled up to the input voltage V_IN. For this reason, 5V is the maximum input voltage. Note that the UART3 GPS Connector is connected to V_IN, check your GPS input voltage before connecting. If one desires to have V_IN at a higher voltage, the jumpers should be adjusted accordingly. As noted, this regulator can handle up to 16V, though experience has shown that this regulator can become very hot in operation with high input voltages, resulting in potential thermal shutdown while in flight. Depending on the expected current draw, it is best to power this regulator with a lower voltage. 5V is the perfect choice. &lt;br /&gt;
&lt;br /&gt;
The onboard 5V regulator on Lisa/M is a [http://www.national.com/pf/LP/LP2992.html LP2992], a low-noise, low-dropout linear regulator capable of delivering up to 250mA. This regulator can be bypassed with JP3, connecting the autopilot V_IN bus directly to the autopilot 5V bus if, for example, one is using an external 5V regulated supply, and a higher current is needed. Unless external use of 5V is required on the ANALOG1 and ANALOG2 headers, the only 5V usage onboard is for the CAN transceiver and the I2C1 level shifter.&lt;br /&gt;
&lt;br /&gt;
When measuring the supply voltage of a battery with the V_BATT pin (could be connected to V_IN through JP2), it is important to note the maximum voltage limit. The voltage divider on the board for measuring with a 3.3V ADC is --'''V_BAT'''--/\/\'''10k'''/\/\--'''V_BAT_MEAS'''--/\/\'''2k2'''/\/\--'''GND'''--. This means that the maximum allowable voltage on V_BATT is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V\_BAT_{max} = 3.3V*\frac{10k}{2.2k} = 15V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a higher voltage measurement is desired, another voltage divider is required off-board. Alternatively, one could modify the existing voltage divider (e.g. change 10k resistor to 22k to get 33V maximum). When checking if voltage exceeds the maximum, make sure to consider maximum battery voltage, not nominal voltage (e.g. 4.22V or so for a single lithium cell, not 3.7V nominal, so the maximum number of cells in series is 3, like a 3S LiPo pack).&lt;br /&gt;
&lt;br /&gt;
== Schematic ==&lt;br /&gt;
&amp;lt;gallery widths=250px heights=168px&amp;gt;&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_1.png | LisaM V2.0 Schematic Sheet 1/3&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_2.png | LisaM V2.0 Schematic Sheet 2/3&lt;br /&gt;
Image:Lisa_m_v2_0_sheet_3.png | LisaM V2.0 Schematic Sheet 3/3&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples of Airborne Equipment Electrical Connections ==&lt;br /&gt;
&lt;br /&gt;
=== Quadrocopter, Spektrum Satellite Receivers and PWM Motor Controllers (ESC) ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_v2_0_wiring_quadrocopter_spektrum_pwmesc.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESCs have a battery eliminator circuit (BEC) function and provide 5 volts on their 5V pins. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
When using cheap ATMega or SiLabs-based PWM motor controllers consider replacing their firmware with either [https://github.com/sim-/tgy Simon Kirby] or [https://github.com/bitdump/BLHeli BLHeli] firmware respectively to get useful performance of your multicopter! You can find a firmware compatibility list [https://docs.google.com/spreadsheet/ccc?key=0AhR02IDNb7_MdEhfVjk3MkRHVzhKdjU1YzdBQkZZRlE here].&lt;br /&gt;
&lt;br /&gt;
=== Quadrocopter, Spektrum Satellite Receivers and I2C Motor Controllers (ESC) ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_quadrocopter_spektrum_i2c_esc_wiring.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This diagram &amp;quot;should&amp;quot; be the same for AscTec as well as Mikrokopter motor controller based airframes.&lt;br /&gt;
&lt;br /&gt;
=== Fixedwing, Spektrum Satellite Receivers and Elevons Only ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_fixedwing_spektrum_elevons.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESC has a BEC and provides 5 volts on its 5V pin. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
=== Fixedwing, Spektrum Satellite Receivers ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_fixedwing_spektrum.png|700px]]&lt;br /&gt;
&lt;br /&gt;
This configuration assumes the ESC has a BEC and provides 5 volts on its 5V pin. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
=== Transitioning [http://wiki.thequadshot.com Quadshot] Using Spektrum Receivers ===&lt;br /&gt;
&lt;br /&gt;
[[File:LisaM_V2_0_wiring_quadshot_spektrum.png|700px]]&lt;br /&gt;
&lt;br /&gt;
The ESCs have BECs and provide 5 volts on their 5V pins. Closing JP1 powers Lisa/M and the attached accessories.&lt;br /&gt;
&lt;br /&gt;
Still need: Large Fixed-wing with advanced power system and/or IC engine, PPM example&lt;br /&gt;
&lt;br /&gt;
== R/C Receivers ==&lt;br /&gt;
&lt;br /&gt;
One can use Spektrum DSM2 or compatible receivers as well as traditional PPM receivers.  It is even possible to connect two Spectrum or compatible satellite receivers for better redundancy or to improve RC signal reception. Connecting a RC receiver for flying your aircraft in manual mode during setup and test phase is 99% of the cases a must. Therefore the Paparazzi team made it easy to connect one.&lt;br /&gt;
&lt;br /&gt;
===  Using a Spectrum DSM receiver ===&lt;br /&gt;
&lt;br /&gt;
==== Physically connecting ====&lt;br /&gt;
&lt;br /&gt;
Wiring up a Spektrum or compatible satellite receiver is not to difficult to do. &lt;br /&gt;
It is very important to make absolutley sure the connectors are properly made. &lt;br /&gt;
Not being precise in this step can mean full RC loss and loss of airframe in the first tuning testflights. &lt;br /&gt;
&lt;br /&gt;
The spektrum satellite receiver should be connected to the UART1 connector on the autopilot board. Make sure the voltage on the AP board UART1 + pin is not to high, or to low for your receiver.&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
# Connect the minus(-) of the receiver to GND of UART1&lt;br /&gt;
# The receiver plus(+) to the UART1 Plus(+) &lt;br /&gt;
# Data out signal of the receiver to the RX pin on the UART1&lt;br /&gt;
&lt;br /&gt;
==== Binding ====&lt;br /&gt;
&lt;br /&gt;
To get a receiver and transmitter to work together you must perform a binding process. &lt;br /&gt;
&lt;br /&gt;
It is important to '''bind''' your Spectrum DSM receiver to your transmitter '''via''' your '''Lisa board''', not in any other way!&lt;br /&gt;
&lt;br /&gt;
The way to bind is by temporary connecting via fiddly small molex pins. &lt;br /&gt;
It is advised to make a small bind plug out of a molex connector for this purpose. &lt;br /&gt;
Before you start make sure you have your airframe configuration already uploaded either via USB or a JTAG cable.&lt;br /&gt;
&lt;br /&gt;
The bind procedure:&lt;br /&gt;
&lt;br /&gt;
# On the connector '''ANALOG1''' have a wire between the GND and ADC1 pin, located in the middle of the board&lt;br /&gt;
# Power up your autopilot board&lt;br /&gt;
# Hold the bind button on your '''transmitter''', while '''keeping it pressed''' switch on your transmitter&lt;br /&gt;
#:Wait...! All lights of the receiver blink and then go steady&lt;br /&gt;
# Let go of your transmitter bind button&lt;br /&gt;
# Power off your Lisa Board&lt;br /&gt;
# Remove the wire connecting the GND and ADC1 pins on the ANALOG1 connector&lt;br /&gt;
# Repower your board, if you have servos connected and wiggle the RC transmitter sticks some servos should move&lt;br /&gt;
&lt;br /&gt;
That is all, you are done. &lt;br /&gt;
The bind procedure only needs to be done '''once''' for your receiver.&lt;br /&gt;
&lt;br /&gt;
===  Using a PPM receiver ===&lt;br /&gt;
&lt;br /&gt;
Using a PPM receiver, a so called '''PPM sum stream''' input is possible. [[RC_Receivers_and_Radios#PPM_Based_Systems | To make it work, you need a PPM sum stream out capable receiver. Find out more following this link]]  &lt;br /&gt;
&lt;br /&gt;
==== Connecting ====&lt;br /&gt;
&lt;br /&gt;
Connect the PPM out signal to the RX pin of UART1.&lt;br /&gt;
&lt;br /&gt;
Make sure put this in your airframe file in your AP target section.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;radio_control&amp;quot; type=&amp;quot;ppm&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;RADIO_CONTROL_PPM_PIN&amp;quot; value=&amp;quot;UART1_RX&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Alternative =====&lt;br /&gt;
&lt;br /&gt;
However if in the case you want to use the UART1 port for something else, there is an option to connect the receiver to a servo pin. Yes, that's right, a servo connector is used for receiving a PPM stream '''input'''.  If you want to walk that path, the default pin number to capture the PPM sum stream is via servo connector SERVO6&lt;br /&gt;
&lt;br /&gt;
If you connect the PPM ou capable receiver that way make sure to put this in your airframe file in your AP target section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;radio_control&amp;quot; type=&amp;quot;ppm&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;RADIO_CONTROL_PPM_PIN&amp;quot; value=&amp;quot;SERVO6&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/subsystem&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do not have or cannot modify a receiver to a ''PPM out'' able receiver, a [[PPM_Encoder | PPM encoder board]] can be used to avoid opening your receiver for PPM out modification.&lt;br /&gt;
&lt;br /&gt;
== Extras ==&lt;br /&gt;
&lt;br /&gt;
=== UART I/O ===&lt;br /&gt;
&lt;br /&gt;
UART pins can also be used as general purpose I/O, this might come in handy in case all other inputs or your AP board are in use.&lt;br /&gt;
&lt;br /&gt;
===  USB as UART1TX + hardware flow control===&lt;br /&gt;
&lt;br /&gt;
[[File:Lisam-usb-uart1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The USB_VBUS on the Lisa/M 2.0 can be used as UART1 TX. To do this, a diode has to be removed. Make sure to include a series resistor of 100-3000 Ohm to protect the microcontroller from overcurrents. The 2nd and 3th pin of the USB pads are CTS and RTS respactively. It is recommended to include a series resistor in the RTS line, as this is an outgoing line. &lt;br /&gt;
&lt;br /&gt;
If you want to enable flow control in the software, but don't want to use flow control when no cable is connected to the CTS/RTS, a pulldown resistor of 10 kOhm has to be added between the CTS and the GND. If you do this, take care when connecting UART devices that have a large series resistor in their RTS line. The combination of the pulldown resistor and the series resistor might cause the high-level voltage to drop under the high-level treshold of the microcontroller, causing strange behaviour.&lt;br /&gt;
&lt;br /&gt;
For Example the RTS , mostly a purple wire, is the '''pin 10''' on the Xtend module when set in the module with Hardware flow control (use X-CTU)&lt;br /&gt;
CTS, most blue, on pin 9 of the Xtend&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery widths=380px heights=205px&amp;gt;&lt;br /&gt;
Image:Lisam-diode.JPG | Remove this diode. After removing this diode you can not power the board via USB anymore.&lt;br /&gt;
Image:Lisam-gpio-usb.JPG | Take care of the small distance between the GPIO pins and the USB pads.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== PCB ==&lt;br /&gt;
&lt;br /&gt;
=== Gerber &amp;amp; Drill Files  ===&lt;br /&gt;
&lt;br /&gt;
'''''Download  Lisa/M v2.0 gerber &amp;amp; drill files (zip)''''' ''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
== Assembly ==&lt;br /&gt;
&lt;br /&gt;
To create and assemble a board oneself is possible. It takes some skills however. &lt;br /&gt;
&lt;br /&gt;
For the Lisa/m v2.0 without the Aspirin sensor board a good soldering iron is enough.(smallest components are 0402) For the Aspirin Sensor board you need a hot air soldering station.&lt;br /&gt;
&lt;br /&gt;
In case you wan to follow that path you need the desing. You came to the right place here is the info to get the needed files;&lt;br /&gt;
&lt;br /&gt;
===Components Layout===&lt;br /&gt;
&lt;br /&gt;
''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
Need some top and bottom of board images and line drawings here.&lt;br /&gt;
&lt;br /&gt;
=== Bill Of Material ===&lt;br /&gt;
&lt;br /&gt;
'''''Download  Lisa/M v2.0 Bill Of Material (zipped .xls file)''''' ''[[Lisa/M_v2.0#Get the design|Get the design]]''&lt;br /&gt;
&lt;br /&gt;
Open .sch File in Eagle, execute UPL --&amp;gt; bom.ulp , save as .txt&lt;br /&gt;
&lt;br /&gt;
== PCB and assembled boards suppliers ==&lt;br /&gt;
&lt;br /&gt;
To difficult to creat your own AP board, understandable, thus pre made board available via [[Get_Hardware|Get Hardware]] page... hopefully :)&lt;br /&gt;
&lt;br /&gt;
== Mechanical Dimensions ==&lt;br /&gt;
&lt;br /&gt;
[[Image:LisaM_V2_0_top_mechanical.png|500px|Lisa/M v2.0 Mechanical Dimensions]]&lt;br /&gt;
&lt;br /&gt;
The overall height of the board including the servo connectors is 10mm. Note that the overall length includes the USB connector. The mounting holes are nominal 2mm diameter (with a bit of clearance).&lt;br /&gt;
&lt;br /&gt;
== Get the design ==&lt;br /&gt;
&lt;br /&gt;
'''Source files'''&lt;br /&gt;
:*download available on GitHub: ''[https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lisa_m/v2.0 Lisa/M v2.0 Cadsoft Eagle 6 Design]''&lt;br /&gt;
'''Gerber &amp;amp; Drill files'''&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need generated gerbers and drill files&lt;br /&gt;
'''Assembly files'''&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need Lisa/M v2.0 Components layouts (pdf)&lt;br /&gt;
:*download ''NOT YET AVAILABLE'' Need Lisa/M v2.0 Bill Of Material&lt;br /&gt;
&lt;br /&gt;
== Uploading new software ==&lt;br /&gt;
New onboard software for the Lisa/M v2.0 can uploaded by connecting your PC via a micro-USB port to the autopilot board. For this the board need to contain the [[Luftboot]] bootloader. All Lisa/M 2.0 from Transition Robotics Inc. come with luftboot already in the board.&lt;br /&gt;
&lt;br /&gt;
An alternative to get your firmware in the board is by using a JTAG connector connected via the 10-pin Samtec connector that is available on the board.&lt;br /&gt;
&lt;br /&gt;
See the [[FirmwareFlashing]] page for an overview of different methods to upload new software to your autopilot.&lt;br /&gt;
&lt;br /&gt;
=== Using luftboot ===&lt;br /&gt;
'''This is the default FLASH_MODE for Lisa/M v2.0''', it could be explicitly selected by adding&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;DFU&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
to the firmware section of your airframe file. Make sure to set Lisa/M 2.0 as it's target board.&lt;br /&gt;
&lt;br /&gt;
Once USB is plugged in, the board automatically goes to bootloader mode and the status LEDs cycle up and down:&lt;br /&gt;
&lt;br /&gt;
[[File:Luftboot.gif|320px]]&lt;br /&gt;
&lt;br /&gt;
If you have trouble entering the bootloader mode or want to upload/update the bootloader itself, see the [[Luftboot]] page.&lt;br /&gt;
&lt;br /&gt;
=== Using JTAG ===&lt;br /&gt;
You still can use a [[JTAG|JTAG adapter]] for [[FirmwareFlashing#JTAG|flashing]] and [[DevGuide/JTAG-Debug|debugging]] your paparazzi firmware. To use [[FirmwareFlashing#JTAG|JTAG flashing]] configure the ''FLASH_MODE'' in your firmware section:&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;JTAG&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
Using JTAG will not overwrite the bootloader by default. To overwrite the luftboot bootloader configure&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;NO_LUFTBOOT&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then press upload as normal...&lt;br /&gt;
&lt;br /&gt;
=== Serial Firmware Upload ===&lt;br /&gt;
Firmware upload using the factory integrated bootloader can be useful e.g. if you have overwritten [[Luftboot]] accidentally and don´t have access to [[JTAG]].&amp;lt;br/&amp;gt;&lt;br /&gt;
Either set the flash mode in the target section of the airframe configuration:&lt;br /&gt;
:&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;configure name=&amp;quot;FLASH_MODE&amp;quot; value=&amp;quot;SERIAL&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
or add it to the commandline invocation:&lt;br /&gt;
 make AIRCRAFT=&amp;lt;aircraftname&amp;gt; ap.upload FLASH_MODE=SERIAL&lt;br /&gt;
&lt;br /&gt;
Due to hardware constraints, the board has to be modified to make use of the bootloader, which is only accessible on UART1:&lt;br /&gt;
# Diode D3 has to be removed (the bigger black brick next to the USB connector). Attention, no more powering via USB after that.&lt;br /&gt;
# BOOT1 has to be set to GND by connecting ACC_DRDY(unused) to GND at the Aspirin pads&lt;br /&gt;
&lt;br /&gt;
Now a boot sequence works as follows:&lt;br /&gt;
#BOOT1 has to be set to 3.3V by use of a jumper cable&lt;br /&gt;
#Connect a 3,3V serial cable (FTDI, MAX232...) to UART1, the TX pin is USB_VBUS&lt;br /&gt;
#Power the board and activate the bootloader program&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Prevent board from going into bootloader mode ===&lt;br /&gt;
&lt;br /&gt;
Normally, if you power up the board with the USB cable connected it will automatically go into bootloader mode, even if the USB cable is not connected to the PC. If you want the board to power up normally with the cable connected you can ground the ADC2 in the ANALOG1 connector.&lt;br /&gt;
&lt;br /&gt;
== Detailed Hardware Revision History ==&lt;br /&gt;
&lt;br /&gt;
=== Changes Between LISA v1.1 and v2.0 ===&lt;br /&gt;
&lt;br /&gt;
* Lots of silkscreen improvements&lt;br /&gt;
* Added attributes to all parts to make the usage of bom-ex ulp possible.&lt;br /&gt;
* Improved routing to allow teardropping&lt;br /&gt;
* Fixed stm32f1, f2 and f4 compatibility circuit. (has to jump to ground not to 3v3)&lt;br /&gt;
* Connected existing UART RX pullups to the respective connector power pins instead of 3v3. To prevent connecting 5V over IO pin to the 3v3 power rail.&lt;br /&gt;
* Added pullups on all UART RX lines to prevent undesired floatation.&lt;br /&gt;
* LED's are connected to 3v3 now. To make sure we don't have an issue with voltage tolerance on the gpio pins.&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
== Hardware Change Requests ==&lt;br /&gt;
&lt;br /&gt;
If you have a Lisa/M 2.0 and in the process of using it you come up with something you find annoying, dangerous, or restricting, add your hardware update requests here. Better still, modify the Lisa schematics yourself and show your new improvements if you are skilled enough to do this.&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace BMP085 with MS5611 (the MS5611 seems to be better in performance then the BMP but it is more expensive and seems to be more difficult to obtain. &lt;br /&gt;
** A: Using a MS5611 is possible through using a Aspirin v2.1 board&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace 7 Pin CAN with molex with something less risky to be inserted in 7 Pin SPI in relation to powering the board via CAN molex.&lt;br /&gt;
&lt;br /&gt;
* REQ: Separate spot for external power if powered via separate battery. Realizing we can via Servo ports by Bridge J1 but still like to measure board voltage then and have a way to add power without mistakenly insert I2CCAN Molex conector into SPI Molex on board connector. Thus a separate CAN and Power plug. Power on regular four pin molex with GND, V+5, , V_BATT, V_I (Current sense). Option to have thicker wire to be soldered to the board, for power hungry setups and other issues connectors for power are not a good idea.&lt;br /&gt;
&lt;br /&gt;
* REQ: Replace Aspirin IMU board with InvenSense MPU-9150 and bring the MS5611 back onto the Lisa/M board to reduce footprint, mass, and manufacturing cost once the 9150 becomes readily available(if at al with SPI) and is tested to perform well.&lt;br /&gt;
[[Category:Lisa]] [[Category:User_Documentation]] [[Category:Autopilots]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Tuning&amp;diff=15951</id>
		<title>Tuning</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Tuning&amp;diff=15951"/>
		<updated>2013-09-22T17:12:20Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Sample/Simple Altitude and Throttle Loop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
This page provides guidelines for tuning a new aircraft and additional practical tips. Be sure to familiarize yourself with the theory of [[Theory_of_Operation#PID|PID Controllers]] before you begin tuning your airframe. Use of the [[RTPlotter|real time plotter]] may help to visualize and understand the behavior of the control loops. Review [http://paparazzi.enac.fr/w/images/Users_manual.pdf User Manual] as well. Also reading [http://www.av8n.com/how/ See How It Flies, by John S. Denker] is very beneficial to get your airframe tuned well.&lt;br /&gt;
&lt;br /&gt;
==Energy Control==&lt;br /&gt;
&lt;br /&gt;
If you came to this page and want to learn about how to perform your [[Tuning_energy_control_loops | Energy control tuning]], this is '''not''' the page to read, go to [[Tuning_energy_control_loops | tuning energy control loops]].&lt;br /&gt;
&lt;br /&gt;
==Quickstart==&lt;br /&gt;
&lt;br /&gt;
'''Here is the sub-minimal ultra-quick-start guide: note that point 1 and 3 should ALWAYS be performed every time you reflash your plane!!!'''&lt;br /&gt;
&lt;br /&gt;
# Before take-off [[Tuning#Directions|check]] (beware: do not skip a test as it is not because 2 are good that the third will also be good)&lt;br /&gt;
## RC-left is aileron-left and up is up in MANUAL.&lt;br /&gt;
## RC-left is aileron-left and up is up in AUTO1.&lt;br /&gt;
## [[Tuning#Directions|turning the plane-left is aileron-right]] and nose-up is elevator-down with RC in neutral in AUTO1. (to check the [[GCS#PFD|Artificial horizon]] in the [[GCS|GCS]]: use the words: right wing sees the ground to not mess up left and right if uncertain.)&lt;br /&gt;
# Fly manual&lt;br /&gt;
## [[Tuning#Neutrals|trim your plane]]&lt;br /&gt;
## check [[Fixedwing_Configuration#Servos|servo deflections]] are good (sufficient but not aerobatic)&lt;br /&gt;
## remember the cruise throttle. (and max/min throttle if you will use aggressive-climb)&lt;br /&gt;
# On the ground, after trimming: &lt;br /&gt;
## Check with plane flat/cruise attitude on the ground that the ailerons/elevator do not move when you switch from MANUAL to AUTO1. This checks your IMU/Thermopiles are properly aligned and that [[Tuning#Trim|your trim values are in the airframe file and not the RC-transmitter]] &lt;br /&gt;
# Test [[Tuning#Auto_1|try AUTO1]]&lt;br /&gt;
## When entering AUTO1, make sure you try to turn before your plane is too far away since [[Fixedwing_Configuration#Auto1|AUTO1 circles are usually much larger than manual circles]].&lt;br /&gt;
## Make a [[RTPlotter|graph]] on the groundstation of DESIRED-&amp;gt;phi/theta and ATTITUDE-phi/theta to see if they match. &lt;br /&gt;
## When flying with IMU pay special attention here if after several left turns the plane still turns right too. Plot the IMU_ACC-&amp;gt;ax,ay,az to see the average vibration in your plane. If the vibration level is lower than half of gravity (5m/s2) than usually you are OK. If it is much more, you should dampen your IMU more. (in foam, or mounted on your heavy battery, ...)&lt;br /&gt;
# Only when AUTO1 works fine you can [[Tuning#Auto_1|go to AUTO2]]&lt;br /&gt;
## check that your Throttle is not Killed (RED) in the groundstation&lt;br /&gt;
## check that your cruise throttle is correct if you have a powerful motor &lt;br /&gt;
## if tuning the altitude loop seems difficult try the [[Tuning#Sample.2FSimple_Altitude_and_Throttle_Loop|simple 3 gain auto_throttle_loop]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sensors ==&lt;br /&gt;
&lt;br /&gt;
=== Neutrals ===&lt;br /&gt;
* Put the aircraft in a styrofoam container or completely seal the IR sensors with styrofoam or similar blocks and get a reading of the neutrals for each axis.  Also take the gyro neutrals at this time.  Update your airframe file, flash the AP and re-check the neutrals.&lt;br /&gt;
&lt;br /&gt;
Using the roll gyro as a worked example: Run up your GCS and ensure it &lt;br /&gt;
is communicating with your airframe. Make sure your airframe is roughly &lt;br /&gt;
level and that it cannot move. Now run the Messages Tool and the [[RTPlotter|real time plotter]] tool. The messages tool will have lots of flashing lights &lt;br /&gt;
indicating when it receives various telemetry packets.  In the Messages &lt;br /&gt;
tool, Click on Gyro Rates and you should see a list of variables.  Click &lt;br /&gt;
on Roll_ADC and drag and drop in onto the main window of the Real Time plotter.  Now give it a while to build a stable graph.&lt;br /&gt;
&lt;br /&gt;
Once things have been running this way for a while, in the Real Time &lt;br /&gt;
Plotter, click on Curves in the menu and select the &lt;br /&gt;
1:telemetry:GYRO_RATES:Roll_ADC entry.  As you select it, you should see &lt;br /&gt;
the average and standard deviation values.  We need the average value.  &lt;br /&gt;
Jot down the number you have.  I have -24.536.&lt;br /&gt;
&lt;br /&gt;
Now go edit your airframe file and look for the ADC_ROLL_NEUTRAL value. &lt;br /&gt;
In my airframe file the value is 520.  As my average value from the Plotter is a &lt;br /&gt;
negative figure, it indicates that the roll Neutral is too high, subtract the average value from the present setting. So I edited my airframe file to be 495.464 (520-24.536).&lt;br /&gt;
&lt;br /&gt;
Recompile and reflash (Don't worry about restarting the GCS, The &lt;br /&gt;
messages program or the other running processes - they will catch up just &lt;br /&gt;
fine after flashing).  Once the Board is back up and the plotter continues, reset it from the menu to get rid of the average. Watch it for a while and check that the line and acculmulated average is on or around 0. You are done.  Use the same process for the IR sensors!&lt;br /&gt;
&lt;br /&gt;
=== Directions ===&lt;br /&gt;
* Reverse any servos and make sure no mechanical binding occurs at the limits of travel in Manual mode.&lt;br /&gt;
* Take the plane outside and engage AUTO1.  Bank and pitch the plane and verify that the controls respond in the correct direction AND that the PFD in the notebook responds correctly.  Note that your body will have a tremendous impact on the measured angles if using IR sensors. If using an IMU, there is no need to be outside. See note.&lt;br /&gt;
* Verify that AUTO1 stick movements respond in the correct direction - important! See note.&lt;br /&gt;
* Move the plane rapidly to ensure the gyro response resists motion - increase the gain if needed for better visualization.&lt;br /&gt;
NOTE: If the PFD responds in the wrong direction to the motion, you should adjust parameters in the INFRARED or IMU parts of the airframe file. If the control surfaces respond in the wrong direction to counteract motion (stabilize the aircraft, bring it back to neutral), reverse the servos in the airframe file. If the manual input from R/C causes the control surfaces to respond in the wrong direction (want them to force motion, not counteract motion), then you must reverse the channel on the R/C transmitter. Be sure to recheck surface neutrals and endpoints after doing such modifications. Also double check the gain signs, make sure none are positive that should be negative.&lt;br /&gt;
&lt;br /&gt;
== R/C, Modem, and GPS ==&lt;br /&gt;
* Make sure the GPS signal is strong (outdoors) - you should have a 3-D fix in less than 1 minute and at least some satellite signals above 40dB. The plane should not drift on the map by more than 10 meters.&lt;br /&gt;
* Perform a range test of R/C and modem signals.&lt;br /&gt;
* Ensure that two way communications are in place. Check that the motor starts up when launch is commanded or move a waypoint and check that it's updated in the autopilot.&lt;br /&gt;
&lt;br /&gt;
== Trim ==&lt;br /&gt;
&amp;lt;b&amp;gt;Important: You must never keep any trim, mixers, or rates in your R/C transmitter.&amp;lt;/b&amp;gt;  R/C trim can be applied in flight but must be corrected and removed on the ground before attempting autonomous flight.  Exponential can be useful and will not adversely affect AUTO1 flight but if &amp;quot;low rates&amp;quot; are needed they should be programmed on the same transmitter switch with AUTO1 so that you always have full travel in AUTO1.&lt;br /&gt;
* Fly the plane at what you feel is a suitable &amp;quot;cruise&amp;quot; throttle setting and set the trims.  Note that setting in the GCS and try to return to that exact setting in subsequent tests.  Enter that throttle setting in your airframe file.&lt;br /&gt;
* Check maximum pitch and roll response and adjust the mixer parameters or mechanical linkages after landing.&lt;br /&gt;
* Land and adjust the linkages.  If necessary, the PPM values can be read from the GCS and servo neutrals adjusted electronically, but manual adjustment will produce far better results.&lt;br /&gt;
* Fly again to verify trim and control response.  If satisfactory, check for any significant throttle-dependent roll.  Again, this is best to correct mechanically but can be addressed with the ''AILERON_OF_THROTTLE'' mixer in the autopilot.  Check also for any odd behavior at full throttle.&lt;br /&gt;
* Make sure that GPS and modem data is reliable during these test flights. Note particularly any tendency for the aircraft to appear to fly sideways on the map - this is an indication of weak GPS signals.&lt;br /&gt;
&lt;br /&gt;
== Auto 1 ==&lt;br /&gt;
* Engage Auto1 and ''immediately'' make sure you can turn both left and right!&lt;br /&gt;
* Fly at your &amp;quot;cruise&amp;quot; throttle and adjust the ''ROLL_PGAIN'' until the plane doesn't quite oscillate&lt;br /&gt;
* Adjust the IR roll neutral as needed&lt;br /&gt;
* Verify adequate pitch response and adjust PITCH_PGAIN as needed&lt;br /&gt;
* Experiment with different throttle settings and tune P and D gains as needed&lt;br /&gt;
&lt;br /&gt;
If you are alone in the field while tuning, setting values via your RC transmitter may come in handy, see [[Telemetry#R.2FC_Transmitter_Data_Uplink|RC reveiver data uplink]]&lt;br /&gt;
&lt;br /&gt;
== Auto 2 ==&lt;br /&gt;
* Engage Auto2 and you're done! Make sure you keep a finger on the Mode switch to take over just in case.&lt;br /&gt;
&lt;br /&gt;
==Alternate Tuning Procedure==&lt;br /&gt;
Danstah wrote up a tuning procedure on this website http://www.engr.usu.edu/wiki/index.php/OSAMtuning&lt;br /&gt;
&lt;br /&gt;
==Sample/Simple Altitude and Throttle Loop==&lt;br /&gt;
&lt;br /&gt;
The dash button changes the NOMINAL_CRUISE_THROTTLE to the MAX_CRUISE_THROTTLE while the loiter button changes it to MIN_CRUISE_THROTTLE. &lt;br /&gt;
&lt;br /&gt;
This makes it easy to suddenly make the UAV fly a bit slower or a bit faster. However, when changing the throttle, you also need to change the elevator trim in order not to climb/descend too much. This it what AUTO_THROTTLE_LOITER_TRIM and AUTO_THROTTLE_DASH_TRIM are for. (I think the unit is MAX_PPRZ = 9600 = full deflection?) &lt;br /&gt;
&lt;br /&gt;
The auto-throttle loop is actually the most difficult loop to tune as it has both the speed and altitude that are correlated. Controlling both speed and altitude with high performance is very hard. It is way easier to control 1 entity (e.g. altitude) with higher performance and let the speed change a bit, or have an airspeed controller but then do the altitude slowly... &lt;br /&gt;
&lt;br /&gt;
Sample altitude controller:&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
Step1: outerloop: if altitude is not good -&amp;gt; compute a climb/descend rate. (including ALTITUDE_MAX_CLIMB)&lt;br /&gt;
&lt;br /&gt;
  climb_command = altitude_error x alt_pgain&lt;br /&gt;
&lt;br /&gt;
e.g. 10 m too low x 0.1 alt gain = climb_command at 1 m/s&lt;br /&gt;
e.g. 50 m too low x 0.1 alt gain = climb at 5 m/s &amp;gt; ALTITUDE_MAX_CLIMB(2) -&amp;gt; climb_command = 2m/s&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
Step2: innerloop: [many many options here, but since you ask for simple I'll only give one robust and simple:]&lt;br /&gt;
&lt;br /&gt;
too low -&amp;gt; pitch up and extra throttle (if you only apply throttle, airspeed will increase and might even start to dive with full throttle if the nose is a bit heavy, if you only apply pitch airspeed will decrease and could lead to stall, with proper tuning you can get a pretty constant speed even while climbing and descending) &lt;br /&gt;
&lt;br /&gt;
  pitch_command = climb_command x pitch_of_vz&lt;br /&gt;
  throttle_command = nominal_cruise_trim_throttle + climb_command x throttle_climb_increment&lt;br /&gt;
&lt;br /&gt;
e.g. climb_command at 1 m/s x pitch_of_vz 0.15 = 0.15 radians pitch = 9 degrees pitch up&lt;br /&gt;
&lt;br /&gt;
e.g. climb_command at 1 m/s x throttle_climb_increment 0.25 with nominal_cruise_trim_throttle 0.5 = 75% throttle&lt;br /&gt;
&lt;br /&gt;
-------------------&lt;br /&gt;
&lt;br /&gt;
If you use AGRESSIVE_CLIMB then if the altitude error is larger than the chosen threshold a precomputed pitch and throttle will be applied. &lt;br /&gt;
&lt;br /&gt;
AUTO_PITCH is for constant throttle and control height with elevator only&lt;br /&gt;
&lt;br /&gt;
auto_throttle_p/i/d_gains are to regulate the climb rate more precisely&lt;br /&gt;
&lt;br /&gt;
==Other Misc things before flying==&lt;br /&gt;
&lt;br /&gt;
It's very important to address the issue of low voltage cut-off before flying (LVC). There's a good chance that the LVC will kick in on the brushless ESC before the Paparazzi detects it. If this happens, the ESC cut's off throttle, and there's no way the autopilot knows this, the plane keeps loosing altitude, the autopilot tries to increase throttle, but the ESC does not respond, almost always leading to a mishap. To avoid this, either turn off the LVC on the ESC, OR, make sure the autopilot kills throttle first, by programming the CATASTROPHIC_BAT_LEVEL to something higher than the ESC LVC. For example, set CATASTROPHIC_BAT_LEVEL to 9.5V, and the ESC LVC at 9V. Don't ask how we know, it was a safe landing into a small tree :) No damage. BUT you cant get lucky always!&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Radio_Control&amp;diff=15880</id>
		<title>Radio Control</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Radio_Control&amp;diff=15880"/>
		<updated>2013-09-10T03:47:23Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Radio */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PPM Radio Configuration ==&lt;br /&gt;
&lt;br /&gt;
This XML file, usually located in the &amp;lt;tt&amp;gt;conf/radios&amp;lt;/tt&amp;gt; directory, contains a description of the radio control transmitter PPM signal. It should follow the grammar described in &amp;lt;tt&amp;gt;radio.dtd&amp;lt;/tt&amp;gt;. &amp;lt;b&amp;gt;This is only used for PPM transmitters so it does not apply to DSM/DSM2/FASST/FHSS or other 2.4Mhz radios.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The contents are an '''ordered''' sequence of elements describing each channel with its name and its range:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE radio SYSTEM &amp;quot;radio.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;radio name=&amp;quot;cockpitMM&amp;quot; data_min=&amp;quot;900&amp;quot; data_max=&amp;quot;2100&amp;quot; sync_min =&amp;quot;5000&amp;quot; sync_max =&amp;quot;15000&amp;quot; pulse_type=&amp;quot;POSITIVE&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;D&amp;quot; function=&amp;quot;ROLL&amp;quot;     min=&amp;quot;2000&amp;quot; neutral=&amp;quot;1498&amp;quot; max=&amp;quot;1000&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;E&amp;quot; function=&amp;quot;MODE&amp;quot;     min=&amp;quot;2000&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1000&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;/radio&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The order of the channels must be the order of the pulses in the PPM signal.&lt;br /&gt;
&lt;br /&gt;
Among the top attributes, we find&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt;: used only in debug traces.&lt;br /&gt;
* &amp;lt;tt&amp;gt;data_min&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;_max&amp;lt;/tt&amp;gt;): the minimum (resp. max) width (in microseconds) used to code one channel of the PPM signal.&lt;br /&gt;
* &amp;lt;tt&amp;gt;sync_min&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;_max&amp;lt;/tt&amp;gt;): the minimum (resp. max) width (in microseconds) between two impulses set of the PPM signal.&lt;br /&gt;
* &amp;lt;tt&amp;gt;pulse_type&amp;lt;/tt&amp;gt;: the polarity of the PPM pulse. Can be either &amp;lt;tt&amp;gt;POSITIVE&amp;lt;/tt&amp;gt; (FUTABA, Hitec, Multiplex etc) or &amp;lt;tt&amp;gt;NEGATIVE&amp;lt;/tt&amp;gt; (JR, Graupner etc.).&amp;lt;br/&amp;gt;With &amp;lt;tt&amp;gt;POSITIVE&amp;lt;/tt&amp;gt; it will trigger on the rising flank to measure the time of the positive pulse, with &amp;lt;tt&amp;gt;NEGATIVE&amp;lt;/tt&amp;gt; on the falling flank (for a negative pulse width).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each channel is described with its transmitter name (&amp;lt;tt&amp;gt;ctl&amp;lt;/tt&amp;gt;), its &amp;lt;tt&amp;gt;function&amp;lt;/tt&amp;gt; name, its range in microseconds and its neutral value in microseconds.&lt;br /&gt;
These values are used by the autopilot to compute a normalized input from the PPM signal (this file is preprocessed and the produced code is included in the airborne code). Note that the &amp;lt;tt&amp;gt;min&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attributes can be exchanged to reverse the direction of the command.&lt;br /&gt;
&lt;br /&gt;
'''Wrong attributes of the &amp;quot;radio&amp;quot; element will prevent the decoder to recognize any PPM frame; same for a wrong number or channels.'''&lt;br /&gt;
&lt;br /&gt;
=== Number of channels ===&lt;br /&gt;
&lt;br /&gt;
Note that the number of channels in your radio file &amp;lt;b&amp;gt;must exactly match&amp;lt;/b&amp;gt; the number of channels in the ppm sum signal the autopilot receives.&amp;lt;br&amp;gt;&lt;br /&gt;
Also the ''function'' names must be unique.&lt;br /&gt;
&lt;br /&gt;
* in case of analog 35MHz receivers it is the RC - TRANSMITTER that makes the pulse train (receiver only does RF part) &lt;br /&gt;
** radio file depends on transmitter, you could swap to another receiver (and e.g. you can use a 4channel receiver to receive 9 pulses :-) )&lt;br /&gt;
* in case of digital receivers it is not the transmitter but the receiver that makes the pulses&lt;br /&gt;
** e.g. Futaba Fasst 6017: you can use any compatible transmitter without need to change the radio file&lt;br /&gt;
* in case of an encoder it is the encoder that makes the summed pulse&lt;br /&gt;
** if the encoder software makes 8 pulses, even with a 5 channel RC connected paparazzi will get 8: so the radio file should read 8&lt;br /&gt;
&lt;br /&gt;
This means if your transmitter sends for example a PPM18 (Graupner/JR) signal you have nine (9) different servo channels. Even if you use a receiver with less channels you must set up &amp;lt;b&amp;gt;all&amp;lt;/b&amp;gt; transmitting servos, even if you do not use them then you must use &amp;quot;bogus switches&amp;quot; related to functions. For example a six (6) servo channels out receiver with five (5) functions used in combination with a nine (9) servo channels transmitter would need four (4) bogus entries. (5 + 4 = 9)&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneA&amp;quot;	              function=&amp;quot;NOTUSEDA&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneB&amp;quot;	              function=&amp;quot;NOTUSEDB&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneC	              function=&amp;quot;NOTUSEDC&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneD&amp;quot;	              function=&amp;quot;NOTUSEDD&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
=== Averaging ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;average&amp;lt;/tt&amp;gt; attribute must be set to '''1..x''' for ''discrete'' channels for which a trivial averaging filter will be applied. The neutral of a discrete channel need to be halfway through the min and max values. Otherwise it won't be mapped properly by the filter. Note that averaging a channel gives the output an additional small delay.&lt;br /&gt;
&lt;br /&gt;
== Direction ==&lt;br /&gt;
&lt;br /&gt;
The following signs have been used in the radio configuration files distributed in &amp;lt;tt&amp;gt;conf/radios&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* '''ROLL''': The &amp;lt;tt&amp;gt;min&amp;lt;/tt&amp;gt; attribute value stands for the right position of the stick (turning right)&lt;br /&gt;
* '''PITCH''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the up position of the stick (pitching up)&lt;br /&gt;
&lt;br /&gt;
''' From &amp;quot;v3.9&amp;quot; on this has been changed to follow standard aerospace conventions:'''&lt;br /&gt;
* '''ROLL''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the right position of the roll stick (banking right)&lt;br /&gt;
* '''PITCH''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the &amp;quot;up&amp;quot; position of the pitch stick pulled towards you (pitching up)&lt;br /&gt;
* '''YAW''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the right position of the yaw stick (yawing clock-wise)&lt;br /&gt;
&lt;br /&gt;
=== Practical test ===&lt;br /&gt;
In the RC message:&lt;br /&gt;
* when the ROLL stick is pulled to the right (aircraft banks right), you should see a value close to -MAX_PPRZ (-9600) in the ROLL channel&lt;br /&gt;
* When the PITCH stick is pulled (aircraft pitches up), you should see a value close to MAX_PPRZ (9600) in the PITCH channel&lt;br /&gt;
&lt;br /&gt;
''' From &amp;quot;v3.9&amp;quot; on this has been changed to follow standard aerospace conventions:'''&lt;br /&gt;
* when the ROLL stick is pulled to the right (aircraft banks right), you should see a value close to MAX_PPRZ (9600) in the ROLL channel&lt;br /&gt;
* When the PITCH stick is pulled (aircraft pitches up), you should see a value close to MAX_PPRZ (9600) in the PITCH channel&lt;br /&gt;
* When the YAW stick is pulled to the right (aircraft yawing clock-wise), you should see a value close to MAX_PPRZ (9600) in the YAW channel&lt;br /&gt;
&lt;br /&gt;
This works with all kind of radios (PPM, USB, 2.4GHz)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Below an example of an radio file.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
-- Attributes of root (Radio) tag :&lt;br /&gt;
-- name: name of RC&lt;br /&gt;
-- min: min width of a pulse to be considered as a data pulse&lt;br /&gt;
-- max: max width of a pulse to be considered as a data pulse&lt;br /&gt;
-- sync: min width of a pulse to be considered as a synchro pulse&lt;br /&gt;
-- min, max and sync are expressed in micro-seconds&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
-- Attributes of channel tag :&lt;br /&gt;
-- ctl: name of the command on the transmitter - only for displaying&lt;br /&gt;
-- function: logical command&lt;br /&gt;
-- average: (boolean) channel filtered through several frames (for discrete commands)&lt;br /&gt;
-- min: minimum pulse length (micro-seconds)&lt;br /&gt;
-- max: maximum pulse length (micro-seconds)&lt;br /&gt;
-- neutral: neutral pulse length (micro-seconds)&lt;br /&gt;
Note: a command may be reversed by exchanging min and max values&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;radio name=&amp;quot;GraupnerMC20&amp;quot; data_min=&amp;quot;950&amp;quot; data_max=&amp;quot;2150&amp;quot; sync_min=&amp;quot;5000&amp;quot; sync_max=&amp;quot;15000&amp;quot; pulse_type=&amp;quot;NEGATIVE&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;A&amp;quot; function=&amp;quot;THROTTLE&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1100&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt; &amp;lt;!-- left stick up/down --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;B&amp;quot; function=&amp;quot;ROLL&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;     &amp;lt;!-- right stick left/right --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;C&amp;quot; function=&amp;quot;PITCH&amp;quot; min=&amp;quot;1900&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1100&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- right stick up/down --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;D&amp;quot; function=&amp;quot;YAW&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;	   &amp;lt;!-- left stick left/right--&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;E&amp;quot; function=&amp;quot;MODE&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;     &amp;lt;!-- left middle 3-pos switch --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;F&amp;quot; function=&amp;quot;GAIN1&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- left slider prop channel --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;G&amp;quot; function=&amp;quot;GAIN2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- right slider prop channel --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;H&amp;quot; function=&amp;quot;SWITCH1&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;  &amp;lt;!-- switch (channel 8) --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;I&amp;quot; function=&amp;quot;UNUSED&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;   &amp;lt;!-- channel 9 is transmitted but cannot be controlled --&amp;gt;&lt;br /&gt;
&amp;lt;/radio&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== PPM input to output chain ==&lt;br /&gt;
The chain from ppm input to servo output has intermediate steps and roughly looks like this:&lt;br /&gt;
&lt;br /&gt;
ppm input --(radio.xml)--&amp;gt; ppm_pulses[] --(radio.xml)--&amp;gt; radio_control.values[] --([[Fixedwing_Configuration#Manual|rc_commands]])--&amp;gt; commands[] --([[Fixedwing_Configuration#Servos|command_laws,servos]])--&amp;gt; actuators_pwm_values[]  ppm out&lt;br /&gt;
&lt;br /&gt;
Written in parenthesis is where you configure how to transform one value into the other.&lt;br /&gt;
&lt;br /&gt;
So in a simple case without fancy mixing, e.g. looking at the roll command / aileron servo while in MANUAL mode:&lt;br /&gt;
#PPM sum signal is read and split into channels as specified in your radio xml file.&amp;lt;br/&amp;gt;It does some sanity checking on the pulse length and frame lenght according to the top attributes in that file.&amp;lt;br/&amp;gt;This is written to the ppm_pulses array, where you now have the length of the pulse in system ticks.&lt;br /&gt;
#Now these get converted to radio_control.values array according to the channels in your radio xml file.&amp;lt;br/&amp;gt;They get scaled to MAX_PPRZ (9600), meaning what you specified as max is 9600, neutral is 0, etc.&amp;lt;br/&amp;gt;radio_control.values[RADIO_ROLL] now has the value 9600 if the pulse width of that channels was &amp;quot;max&amp;quot;&lt;br /&gt;
#Mapping of RC commands to the actual commands as specified in rc_commands section.&amp;lt;br/&amp;gt;In your case simply copy radio_control.values[RADIO_ROLL] to commands[COMMAND_ROLL]&lt;br /&gt;
#Applying command_laws (mixing) to get the commands for each servo.&amp;lt;br/&amp;gt;Again just copying in your case...&lt;br /&gt;
#Scaling from commands with MAX_PPRZ scale to the actual pwm output signal according to the servos section.&lt;br /&gt;
&lt;br /&gt;
== Measuring the PPM time values ==&lt;br /&gt;
&lt;br /&gt;
[[Image:RC_Receiver_Timing_Diagram.jpg|thumb|R/C receiver timing diagram]]&lt;br /&gt;
&lt;br /&gt;
There are two common ways to measure the time characteristics of the PPM signal:&lt;br /&gt;
# Using an oscilloscope: easy to achieve with a high level digital scope with capture and measure facilities.&lt;br /&gt;
# Using the telemetry of the autopilot: the '''PPM''' message (defined in &amp;lt;tt&amp;gt;conf/messages.xml&amp;lt;/tt&amp;gt;) contains the sequence of a (recently) received PPM signal.&lt;br /&gt;
&lt;br /&gt;
With the default telemetry configuration file (&amp;lt;tt&amp;gt;conf/telemetry/default_fixedwing.xml&amp;lt;/tt&amp;gt;), this message is '''not''' sent in the '''default''' fbw telemetry mode (numbered 0).&lt;br /&gt;
&lt;br /&gt;
There are two ways to enable this message:&lt;br /&gt;
* Use the settings mechanism to change the FBW telemetry mode while the autopilot is already running:&amp;lt;br/&amp;gt;In the GCS: Settings -&amp;gt; telemetry -&amp;gt; tele_FBW -&amp;gt; set to debug (1)&lt;br /&gt;
* This mode can be permanently changed to '''debug''' (numbered 1) in the airframe file by setting the '''TELEMETRY_MODE_FBW''' constant in your firmware section: &lt;br /&gt;
  &amp;lt;tt&amp;gt;&amp;lt;define name=&amp;quot;TELEMETRY_MODE_FBW&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Since &amp;quot;v3.9&amp;quot; the values in the PPM message are in µs.'''&lt;br /&gt;
&lt;br /&gt;
Before &amp;quot;v3.9&amp;quot; the time unit used in this '''PPM''' message was hardware dependent:&lt;br /&gt;
* On the obsolete AVR hardware, 1 microsecond = 16 units (because the crystal is running at 16MHz)&lt;br /&gt;
* on the LPC hardware, 1 microsecond = 15 units (because the cristal is running at 12MHz)&lt;br /&gt;
*:(&amp;lt;tt&amp;gt;conf/autopilot/tiny.h&amp;lt;/tt&amp;gt;), the CPU clock is 5 times more, the peripheral bus is 4 times less, and the timer is not prescaled (&amp;lt;tt&amp;gt;sw/airborne/arch/lpc21/mcu_periph/sys_time_arch.h&amp;lt;/tt&amp;gt;) !!!)&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If one has a good servo tester the output values at the receiver side can be measured&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Radio_Control&amp;diff=15879</id>
		<title>Radio Control</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Radio_Control&amp;diff=15879"/>
		<updated>2013-09-10T03:46:16Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: clarify that this is not for 2.4mhz radios&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Radio ==&lt;br /&gt;
&lt;br /&gt;
This XML file, usually located in the &amp;lt;tt&amp;gt;conf/radios&amp;lt;/tt&amp;gt; directory, contains a description of the radio control transmitter PPM signal. It should follow the grammar described in &amp;lt;tt&amp;gt;radio.dtd&amp;lt;/tt&amp;gt;. &amp;lt;b&amp;gt;This is only used for PPM transmitters so it does not apply to DSM/DSM2/FASST/FHSS or other 2.4Mhz radios.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The contents are an '''ordered''' sequence of elements describing each channel with its name and its range:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE radio SYSTEM &amp;quot;radio.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;radio name=&amp;quot;cockpitMM&amp;quot; data_min=&amp;quot;900&amp;quot; data_max=&amp;quot;2100&amp;quot; sync_min =&amp;quot;5000&amp;quot; sync_max =&amp;quot;15000&amp;quot; pulse_type=&amp;quot;POSITIVE&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;D&amp;quot; function=&amp;quot;ROLL&amp;quot;     min=&amp;quot;2000&amp;quot; neutral=&amp;quot;1498&amp;quot; max=&amp;quot;1000&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;E&amp;quot; function=&amp;quot;MODE&amp;quot;     min=&amp;quot;2000&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1000&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;/radio&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The order of the channels must be the order of the pulses in the PPM signal.&lt;br /&gt;
&lt;br /&gt;
Among the top attributes, we find&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt;: used only in debug traces.&lt;br /&gt;
* &amp;lt;tt&amp;gt;data_min&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;_max&amp;lt;/tt&amp;gt;): the minimum (resp. max) width (in microseconds) used to code one channel of the PPM signal.&lt;br /&gt;
* &amp;lt;tt&amp;gt;sync_min&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;_max&amp;lt;/tt&amp;gt;): the minimum (resp. max) width (in microseconds) between two impulses set of the PPM signal.&lt;br /&gt;
* &amp;lt;tt&amp;gt;pulse_type&amp;lt;/tt&amp;gt;: the polarity of the PPM pulse. Can be either &amp;lt;tt&amp;gt;POSITIVE&amp;lt;/tt&amp;gt; (FUTABA, Hitec, Multiplex etc) or &amp;lt;tt&amp;gt;NEGATIVE&amp;lt;/tt&amp;gt; (JR, Graupner etc.).&amp;lt;br/&amp;gt;With &amp;lt;tt&amp;gt;POSITIVE&amp;lt;/tt&amp;gt; it will trigger on the rising flank to measure the time of the positive pulse, with &amp;lt;tt&amp;gt;NEGATIVE&amp;lt;/tt&amp;gt; on the falling flank (for a negative pulse width).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each channel is described with its transmitter name (&amp;lt;tt&amp;gt;ctl&amp;lt;/tt&amp;gt;), its &amp;lt;tt&amp;gt;function&amp;lt;/tt&amp;gt; name, its range in microseconds and its neutral value in microseconds.&lt;br /&gt;
These values are used by the autopilot to compute a normalized input from the PPM signal (this file is preprocessed and the produced code is included in the airborne code). Note that the &amp;lt;tt&amp;gt;min&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attributes can be exchanged to reverse the direction of the command.&lt;br /&gt;
&lt;br /&gt;
'''Wrong attributes of the &amp;quot;radio&amp;quot; element will prevent the decoder to recognize any PPM frame; same for a wrong number or channels.'''&lt;br /&gt;
&lt;br /&gt;
=== Number of channels ===&lt;br /&gt;
&lt;br /&gt;
Note that the number of channels in your radio file &amp;lt;b&amp;gt;must exactly match&amp;lt;/b&amp;gt; the number of channels in the ppm sum signal the autopilot receives.&amp;lt;br&amp;gt;&lt;br /&gt;
Also the ''function'' names must be unique.&lt;br /&gt;
&lt;br /&gt;
* in case of analog 35MHz receivers it is the RC - TRANSMITTER that makes the pulse train (receiver only does RF part) &lt;br /&gt;
** radio file depends on transmitter, you could swap to another receiver (and e.g. you can use a 4channel receiver to receive 9 pulses :-) )&lt;br /&gt;
* in case of digital receivers it is not the transmitter but the receiver that makes the pulses&lt;br /&gt;
** e.g. Futaba Fasst 6017: you can use any compatible transmitter without need to change the radio file&lt;br /&gt;
* in case of an encoder it is the encoder that makes the summed pulse&lt;br /&gt;
** if the encoder software makes 8 pulses, even with a 5 channel RC connected paparazzi will get 8: so the radio file should read 8&lt;br /&gt;
&lt;br /&gt;
This means if your transmitter sends for example a PPM18 (Graupner/JR) signal you have nine (9) different servo channels. Even if you use a receiver with less channels you must set up &amp;lt;b&amp;gt;all&amp;lt;/b&amp;gt; transmitting servos, even if you do not use them then you must use &amp;quot;bogus switches&amp;quot; related to functions. For example a six (6) servo channels out receiver with five (5) functions used in combination with a nine (9) servo channels transmitter would need four (4) bogus entries. (5 + 4 = 9)&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneA&amp;quot;	              function=&amp;quot;NOTUSEDA&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneB&amp;quot;	              function=&amp;quot;NOTUSEDB&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneC	              function=&amp;quot;NOTUSEDC&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;channel ctl=&amp;quot;NoneD&amp;quot;	              function=&amp;quot;NOTUSEDD&amp;quot;    	min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
=== Averaging ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;average&amp;lt;/tt&amp;gt; attribute must be set to '''1..x''' for ''discrete'' channels for which a trivial averaging filter will be applied. The neutral of a discrete channel need to be halfway through the min and max values. Otherwise it won't be mapped properly by the filter. Note that averaging a channel gives the output an additional small delay.&lt;br /&gt;
&lt;br /&gt;
== Direction ==&lt;br /&gt;
&lt;br /&gt;
The following signs have been used in the radio configuration files distributed in &amp;lt;tt&amp;gt;conf/radios&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* '''ROLL''': The &amp;lt;tt&amp;gt;min&amp;lt;/tt&amp;gt; attribute value stands for the right position of the stick (turning right)&lt;br /&gt;
* '''PITCH''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the up position of the stick (pitching up)&lt;br /&gt;
&lt;br /&gt;
''' From &amp;quot;v3.9&amp;quot; on this has been changed to follow standard aerospace conventions:'''&lt;br /&gt;
* '''ROLL''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the right position of the roll stick (banking right)&lt;br /&gt;
* '''PITCH''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the &amp;quot;up&amp;quot; position of the pitch stick pulled towards you (pitching up)&lt;br /&gt;
* '''YAW''': The &amp;lt;tt&amp;gt;max&amp;lt;/tt&amp;gt; attribute value stands for the right position of the yaw stick (yawing clock-wise)&lt;br /&gt;
&lt;br /&gt;
=== Practical test ===&lt;br /&gt;
In the RC message:&lt;br /&gt;
* when the ROLL stick is pulled to the right (aircraft banks right), you should see a value close to -MAX_PPRZ (-9600) in the ROLL channel&lt;br /&gt;
* When the PITCH stick is pulled (aircraft pitches up), you should see a value close to MAX_PPRZ (9600) in the PITCH channel&lt;br /&gt;
&lt;br /&gt;
''' From &amp;quot;v3.9&amp;quot; on this has been changed to follow standard aerospace conventions:'''&lt;br /&gt;
* when the ROLL stick is pulled to the right (aircraft banks right), you should see a value close to MAX_PPRZ (9600) in the ROLL channel&lt;br /&gt;
* When the PITCH stick is pulled (aircraft pitches up), you should see a value close to MAX_PPRZ (9600) in the PITCH channel&lt;br /&gt;
* When the YAW stick is pulled to the right (aircraft yawing clock-wise), you should see a value close to MAX_PPRZ (9600) in the YAW channel&lt;br /&gt;
&lt;br /&gt;
This works with all kind of radios (PPM, USB, 2.4GHz)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Below an example of an radio file.&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
-- Attributes of root (Radio) tag :&lt;br /&gt;
-- name: name of RC&lt;br /&gt;
-- min: min width of a pulse to be considered as a data pulse&lt;br /&gt;
-- max: max width of a pulse to be considered as a data pulse&lt;br /&gt;
-- sync: min width of a pulse to be considered as a synchro pulse&lt;br /&gt;
-- min, max and sync are expressed in micro-seconds&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
-- Attributes of channel tag :&lt;br /&gt;
-- ctl: name of the command on the transmitter - only for displaying&lt;br /&gt;
-- function: logical command&lt;br /&gt;
-- average: (boolean) channel filtered through several frames (for discrete commands)&lt;br /&gt;
-- min: minimum pulse length (micro-seconds)&lt;br /&gt;
-- max: maximum pulse length (micro-seconds)&lt;br /&gt;
-- neutral: neutral pulse length (micro-seconds)&lt;br /&gt;
Note: a command may be reversed by exchanging min and max values&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;radio name=&amp;quot;GraupnerMC20&amp;quot; data_min=&amp;quot;950&amp;quot; data_max=&amp;quot;2150&amp;quot; sync_min=&amp;quot;5000&amp;quot; sync_max=&amp;quot;15000&amp;quot; pulse_type=&amp;quot;NEGATIVE&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;A&amp;quot; function=&amp;quot;THROTTLE&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1100&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt; &amp;lt;!-- left stick up/down --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;B&amp;quot; function=&amp;quot;ROLL&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;     &amp;lt;!-- right stick left/right --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;C&amp;quot; function=&amp;quot;PITCH&amp;quot; min=&amp;quot;1900&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1100&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- right stick up/down --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;D&amp;quot; function=&amp;quot;YAW&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;	   &amp;lt;!-- left stick left/right--&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;E&amp;quot; function=&amp;quot;MODE&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;     &amp;lt;!-- left middle 3-pos switch --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;F&amp;quot; function=&amp;quot;GAIN1&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- left slider prop channel --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;G&amp;quot; function=&amp;quot;GAIN2&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;0&amp;quot;/&amp;gt;    &amp;lt;!-- right slider prop channel --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;H&amp;quot; function=&amp;quot;SWITCH1&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;  &amp;lt;!-- switch (channel 8) --&amp;gt;&lt;br /&gt;
  &amp;lt;channel ctl=&amp;quot;I&amp;quot; function=&amp;quot;UNUSED&amp;quot; min=&amp;quot;1100&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1900&amp;quot; average=&amp;quot;1&amp;quot;/&amp;gt;   &amp;lt;!-- channel 9 is transmitted but cannot be controlled --&amp;gt;&lt;br /&gt;
&amp;lt;/radio&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== PPM input to output chain ==&lt;br /&gt;
The chain from ppm input to servo output has intermediate steps and roughly looks like this:&lt;br /&gt;
&lt;br /&gt;
ppm input --(radio.xml)--&amp;gt; ppm_pulses[] --(radio.xml)--&amp;gt; radio_control.values[] --([[Fixedwing_Configuration#Manual|rc_commands]])--&amp;gt; commands[] --([[Fixedwing_Configuration#Servos|command_laws,servos]])--&amp;gt; actuators_pwm_values[]  ppm out&lt;br /&gt;
&lt;br /&gt;
Written in parenthesis is where you configure how to transform one value into the other.&lt;br /&gt;
&lt;br /&gt;
So in a simple case without fancy mixing, e.g. looking at the roll command / aileron servo while in MANUAL mode:&lt;br /&gt;
#PPM sum signal is read and split into channels as specified in your radio xml file.&amp;lt;br/&amp;gt;It does some sanity checking on the pulse length and frame lenght according to the top attributes in that file.&amp;lt;br/&amp;gt;This is written to the ppm_pulses array, where you now have the length of the pulse in system ticks.&lt;br /&gt;
#Now these get converted to radio_control.values array according to the channels in your radio xml file.&amp;lt;br/&amp;gt;They get scaled to MAX_PPRZ (9600), meaning what you specified as max is 9600, neutral is 0, etc.&amp;lt;br/&amp;gt;radio_control.values[RADIO_ROLL] now has the value 9600 if the pulse width of that channels was &amp;quot;max&amp;quot;&lt;br /&gt;
#Mapping of RC commands to the actual commands as specified in rc_commands section.&amp;lt;br/&amp;gt;In your case simply copy radio_control.values[RADIO_ROLL] to commands[COMMAND_ROLL]&lt;br /&gt;
#Applying command_laws (mixing) to get the commands for each servo.&amp;lt;br/&amp;gt;Again just copying in your case...&lt;br /&gt;
#Scaling from commands with MAX_PPRZ scale to the actual pwm output signal according to the servos section.&lt;br /&gt;
&lt;br /&gt;
== Measuring the PPM time values ==&lt;br /&gt;
&lt;br /&gt;
[[Image:RC_Receiver_Timing_Diagram.jpg|thumb|R/C receiver timing diagram]]&lt;br /&gt;
&lt;br /&gt;
There are two common ways to measure the time characteristics of the PPM signal:&lt;br /&gt;
# Using an oscilloscope: easy to achieve with a high level digital scope with capture and measure facilities.&lt;br /&gt;
# Using the telemetry of the autopilot: the '''PPM''' message (defined in &amp;lt;tt&amp;gt;conf/messages.xml&amp;lt;/tt&amp;gt;) contains the sequence of a (recently) received PPM signal.&lt;br /&gt;
&lt;br /&gt;
With the default telemetry configuration file (&amp;lt;tt&amp;gt;conf/telemetry/default_fixedwing.xml&amp;lt;/tt&amp;gt;), this message is '''not''' sent in the '''default''' fbw telemetry mode (numbered 0).&lt;br /&gt;
&lt;br /&gt;
There are two ways to enable this message:&lt;br /&gt;
* Use the settings mechanism to change the FBW telemetry mode while the autopilot is already running:&amp;lt;br/&amp;gt;In the GCS: Settings -&amp;gt; telemetry -&amp;gt; tele_FBW -&amp;gt; set to debug (1)&lt;br /&gt;
* This mode can be permanently changed to '''debug''' (numbered 1) in the airframe file by setting the '''TELEMETRY_MODE_FBW''' constant in your firmware section: &lt;br /&gt;
  &amp;lt;tt&amp;gt;&amp;lt;define name=&amp;quot;TELEMETRY_MODE_FBW&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Since &amp;quot;v3.9&amp;quot; the values in the PPM message are in µs.'''&lt;br /&gt;
&lt;br /&gt;
Before &amp;quot;v3.9&amp;quot; the time unit used in this '''PPM''' message was hardware dependent:&lt;br /&gt;
* On the obsolete AVR hardware, 1 microsecond = 16 units (because the crystal is running at 16MHz)&lt;br /&gt;
* on the LPC hardware, 1 microsecond = 15 units (because the cristal is running at 12MHz)&lt;br /&gt;
*:(&amp;lt;tt&amp;gt;conf/autopilot/tiny.h&amp;lt;/tt&amp;gt;), the CPU clock is 5 times more, the peripheral bus is 4 times less, and the timer is not prescaled (&amp;lt;tt&amp;gt;sw/airborne/arch/lpc21/mcu_periph/sys_time_arch.h&amp;lt;/tt&amp;gt;) !!!)&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If one has a good servo tester the output values at the receiver side can be measured&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Module/Servo_switch&amp;diff=15802</id>
		<title>Module/Servo switch</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Module/Servo_switch&amp;diff=15802"/>
		<updated>2013-08-29T22:46:01Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: fix some errors&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Modules&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
This module allows you to easily '''control a servo output like a switch''' (e.g. for a hatch, cam trigger, etc) '''via Flight Plan and GCS''' ('''not via RC!''').&lt;br /&gt;
&lt;br /&gt;
To use it load the servo_switch module:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;servo_switch.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Now you only have to declare a servo in your airframe.xml that you&lt;br /&gt;
want to use.&lt;br /&gt;
&lt;br /&gt;
By default the servo_switch module looks for a servo called SWITCH.&lt;br /&gt;
The switch on value is 2000us and switch off is 1000us by default.&lt;br /&gt;
e.g. in my airframe file I have:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;servos&amp;gt;&lt;br /&gt;
    ....&lt;br /&gt;
    &amp;lt;servo name=&amp;quot;SWITCH&amp;quot; no=&amp;quot;7&amp;quot; min=&amp;quot;1000&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;2000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/servos&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If you want to use a different servo/values you can set that in the&lt;br /&gt;
modules section, e.g. for a servo named HATCH:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    &amp;lt;load name=&amp;quot;servo_switch.xml&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_SWITCH_ON_VALUE&amp;quot;  value=&amp;quot;1100&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_SWITCH_OFF_VALUE&amp;quot; value=&amp;quot;1900&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;SERVO_SWITCH_SERVO&amp;quot;     value=&amp;quot;HATCH&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/load&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Of course you only have to set these parameters here If you do not&lt;br /&gt;
want to use the DEFAULT servo (SWITCH) or the default on/off values. Switch value will not go outside the range defined on the servo&lt;br /&gt;
&lt;br /&gt;
=== Calling from Flight Plan ===&lt;br /&gt;
In your flight plan you just call the macro defined in servo_switch.h&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;call fun=&amp;quot;ServoSwitchOn()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;call fun=&amp;quot;ServoSwitchOff()&amp;quot;/&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
respectively.&lt;br /&gt;
&lt;br /&gt;
=== Buttons in the GCS ===&lt;br /&gt;
&lt;br /&gt;
To get buttons for the servo switch module in the GCS add conf/settings/modules/servo_switch.xml to the settings files of your aircraft.&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Module/System_monitor&amp;diff=15774</id>
		<title>Module/System monitor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Module/System_monitor&amp;diff=15774"/>
		<updated>2013-08-26T16:25:52Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Modules&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
The sys_mon module gives you some information about the timing of the periodic tasks and a rough estimate of cpu load (averaged over 1 sec).&lt;br /&gt;
&lt;br /&gt;
The SYS_MON message contains the following information ('''all times are given in microseconds'''):&lt;br /&gt;
; periodic_time :  time between two calls of the main periodic function (averaged over 1s)&lt;br /&gt;
; periodic_cycle : time it took to execute the main periodic functions (averaged over 1s)&lt;br /&gt;
; periodic_cycle_min : minimum time it took to execute the main periodic functions during the last second&lt;br /&gt;
; periodic_cycle_max : maximum time it took to execute the main periodic functions during the last second&lt;br /&gt;
; event_number : number of times the event loop was called during the last second&lt;br /&gt;
; cpu_load : rough estimate of cpu load (averaged over 1 sec)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So your periodic_time should be 1/PERIODIC_FREQUENCY.&lt;br /&gt;
The periodic_cycle_max should not be over the periodic_time, otherwise in at least one cycle it took longer to calculate everything and the next one was slightly delayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The sys_mon module has to run at the full main frequency!'''&lt;br /&gt;
&lt;br /&gt;
'''So either don't specify a ''[[Modules#In_the_airframe_file|main_freq]]'' parameter like in the example below or set your actual main frequency'''&lt;br /&gt;
&lt;br /&gt;
To use it load the sys_mon module:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;modules&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;load name=&amp;quot;sys_mon.xml&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/modules&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Modules]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Advanced_Navigation_Routines&amp;diff=15695</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=15695"/>
		<updated>2013-08-12T19:43:35Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: correction of waypoint names, as tested with version 5.0 _S2 was not correct, it is just S2&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;
To use these navigation routines, you need to change the navigation subsystem type to extra in your airframe file. The navigation extra subsystem includes extra navigation routines like OSAMnav, spiral, poly_survey_advanced, nav_cube, etc.&lt;br /&gt;
 &amp;lt;subsystem name=&amp;quot;navigation&amp;quot; type=&amp;quot;extra&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also include OSAMNav.h in your flight plan:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;quot;subsystems/navigation/OSAMNav.h&amp;quot;&lt;br /&gt;
&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;
&lt;br /&gt;
In our example the waypoints are called &amp;quot;Center&amp;quot; and &amp;quot;Edge&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;waypoint name=&amp;quot;Center&amp;quot; x=&amp;quot;-20.0&amp;quot; y=&amp;quot;-160.0&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;waypoint name=&amp;quot;Edge&amp;quot; x=&amp;quot;-10.0&amp;quot; y=&amp;quot;-60.0&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then you can add flower to your flight plan:&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;
&lt;br /&gt;
Note that in the function InitializeFlower the waypoints need the prefix &amp;quot;WP_&amp;quot;.&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;
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 (-90 &amp;lt;-&amp;gt; 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;
You can 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 -90 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;br /&gt;
&lt;br /&gt;
== misc ==&lt;br /&gt;
&lt;br /&gt;
=== border_line ===&lt;br /&gt;
&lt;br /&gt;
border_line is a nav-routine pretty similar to the nav-line-routine. You can use this nav-routine whenever you want to take care your plane stays on a defined site of a border.&lt;br /&gt;
For example you can use this routine to fly along a mountain and always turn away from the wall or you can fly along a road/border without penetrating one site.&lt;br /&gt;
&lt;br /&gt;
Use &amp;quot;extra&amp;quot; navigation subsystem with:&lt;br /&gt;
 &amp;lt;subsystem name=&amp;quot;navigation&amp;quot; type=&amp;quot;extra&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to use waypoint 1 and 2 you can add border_line in your flight plan like this:&lt;br /&gt;
* Include header in &amp;quot;header&amp;quot; section at the beginning&lt;br /&gt;
 #include &amp;quot;subsystems/navigation/border_line.h&amp;quot;&lt;br /&gt;
* Add function in a flight plan block:&lt;br /&gt;
    &amp;lt;block group=&amp;quot;extra_pattern&amp;quot; name=&amp;quot;border line&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;border_line_init()&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;border_line(WP_1, WP_2, -nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;example&amp;quot;&amp;gt;&lt;br /&gt;
Image:border_line.png|Screen shot of border_line&lt;br /&gt;
Image:border_line2.png|Screen shot of border_line2&lt;br /&gt;
Image:border_line3.png|Screen shot of border_line3&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== gls (gps landing system) ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
- defined glide path angle &lt;br /&gt;
&lt;br /&gt;
- in flight changeable landing direction without loosing the glide path angle!&lt;br /&gt;
&lt;br /&gt;
- smooth intercept independent of approach angle or wind&lt;br /&gt;
&lt;br /&gt;
- seperation of approach fix, start decent and top of decent &lt;br /&gt;
&lt;br /&gt;
- with fix target speed (in airspeed mode only)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
how to setup your airframe.xml:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;section name=&amp;quot;GLS_APPROACH&amp;quot; prefix=&amp;quot;APP_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ANGLE&amp;quot; value=&amp;quot;5&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;INTERCEPT_RATE&amp;quot; value=&amp;quot;0.624&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DISTANCE_AF_SD&amp;quot; value=&amp;quot;20&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;TARGET_SPEED&amp;quot; value=&amp;quot;14&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ANGLE                   - angle from TOD to TD&lt;br /&gt;
&lt;br /&gt;
DISTANCE_AF_SD  - minimum distance (meter) between AF and SD to allow the plane to self stabilize before the intercept starts (e.g. for speed reduction)&lt;br /&gt;
&lt;br /&gt;
You can set the landing direction by moving the approach fix (AF) in relation to the touch down point (TD).&lt;br /&gt;
If you try to set the AF close to the TD  you will see how the top of decent (TOD) and start decent (SD) is calculated and if necessary the AF is moved backwards.&lt;br /&gt;
(please try in simulation)&lt;br /&gt;
&lt;br /&gt;
TARGET_SPEED      - desired airspeed from AF to TD &lt;br /&gt;
&lt;br /&gt;
INTERCEPT_RATE   -&lt;br /&gt;
&lt;br /&gt;
e.g. no wind: TARGET_SPEED = 14m/s and ANGLE = 10 --&amp;gt; desired decent rate 2.5 m/s    (speed * tan(ANGLE))&lt;br /&gt;
&lt;br /&gt;
with an INTERCEPT_RATE of 0.624 m/s/s it will take 4s to intercept the final approach path (desired decent rate / intercept_rate)&lt;br /&gt;
&lt;br /&gt;
the idea is that the INTERCEPT_RATE is unique to each plane and will not change with different approach angles&lt;br /&gt;
&lt;br /&gt;
to find an appropriate value you can start with a lower (to match 8s for example) and increase it until the intercept will be made from above&lt;br /&gt;
&lt;br /&gt;
in general: bigger plane - smaller value!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
how to setup your flightplan.xml:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;waypoints&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint height=&amp;quot;150&amp;quot; name=&amp;quot;AF&amp;quot; x=&amp;quot;-260.6&amp;quot; y=&amp;quot;-344.6&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;SD&amp;quot; x=&amp;quot;-1600.&amp;quot; y=&amp;quot;-36.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint name=&amp;quot;TOD&amp;quot; x=&amp;quot;-1600.&amp;quot; y=&amp;quot;-36.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint height=&amp;quot;0.0&amp;quot; name=&amp;quot;TD&amp;quot; x=&amp;quot;-27.2&amp;quot; y=&amp;quot;-243.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;waypoint height=&amp;quot;266.0&amp;quot; name=&amp;quot;_BASELEG&amp;quot; x=&amp;quot;-1652.1&amp;quot; y=&amp;quot;-113.5&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/waypoints&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;land&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;gls_init(WP_AF,WP_SD, WP_TOD, WP_TD)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;nav_compute_baseleg(WP_AF, WP_TD, WP__BASELEG, nav_radius)&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;NavCircleCount() &amp;gt; 0.5&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;circle radius=&amp;quot;nav_radius&amp;quot; until=&amp;quot;And(NavQdrCloseTo(DegOfRad(baseleg_out_qdr)-(nav_radius/fabs(nav_radius))*10),&lt;br /&gt;
                               10 &amp;gt; fabs(GetPosAlt() - WaypointAlt(WP__BASELEG)))&amp;quot; wp=&amp;quot;_BASELEG&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;block name=&amp;quot;final&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;exception cond=&amp;quot;ground_alt + 10 &amp;gt; estimator_z&amp;quot; deroute=&amp;quot;flare&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;gls(WP_AF,WP_SD, WP_TOD, WP_TD)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
those pictures match the old gls routine! anyway - the new one is not much different... (POS I = SD)&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;theory&amp;quot;&amp;gt;&lt;br /&gt;
Image:gls1.png|side view&lt;br /&gt;
Image:gls2.png|from above&lt;br /&gt;
Image:gls3.png|screen shot of flight test&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Multi-UAV ==&lt;br /&gt;
For TCAS (Traffic Collision Avoidance System) see the [[MultiUAV]] page.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Navigation]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=GCS_Configuration&amp;diff=15688</id>
		<title>GCS Configuration</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=GCS_Configuration&amp;diff=15688"/>
		<updated>2013-08-10T06:35:12Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: explain how to use options&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;GCS&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Paparazzi Center ==&lt;br /&gt;
The paparazzi center is launched with the following command:&lt;br /&gt;
 &amp;lt;tt&amp;gt;./sw/supervision/paparazzicenter&amp;lt;/tt&amp;gt;&lt;br /&gt;
and is used to launch individual portions of the GCS (''Programs'') or the entire GCS (''Sessions'') with the modem and map settings defined in &amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;/conf/control_panel.xml&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Configuration Options===&lt;br /&gt;
&lt;br /&gt;
Here all the commandline parameter to set specific option(s) while launching the GCS. To use these edit the file conf/control_panel.xml in the line that says &amp;lt;program name=&amp;quot;GCS&amp;quot; command=&amp;quot;sw/ground_segment/cockpit/gcs&amp;quot;&amp;gt; add the options, for example:  &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;program name=&amp;quot;GCS&amp;quot; command=&amp;quot;sw/ground_segment/cockpit/gcs -fullscreen&amp;quot;&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 '''-auto_ortho''', IGN tiles path&lt;br /&gt;
 '''-b''', &amp;lt;ivy bus&amp;gt; Default is 127.255.255.255:2010&lt;br /&gt;
 '''-center''', Initial map center (e.g. 'WGS84 43.605 1.443')&lt;br /&gt;
 '''-center_ac''', Centers the map on any new A/C&lt;br /&gt;
 '''-edit''', Flight plan editor&lt;br /&gt;
 '''-fullscreen''', Fullscreen window&lt;br /&gt;
 '''-maps_fill''', Automatically start loading background maps&lt;br /&gt;
 '''-maps_zoom''', Background maps zoomlevel (default: 18, max: 22)&lt;br /&gt;
 '''-ign''', IGN tiles path&lt;br /&gt;
 '''-lambertIIe''', Switch to LambertIIe projection&lt;br /&gt;
 '''-layout''', &amp;lt;XML layout specification&amp;gt; GUI layout. Default: horizontal.xml&lt;br /&gt;
 '''-m''', Map XML description file&lt;br /&gt;
 '''-maximize''', Maximize window&lt;br /&gt;
 '''-mercator''', Switch to (Google Maps) Mercator projection, default&lt;br /&gt;
 '''-mplayer''', Launch mplayer with the given argument as X plugin&lt;br /&gt;
 '''-no_alarm''', Disables alarm page&lt;br /&gt;
 '''-maps_no_http''', Switch off downloading of maps, always use cached maps&lt;br /&gt;
 '''-ortho''', IGN tiles path&lt;br /&gt;
 '''-osm''', Use OpenStreetMap database (default is Google)&lt;br /&gt;
 '''-ms''', Use Microsoft maps database (default is Google)&lt;br /&gt;
 '''-particules''', Display particules&lt;br /&gt;
 '''-plugin''', External X application (launched with the id of the plugin window as argument)&lt;br /&gt;
 '''-ref ''',Geographic ref (e.g. 'WGS84 43.605 1.443')&lt;br /&gt;
 '''-speech''', Enable vocal messages&lt;br /&gt;
 '''-srtm''', Enable SRTM elevation display&lt;br /&gt;
 '''-track_size''', Default track length (500)&lt;br /&gt;
 '''-utm''', Switch to UTM local projection&lt;br /&gt;
 '''-wid''', &amp;lt;window id&amp;gt; Id of an existing window to be attached to&lt;br /&gt;
 '''-zoom''', Initial zoom&lt;br /&gt;
 '''-auto_hide_fp''', Automatically hide flight plans of unselected aircraft&lt;br /&gt;
 '''-help''', Display a list of options&lt;br /&gt;
&lt;br /&gt;
=== Video plugin ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;-mplayer&amp;lt;/tt&amp;gt; option of GCS allows to the user to display a video stream in a window of the GCS.  The video window can also be exchanged with the map by clicking anywhere inside the frame.&lt;br /&gt;
Use the following line in your &amp;lt;tt&amp;gt;/conf/control_panel.xml&amp;lt;/tt&amp;gt; to enable the video window.&lt;br /&gt;
 &amp;lt;tt&amp;gt;path_to_ground_segment/cockpit/gcs -mplayer rtsp://localhost:7070/video&amp;lt;/tt&amp;gt;&lt;br /&gt;
A useful example follows:&lt;br /&gt;
If you have an Avermedia DVB-T usb tuner like the Aver-Tv Hybrid Volar HX (Avermedia finally released Ubuntu Linux drivers)&lt;br /&gt;
then in order to use the usb tuner as video input to the GCS you have to complete the following steps:&lt;br /&gt;
&lt;br /&gt;
First download and install the drivers and check that the Usb tuner works well by opening a console window&lt;br /&gt;
and typing: &lt;br /&gt;
&lt;br /&gt;
'''mplayer tv:// -tv driver=v4l2:width=320:height=240:norm=NTSC:input=1:device=/dev/video1:noaudio'''&lt;br /&gt;
&lt;br /&gt;
Of course you must connect a video signal to the composite input first.&lt;br /&gt;
Then close the console and remove the Usb tuner.&lt;br /&gt;
Now it is time to configure the control_panel.xml file by editing the GCS command line.&lt;br /&gt;
Locate the line in the &amp;quot;control_panel.xml&amp;quot; usually located in /Your Paparazzi directory/conf/ (mine is in &amp;quot;/paparazzi/conf/&amp;quot;)&lt;br /&gt;
that looks similar to the below line:&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;program name=&amp;quot;GCS&amp;quot; command=&amp;quot;sw/ground_segment/cockpit/gcs -layout horizontal.xml&amp;quot;&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
Then edit it so it looks like this:&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;program name=&amp;quot;GCS&amp;quot; command=&amp;quot;sw/ground_segment/cockpit/gcs -layout horizontal.xml -mplayer 'tv:// -tv driver=v4l2:width=320:height=240:norm=NTSC:input=1:device=/dev/video1:alsa:adevice=hw.2,0:amode=1:audiorate=48000:forceaudio:volume=100:immediatemode=0'&amp;quot;&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
The above line is one complete and uninterrupted line but it is just too long to show it in one line here.&lt;br /&gt;
(There is a space after the&amp;quot;-tv&amp;quot; like this &amp;quot;-mplayer 'tv:// -tv driver=v4l2:....&amp;quot; but nowhere else after that).&lt;br /&gt;
This will load the mplayer, select the composite video input of the tuner and enable the sound input.&lt;br /&gt;
Please remember to change the &amp;quot;NTSC&amp;quot; with &amp;quot;PAL&amp;quot; if you do not use the NTSC video system (if your airborne camera is PAL for example). &lt;br /&gt;
Read the mplayer documentation so you can tweak the resolution etc. later to suit your particular setup.&lt;br /&gt;
The resolution above is set to 320x240 here but you can set it to 640x480 by replacing the numbers in the command line above.&lt;br /&gt;
&lt;br /&gt;
Finally you have to add the plugin widget to your GCS layout configuration file.&lt;br /&gt;
If you noticed the GCS command line in the &amp;quot;control_panel.xml&amp;quot; file, a part of it reads &amp;quot;-layout horizontal.xml&amp;quot; &lt;br /&gt;
so our configuration file is the &amp;quot;horizontal.xml&amp;quot; which is located always in &amp;quot;/Your Paparazzi directory/conf/gcs/&amp;quot; &lt;br /&gt;
(mine is in &amp;quot;/paparazzi/conf/gcs/&amp;quot;).&lt;br /&gt;
Open the file and add or uncomment the below line (in &amp;quot;horizontal.xml&amp;quot; the plugin widget is there but commented out):&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;widget NAME=&amp;quot;plugin&amp;quot; SIZE=&amp;quot;300&amp;quot;/&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
Now the file should look like this:&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
 &amp;lt;rows&amp;gt;&lt;br /&gt;
  &amp;lt;widget size=&amp;quot;500&amp;quot; name=&amp;quot;map2d&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;columns&amp;gt;&lt;br /&gt;
   &amp;lt;rows size=&amp;quot;375&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;widget size=&amp;quot;200&amp;quot; name=&amp;quot;strips&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/rows&amp;gt;&lt;br /&gt;
   &amp;lt;widget size=&amp;quot;400&amp;quot; name=&amp;quot;aircraft&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;widget name=&amp;quot;alarms&amp;quot;/&amp;gt;  &lt;br /&gt;
   &amp;lt;widget NAME=&amp;quot;plugin&amp;quot; SIZE=&amp;quot;300&amp;quot;/&amp;gt; &lt;br /&gt;
  &amp;lt;/columns&amp;gt;&lt;br /&gt;
 &amp;lt;/rows&amp;gt;&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
All the above work fine in Ubuntu 10.04 LTS but probably the same method should work fine on different versions too.&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
The layout of the different components (map, strips, ...) of the gcs is configurable through a ''style'' XML file located in &amp;lt;tt&amp;gt;conf/gcs/&amp;lt;/tt&amp;gt;. The specification is done via a combination of rows and columns. The default layout is given in the &amp;lt;tt&amp;gt;horizontal.xml&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE layout SYSTEM &amp;quot;layout.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;layout width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;rows&amp;gt;&lt;br /&gt;
  &amp;lt;widget size=&amp;quot;500&amp;quot; name=&amp;quot;map2d&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;columns&amp;gt;&lt;br /&gt;
   &amp;lt;rows size=&amp;quot;350&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;widget size=&amp;quot;120&amp;quot; name=&amp;quot;strips&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;widget name=&amp;quot;alarms&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/rows&amp;gt;&lt;br /&gt;
   &amp;lt;widget size=&amp;quot;400&amp;quot; name=&amp;quot;aircraft&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;widget size=&amp;quot;00&amp;quot; name=&amp;quot;plugin&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/columns&amp;gt;&lt;br /&gt;
 &amp;lt;/rows&amp;gt;&lt;br /&gt;
 &amp;lt;/layout&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default size ('''1024x768''') of the whole window is specified in the root of the tree. The window is then divided in two rows: &lt;br /&gt;
* the &amp;lt;tt&amp;gt;map2d&amp;lt;/tt&amp;gt; with a requested height of '''500'''&lt;br /&gt;
* a set of columns containing&lt;br /&gt;
** a set of rows of width '''350''' divided into&lt;br /&gt;
**: the '''strips''' frame of height '''120'''&lt;br /&gt;
**: the '''alarms''' frame&lt;br /&gt;
** the notebook frame ('''aircraft''') of width '''400'''&lt;br /&gt;
** the video plugin frame&lt;br /&gt;
&lt;br /&gt;
This second example (&amp;lt;tt&amp;gt;left_col.xml&amp;lt;/tt&amp;gt;) sets the map and the notebook on the right and the other frames in a left column:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;!DOCTYPE layout SYSTEM &amp;quot;layout.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;layout width=&amp;quot;1024&amp;quot; height=&amp;quot;768&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;columns&amp;gt;&lt;br /&gt;
   &amp;lt;rows size=&amp;quot;360&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;widget size=&amp;quot;120&amp;quot; name=&amp;quot;strips&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;widget size=&amp;quot;300&amp;quot; name=&amp;quot;plugin&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;widget name=&amp;quot;alarms&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/rows&amp;gt;&lt;br /&gt;
   &amp;lt;rows&amp;gt;&lt;br /&gt;
     &amp;lt;widget name=&amp;quot;map2d&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;widget name=&amp;quot;aircraft&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/rows&amp;gt;&lt;br /&gt;
 &amp;lt;/columns&amp;gt;&lt;br /&gt;
 &amp;lt;/layout&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This layout file is chosen with the &amp;lt;tt&amp;gt;-layout&amp;lt;/tt&amp;gt; option:&lt;br /&gt;
 &amp;lt;tt&amp;gt;path_to_ground_segment/cockpit/gcs -layout left_col.xml&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:GCS]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Lia&amp;diff=15602</id>
		<title>Lia</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Lia&amp;diff=15602"/>
		<updated>2013-07-30T06:34:21Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Lia''' is a lower cost version of [[Lisa/M]] first developed for inclusion with the [http://wiki.thequadshot.com/wiki/The_Mocha Quadshot Mocha].&lt;br /&gt;
&lt;br /&gt;
== Differences from Lisa/M ==&lt;br /&gt;
&lt;br /&gt;
* 0.1&amp;quot; pitch connectors instead of molex picoblade&lt;br /&gt;
* No CAN transceiver (footprint still present just not populated) on [http://www.transition-robotics.com Transition Robotics]serial numbers LI1-001 through LI1-200 (populated on serial numbers ≥LI1-201)&lt;br /&gt;
* No I2C2 level shifter (footprint still present just not populated)&lt;br /&gt;
* No 5V voltage regulator (footprint still present just not populated)&lt;br /&gt;
* No JTAG connector (footprint still present just not populated)&lt;br /&gt;
* Added servo power inline resistors (by default 0 ohm but can be changed to higher value for balancing the linear voltage regulators of the motor controllers)&lt;br /&gt;
&lt;br /&gt;
== Pictures ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Lia_1.1_top.jpg|Lia V1.1 top side&lt;br /&gt;
Image:Lia_1.1_bottom.jpg|Lia V1.1 bottom side&lt;br /&gt;
Image:Lia_1.1_aspirin_bottom.jpg|Lia V1.1 bottom side with Aspirin 2.1 nomag nobaro placed.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Jumper Configuration ==&lt;br /&gt;
There are a number of jumpers on Lia used to configure voltage levels and power input. Their locations and functions are identical to those on the Lisa/M v2.0.&amp;lt;br/&amp;gt;&lt;br /&gt;
See the [[Lisa/M_v2.0#Jumper_Configuration|Jumper Configuration section on the Lisa/M v2.0 page]].&lt;br /&gt;
&lt;br /&gt;
Note that the default states of JP8 and JP9 are reversed with respect to the defaults of Lisa/M v2.0; that is:&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''Lia UART1 and UART5 VCC Configuration'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''Jumper''!!width=&amp;quot;20%&amp;quot;|''Bus Connection''!!width=&amp;quot;7%&amp;quot;|''Default''!!''Description''&lt;br /&gt;
|-&lt;br /&gt;
|JP8||UART1&amp;amp;5_VCC to V_IN||style=&amp;quot;background:black; color:white&amp;quot;|CLOSED||Connects UART1 and UART5 connector VCC to autopilot input voltage V_IN rail&lt;br /&gt;
|-&lt;br /&gt;
|JP9||UART1&amp;amp;5_VCC to +3V3||OPEN||Connects UART1 and UART5 connector VCC to autopilot +3V3 rail&lt;br /&gt;
|}&lt;br /&gt;
'''WARNING: DO NOT CLOSE BOTH JP8 AND JP9 SIMULTANEOUSLY!!!'''&lt;br /&gt;
&lt;br /&gt;
[[Category:Lisa]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Modems&amp;diff=15510</id>
		<title>Modems</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Modems&amp;diff=15510"/>
		<updated>2013-07-19T22:20:17Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Adafruit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Paparazzi autopilots generally feature a TTL serial port to interface with any common radio modem.  The bidirectional link provides real-time telemetry and in-flight tuning and navigation commands.  The system is also capable overlaying the appropriate protocols to communicate thru non-transparent devices such as the Coronis Wavecard or Maxstream API-enabled products, allowing for hardware addressing for multiple aircraft or future enhancements such as data-relaying, inter-aircraft communication, RSSI signal monitoring and automatic in-flight modem power adjustment.  Below is a list of some of the common modems used with Paparazzi, for details on configuring your modem see the [[Airframe_Configuration#Telemetry_.28Modem.29|Airframe Configuration]] and [[XBee_configuration|XBee Configuration]] pages.&lt;br /&gt;
&lt;br /&gt;
== Digi XBee modules ==&lt;br /&gt;
&lt;br /&gt;
Digi (formerly Maxstream) offers an increasing variety of Zigbee protocol modems well suited for Paparazzi in 2.4 GHz, 900MHz and 868Mhz frequencies.  The &amp;quot;Pro&amp;quot; series are long range, up to 40km!  Standard series are slightly smaller/lighter/lower power consumption and very short range.  All versions are all pin compatible and weigh around 2 grams with wire antennas.  All Digi modems can be operated in transparent mode (as a serial line replacement) or in &amp;quot;API mode&amp;quot; with hardware addressing, managed networking, and RSSI (signal strength) data with the Paparazzi &amp;quot;Xbee&amp;quot; option.  Three antenna options are offered: the SMA version is ideal for ground modems, wire antennas for aircraft, and chip antennas for those with very limited space.&lt;br /&gt;
&lt;br /&gt;
* XBee (PRO) ZB (the current series)&lt;br /&gt;
* XBee (PRO) ZNet 2.5 (formerly Series 2) (only legacy -&amp;gt; use XBee-PRO ZB)&lt;br /&gt;
The XBee &amp;amp; XBee-PRO ZB share hardware (ember stack) with XBee &amp;amp; XBee-PRO ZNet 2.5. As a result, modules can be &amp;quot;converted&amp;quot; from one platform to another by loading different firmware onto a given module.&lt;br /&gt;
&lt;br /&gt;
These two also share the same hardware and can be converted from one to another by flashing a different firmware:&lt;br /&gt;
* XBee-PRO 802.15.4 (formerly Series 1)&lt;br /&gt;
* XBee-PRO DigiMesh 2.4&lt;br /&gt;
&lt;br /&gt;
'''Note: Modules based on Freescale chipset (formerly Series 1) are not compatible with Ember chipset based modules (Series 2).'''&lt;br /&gt;
&lt;br /&gt;
See the [[XBee_configuration|XBee Configuration]] page. This [http://pixhawk.ethz.ch/tutorials/how_to_configure_xbee tutorial] is also good to configure and get started with XBee Pro.&lt;br /&gt;
&lt;br /&gt;
=== Module Comparison ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''Module'''||'''Point-to-Multipoint'''||'''ZigBee/Mesh'''||'''Chipset'''|||'''Software stack'''||'''Frequency'''||'''TX Power normal/PRO'''||'''Notes'''&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee ZB'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Ember&lt;br /&gt;
|EmberZNet PRO 3.1 (ZigBee 2007)&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|2mW/50mW&lt;br /&gt;
|coordinator needed&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee ZNet 2.5'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Ember&lt;br /&gt;
|EmberZNet 2.5 ZigBee&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|2mW/50mW&lt;br /&gt;
|(only legacy -&amp;gt; use XBee-PRO ZB) coordinator needed&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee DigiMesh 2.4'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Freescale&lt;br /&gt;
|&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|&lt;br /&gt;
|all nodes equal (no special coordinators/routers/end-devices)&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee 802.15.4'''&lt;br /&gt;
|yes&lt;br /&gt;
|&lt;br /&gt;
|Freescale&lt;br /&gt;
|&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee-PRO 868'''&lt;br /&gt;
|yes&lt;br /&gt;
|&lt;br /&gt;
|?&lt;br /&gt;
|&lt;br /&gt;
|868 MHz&lt;br /&gt;
|500mW&lt;br /&gt;
|Only High Power Frequency allowed in the UK. 2.4GHz limited to 10mW&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Comparison Conclusion ====&lt;br /&gt;
&lt;br /&gt;
(Copied from DIGI manual)&lt;br /&gt;
&lt;br /&gt;
''If the application strictly needs to communicate in a point-to-point or a point-to-multipoint &lt;br /&gt;
fashion, 802.15.4 will be able handle all the communications between your devices and will &lt;br /&gt;
be simpler to implement than trying to use a module with ZigBee firmware to accomplish the &lt;br /&gt;
same goal. ZigBee is necessary if you need to use repeating or the mesh networking &lt;br /&gt;
functionality.'' &lt;br /&gt;
&lt;br /&gt;
-Interpretation for paparazzi: if inter-aircraft communication is required one should go for the zigbee ZB series 2 modules. &lt;br /&gt;
&lt;br /&gt;
==== Pinout ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Maxstream_Xbee_pinout.jpg|left|thumb|Maxstream XBee pinout]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||''Xbee 20-pin Header''||''Name''||''Notes''||''Suggested Color''||&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| +3.3v&lt;br /&gt;
| Power&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|DOUT&lt;br /&gt;
|Tx output - connect to Autopilot Rx&lt;br /&gt;
|Green&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|DIN&lt;br /&gt;
|Rx input - connect to Autopilot Tx&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|GND&lt;br /&gt;
| Ground&lt;br /&gt;
|Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The image view is from above, top, thus NOT at the side where the connector pins come out&lt;br /&gt;
&lt;br /&gt;
Note : DTR and RTS need to be wired for upgrading firmware&lt;br /&gt;
&lt;br /&gt;
=== GCS Adaptation ===&lt;br /&gt;
&lt;br /&gt;
There are several vendors of hardware to connect the ground XBee radio modem to the GCS computer.&lt;br /&gt;
&lt;br /&gt;
====Adafruit====&lt;br /&gt;
&lt;br /&gt;
[[Image:xbeeadapter_LRG.jpg|thumb|left|Adafruit XBee adapter board]][[Image:xbeeadapterftdi_LRG.jpg|thumb|Adafruit XBee adapter with FTDI cable]]&lt;br /&gt;
[http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=29&amp;amp;products_id=126 Adafruit] offers a great adapter board kit for the Xbee modules that includes a 5-3.3V voltage regulator, power and activity LEDs, and pins to connect directly to your FTDI cable for $10!  Some assembly required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Droids====&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_Simple_Board.jpg|thumb|left|XBee Simple Board]]&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_USB_Board.jpg|thumb|left|XBee USB Board]]&lt;br /&gt;
&lt;br /&gt;
[http://www.droids.it/cmsvb4/content.php?143-990.001-XBee-Simple-Board XBee Simple Board]&lt;br /&gt;
&lt;br /&gt;
Simpler, lighter, smaller footprint, bit more expensive, comes assembled and tested. --GR&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://www.droids.it/cmsvb4/content.php?152-990.002-XBee-USB-Board XBee USB Board]&lt;br /&gt;
&lt;br /&gt;
For direct connection to USB (no FTDI cable required)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====PPZUAV====&lt;br /&gt;
&lt;br /&gt;
[[Image:FTDI_Utility_Board.jpg|thumb|left|FTDI Utility Board 1.0‎]]&lt;br /&gt;
&lt;br /&gt;
[https://mini.ppzuav.com/osc/product_info.php?cPath=13&amp;amp;products_id=111 ppzuav.com]&lt;br /&gt;
&lt;br /&gt;
FTDI Utility Board 1.0 (no FTDI cable required)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sparkfun====&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_Explorer_USB.jpg|thumb|left|XBee Explorer USB]]&lt;br /&gt;
&lt;br /&gt;
[http://www.sparkfun.com/products/8687 sparkfun.com]&lt;br /&gt;
&lt;br /&gt;
XBee Explorer USB (no FTDI cable required)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro DigiMesh / 802.15.4 (&amp;quot;Series 1&amp;quot;) ===&lt;br /&gt;
*Note: Products based on XBee ZNet 2.5 (formerly Series 2) modules do not communicate with products based on XBee DigiMesh / 802.15.4 (formerly Series 1) modules.&lt;br /&gt;
&lt;br /&gt;
These relatively cheap and light modules implement the [http://www.zigbee.org/en/index.asp ZigBee/IEEE 802.15.4] norm. They allow up to 1.6km (1 mile) range (Paparazzi tested to 2.5km (1.5 miles)). The main drawback of using such 2.4Ghz modules for datalink is that it will interfere with the 2.4Ghz analog video transmitters and a inevitable decrease in range when in proximity to any wifi devices. For the plane, get the whip antenna version if you are not planning to build a custom antenna.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:Xbee_Pro_USB_RF_Modem.jpg|thumb|left|XBee Pro USB Stand-alone Modem (XBP24-PKC-001-UA)]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 2.4Ghz&lt;br /&gt;
* Output Power 100mW (Xbee Pro)&lt;br /&gt;
* Sensitivity  -100 dBm &lt;br /&gt;
* RF Data Rate Up to 250 Kbps&lt;br /&gt;
* Interface data rate Up to 115.2 Kbps&lt;br /&gt;
* Power Draw (typical) 214 mA TX / 55 mA RX &lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 1500m line-of-sight &lt;br /&gt;
* Dimensions 24 x 33mm&lt;br /&gt;
* Weight 4 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Chip antenna, ¼ monopole integrated whip antenna or a U.FL antenna connector (3 versions)&lt;br /&gt;
* Price: Approximately $32&lt;br /&gt;
|&lt;br /&gt;
[[Image:XBee_pro.jpg|thumb|left|XBee Pro OEM Modem]]&lt;br /&gt;
|}&lt;br /&gt;
Mouser: [http://au.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtJacPDJcUJYzVn8vIv7g2fIpf5DCzJqko%3d 888-XBP24-PKC-001-UA]&amp;lt;br&amp;gt;&lt;br /&gt;
NOTE: If you wish to use this unit with another XBee type other than the 802.15.4 (i.e. XBee-PRO ZB) then purchase a modem with the U.fl connector.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/xbee-pro-oem-rf-module-zigbee.php  product page]&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/datasheet_XBee_OEM_RF-Modules.pdf  datasheet]&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/product-manual_XBee_OEM_RF-Modules.pdf  user manual]&lt;br /&gt;
* To program your Xbee you need X-CTU you can download it [http://www.digi.com/support/productdetl.jsp?pid=3352&amp;amp;osvid=57&amp;amp;tp=5&amp;amp;s=316 here]. (only windows)&lt;br /&gt;
* explanation on X-CTU [http://www.ladyada.net/make/xbee/configure.html here].&lt;br /&gt;
* [http://ftp1.digi.com/support/firmware/update/xbee/ Drivers for XB24 and XBP24 modules]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro ZB / ZNet 2.5 (&amp;quot;Series 2&amp;quot;) ===&lt;br /&gt;
&lt;br /&gt;
The low-power XBee ZB and extended-range XBee-PRO ZB use the ZigBee PRO Feature Set for advanced mesh networking.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:XBee_Pro_2SB.jpg|thumb|left|Digi XBee Pro ZB]]&lt;br /&gt;
|&lt;br /&gt;
* Low-cost, low-power mesh networking&lt;br /&gt;
* Interoperability with ZigBee PRO Feature Set devices from other vendors*&lt;br /&gt;
* Support for larger, more dense mesh networks&lt;br /&gt;
* 128-bit AES encryption&lt;br /&gt;
* Frequency agility&lt;br /&gt;
* Over-the-air firmware updates (change firmware remotely)&lt;br /&gt;
* ISM 2.4 GHz operating frequency&lt;br /&gt;
* XBee: 2 mW (+3 dBm) power output (up to 400 ft RF LOS range)&lt;br /&gt;
* XBee-PRO: 50 mW (+17 dBm) power output (up to 1 mile RF LOS range)&lt;br /&gt;
* RPSMA connector, U.FL connector, Chip antenna, or Wired Whip antenna&lt;br /&gt;
* price : ~34 USD&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
These are available from Mouser:&amp;lt;br&amp;gt;&lt;br /&gt;
[http://au.mouser.com/Search/Refine.aspx?Keyword=888-XBP24-Z7WIT-004 888-XBP24-Z7WIT-004] XBee-PRO ZB with whip antenna&amp;lt;br&amp;gt;&lt;br /&gt;
[http://au.mouser.com/Search/Refine.aspx?Keyword=XBP24-Z7SIT-004 888-XBP24-Z7SIT-004] XBee-PRO ZB with RPSMA&lt;br /&gt;
&lt;br /&gt;
See [[XBee_configuration|XBee Configuration]] for setup.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/zigbee-mesh/xbee-zb-module.jsp http://www.digi.com/products/wireless/zigbee-mesh/xbee-zb-module.jsp]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro 868 ===&lt;br /&gt;
&lt;br /&gt;
'''WARNING - THESE MODEMS HAVE A 10% DUTY CYCLE, AND CURRENTLY HAVE SEVERE ISSUES WITH PAPARAZZI'''&lt;br /&gt;
&lt;br /&gt;
868MHz is a limited band. Please read the [[868MHz Issues]]&lt;br /&gt;
&lt;br /&gt;
XBee-PRO 868 modules are long range embedded RF modules for European applications. Purpose-built for exceptional RF performance, XBee-PRO 868 modules are ideal for applications with challenging RF environments, such as urban deployments, or where devices are several kilometers apart.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:xbeeproxsc-rpsma.jpg|thumb|left|Maxstream XBee Pro 868]]&lt;br /&gt;
|&lt;br /&gt;
* 868 MHz short range device (SRD) G3 band for Europe&lt;br /&gt;
* Software selectable Transmit Power&lt;br /&gt;
* 40 km RF LOS w/ dipole antennas&lt;br /&gt;
* 80 km RF LOS w/ high gain antennas (TX Power reduced)&lt;br /&gt;
* Simple to use peer-to-peer/point-to-mulitpoint topology&lt;br /&gt;
* 128-bit AES encryption&lt;br /&gt;
* 500 mW EIRP&lt;br /&gt;
* 24 kbps RF data rate&lt;br /&gt;
* price : ~70 USD&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See [[XBee_configuration#XBee_Pro_868_MHZ|XBee Configuration]] for setup.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/point-multipoint/xbee-pro-868.jsp http://www.digi.com/products/wireless/point-multipoint/xbee-pro-868.jsp]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee 868LP ===&lt;br /&gt;
&lt;br /&gt;
XBee 868LP modules are a low-power 868 MHz RF module for use in Europe. The range is shorter than it's brother the XBee PRO-868, but it can use the 868 G4 band with hopping which does not have restrictions on it's duty cycle. This is a big advantage if one want to have a good stream of telemetry data&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:868lp.jpg|thumb|left|XBee 868LP]]&lt;br /&gt;
|&lt;br /&gt;
* 868 MHz short range device (SRD) G4 band for Europe&lt;br /&gt;
* 4 km RF LOS w/ u.fl antennas&lt;br /&gt;
* 5 mW EIRP&lt;br /&gt;
* 80 kbps RF data rate&lt;br /&gt;
* price : ~23 USD&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-868lp#overview http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-868lp#overview]&lt;br /&gt;
&lt;br /&gt;
==== Trial ====&lt;br /&gt;
&lt;br /&gt;
With a quickly crafted and not optimal positioned antenna on the airframe we managed to get the advertised 4000 meter range. Data throughput was not high and the Iridium Telemetry XML configuration document was therefore used. All in all, cheap, easy to setup, pin compatible with regular modules and quite a range and usable in Europe without hassle.&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro 900 (XBEE09P) ===&lt;br /&gt;
&lt;br /&gt;
XBee Pro 900 modules are long range embedded RF modules for US applications. Purpose-built for exceptional RF performance, XBee-Pro 900 modules are ideal for applications with challenging RF environments, such as urban deployments, or where devices are several kilometers apart.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [ftp://ftp1.digi.com/support/documentation/90000903_a.pdf]&lt;br /&gt;
&lt;br /&gt;
I've been using a pair of these for about 6 months now and they works great. To set it up I just used a serial terminal app like CoolTerm or screen and made sure I could send messages between the two of them. - cwozny&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro XSC 900MHz ===&lt;br /&gt;
&lt;br /&gt;
Maxstream has recently announced a promising new line of modems combining the small size and low cost of their popular Xbee line with the long range and 2.4 GHz video compatibility of their high end 900 MHz models.  Sounds like the perfect modem for anyone who can use 900 MHz.  Give them a try and post your results here!&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:xbeeproxsc-rpsma.jpg|thumb|left|Maxstream XBee Pro XSC]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 900 MHz&lt;br /&gt;
* Output Power 100 mW (+20 dBm)&lt;br /&gt;
* Sensitivity  -100 dBm &lt;br /&gt;
* Data Rate: 9600 bps&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 24km (15 miles) line-of-sight &lt;br /&gt;
* Interface 20-pin mini connector (Xbee compatible pinout)&lt;br /&gt;
* RPSMA, integrated whip antenna or U.FL antenna connector (3 versions)&lt;br /&gt;
* price : $39 USD (on DigiKey)&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/point-multipoint/xbee-pro-xsc.jsp http://www.digi.com/products/wireless/point-multipoint/xbee-pro-xsc.jsp]&lt;br /&gt;
==== Trials ====&lt;br /&gt;
Tested one today and it worked great. Going to try a multiUAV test with it soon&lt;br /&gt;
--Danstah&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
MultiUAV tests concluded this is probably not the best module to use. Even though it says you can change the baudrate inside x-ctu that is not the case, it is fixed at 9600 bps. This is a great modem however for single UAV's and I do recommend.&lt;br /&gt;
--Danstah&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Why would the European (868 MHz) be good to 24kbps and this only to 9600?  When I was altering my XBees (2.4Ghz Pro's) I had this problem altering baud rates until I read you have to send a &amp;quot;commit and reboot&amp;quot; type command after setting the baud rate. Could this be the case? --GR&lt;br /&gt;
&lt;br /&gt;
=== Digi 9XTend ===&lt;br /&gt;
&lt;br /&gt;
These larger units have been tested on the 900Mhz band, but are also available in 2.4Ghz.  They are a bit on the heavy side, about 20 grams, but give good performance at range. They have adjustable transmit power settings from 100mW to 1W.  Testing has shown range up to 5.6km (3.5 Miles) with XTend set to 100mW with small 3.1dB dipole antenna.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
[[Image:XTend_USB_RF_Modem.jpg|frame|left|9XTend USB Modem]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 900Mhz and 2.4Ghz (2 versions)&lt;br /&gt;
* Output Power 1mW to 1W software selectable&lt;br /&gt;
* Sensitivity  -110 dBm (@ 9600 bps)&lt;br /&gt;
* RF Data Rate 9.6 or 115.2 Kbps&lt;br /&gt;
* Interface data rate up to 230.4 Kbps&lt;br /&gt;
* Power Draw (typical) 730 mA TX / 80 mA RX &lt;br /&gt;
* Supply Voltage 2.8 to 5.5v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 64km line-of-sight &lt;br /&gt;
* Dimensions 36 x 60 x 5mm&lt;br /&gt;
* Weight 18 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* RF connector RPSMA (Reverse-polarity SMA) or MMCX (2 versions)&lt;br /&gt;
* price : ~179 USD&lt;br /&gt;
|&lt;br /&gt;
[[Image:Xtend_module.jpg|frame|left|9XTend OEM Modem]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Pinout ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Maxstream_9XTend_Pinout.gif|thumb|left|Maxstream 9XTend Pinout]]&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''9XTend 20-pin Header'''''||'''''Name'''''||'''''Tiny Serial-1 Header'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
||1||GND||1 (GND)||Ground &lt;br /&gt;
|-&lt;br /&gt;
||2||VCC||2 (5V)||5V power (150mA - 730mA Supplied from servo bus or other 5V source)&lt;br /&gt;
|-&lt;br /&gt;
||5||RX||8 (TX)||3-5V TTL data input - connect to Tiny TX&lt;br /&gt;
|-&lt;br /&gt;
||6||TX||7 (RX)||5V TTL data output - connect to Tiny RX&lt;br /&gt;
|-&lt;br /&gt;
||7||Shutdown||2||This pin must be connected to the 5V bus for normal operation&lt;br /&gt;
|}&lt;br /&gt;
Notes:&amp;lt;br&amp;gt;&lt;br /&gt;
* 9XTend can run on voltages as low as 2.8V but users are strongly advised against connecting any modem (especially high power models) to the sensitive 3.3V bus supplying the autopilot processor and sensors.&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/oem-rf-module.php product page]&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/datasheet_XTend_OEM_RF-Module.pdf datasheet]&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/product-manual_XTend_OEM_RF-Module.pdf user manual]&lt;br /&gt;
&lt;br /&gt;
==== Configuration ====&lt;br /&gt;
&lt;br /&gt;
These modems need to be carefully configured based on your usage scenario to obtain the best possible range and link quality. In addition, it is always good to make sure the firmware is up to date.&lt;br /&gt;
&lt;br /&gt;
Some typical configurations that may work well, but can still depend your particular situation, are given below. For further details, be sure to consult the XTend users manual. Your application may need a different or modified configuration. The radiomodems do not need identical settings and can in fact be optimized with different settings. A good example is delays and retries: if each radio has the same number of retries and no delay, when a collision occurs each will continuously try to re-transmit, locking up the transmission for some time with no resolution or successful packet delivery. Instead, it is best to set the module whose data should have a lower latency to have no delay and a lower number of retries, while the other module has a delay set (RN &amp;gt; 0) and a greater number of retries. See acknowledged mode example below.&lt;br /&gt;
&lt;br /&gt;
* Acknowledged Polling Mode ('''Recommended'''):&lt;br /&gt;
** This causes one radio to be the base and the other(s) to be the remote(s). It eliminates collisions because remotes do not send data unless requested by the base. It can work in acknowledged mode (RR&amp;gt;0), basic reliable mode (MT&amp;gt;0) or in basic mode (no acknowledgement or multiple packets). It is recommended that the lower latency and/or higher data rate side be configured as the base (i.e. if you are sending lots of telemetry then the air module configured as the base is probably a good idea, but if you are using datalink joystick control, the ground side might be better as the base. It may require some experimentation).&lt;br /&gt;
* Acknowledged Point-to-(Multi)Point Mode:&lt;br /&gt;
** Each radio sends a packet and requests and acknowledgement that the packet was sent from the receiving side. The retries and delays must be set appropriately to ensure packet collisions are dealt with appropriately. It can also work without acknowledgements in basic reliable mode (MT&amp;gt;0) without any acknowledgements (RR=0, MT=0). Some experimentation may be required.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''Setting Name'''''||colspan=&amp;quot;2&amp;quot;|'''''Acknowledged Mode'''''||colspan=&amp;quot;2&amp;quot;|'''''Polling Mode (Acknowledged)'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
|| ||'''''Airside Module'''''||'''''Groundside Module'''''||'''''Base Module'''''||'''''Remote Module'''''||&lt;br /&gt;
|-&lt;br /&gt;
||BD||6||6||6||6||Adjust to match your configured autopilot and ground station baud rates (default for these is 57600bps)&lt;br /&gt;
|-&lt;br /&gt;
||DT||default||default||0x02||0x01||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||MD||default||default||3 (0x03)||4 (0x04)||&lt;br /&gt;
|-&lt;br /&gt;
||MT||0||0||0||0||Use this to enable Basic Reliable transmission, link bandwidth requirement increases (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||MY||default||default||0x01||0x02||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PB||default||default||0x02||default||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PD||default||default||default||default||Can be adjusted to increase polling request rate and DI buffer flush timeout (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PE||default||default||0x02||default||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PL||default||default||default||default||''Transmit power level should be reduced for lab testing!!''&lt;br /&gt;
|-&lt;br /&gt;
||RN||0 (0x00)||8 (0x08)||default||default||&lt;br /&gt;
|-&lt;br /&gt;
||RR||6 (0x06)||12 (0x0C)||6 (0x06)||12 (0x0C)||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Note:''' All settings are assumed to be default except those listed. Those listed are in decimal unless hex 0x prefix included. Depending on your firmware version, slight modifications may be necessary.&lt;br /&gt;
&lt;br /&gt;
Here is some additional information and alternative instructions to configure the polling mode from the Digi site: [http://www.digi.com/support/kbase/kbaseresultdetl?id=2178 Polling Mode for the 9XTend Radio Modem]&lt;br /&gt;
&lt;br /&gt;
== SiLabs Si1000 SoC based modems ==&lt;br /&gt;
&lt;br /&gt;
The Si1000 radio System on Chip (SOC) produced by  SiLabs is found in a number of radio modules, for example the cheap and widely used HopeRf module. There is [https://github.com/tridge/SiK open source firmware] for these radios which makes them suitable for use in MAVs. &lt;br /&gt;
&lt;br /&gt;
Note that (unlike some XBee modules) the SiK firmware does not support mesh topologies, it is strictly a point-to-point link. If you are working with swarming vehicles they may not be the best choice.&lt;br /&gt;
&lt;br /&gt;
Online documentation for the Sik firmware shows how to configure it for various jurisdictions. The firmware supports 433 MHz, 470 MHz, 868 MHz and 900 MHz radios, if you are aware of any hardware supporting the European spectrum licences (868 MHz) please add them to this wiki.&lt;br /&gt;
&lt;br /&gt;
Note: When using a SiK firmware radio with paparazzi, you should set &amp;quot;ATS6=0&amp;quot; (MavLink packing off) and configure paparazzi for transparent serial mode.&lt;br /&gt;
&lt;br /&gt;
[http://www.rfdesign.com.au/index.php/rfd900 This module] is well proven and supports antenna diversity. A combination of 6dbi Yagi plus a dipole on the ground station, with a pair of  orthogonality oriented dioples in the airframe, has been extensively tested and proven reliable at &amp;gt;8km range (theoretical range of ~40km).&lt;br /&gt;
&lt;br /&gt;
Alternatively, for shorter range a pair of cheap generic HopeRF-based modems [http://rctimer.com/index.php?gOo=goods_details.dwt&amp;amp;goodsid=815 such as these]&lt;br /&gt;
&lt;br /&gt;
The RFD900 can be paired with cheap generic (single front-end) modules, if for example you use a small short range airframe with a ground station that's also used for long range operations.&lt;br /&gt;
&lt;br /&gt;
== Aerocomm ==&lt;br /&gt;
Aerocomm's API mode is already implemented but some system integration is required. Full API more with addressed packets works well and was tested with AC4790-1x1 5mW low power modules. Maximim range achieved with a whip quater-wave antenna was 1Km.&lt;br /&gt;
&lt;br /&gt;
How to use this modem on ground station side? [http://paparazzi.enac.fr/wiki/index.php/User:SilaS#SDK-AC4868-250_ground_modem_part]&lt;br /&gt;
&lt;br /&gt;
See folder paparazzi3 / trunk / sw / aerocomm. It has all the required files to use this modem on the airborne and ground station side. The link.ml file is a direct replacement of the &amp;quot;main&amp;quot; link.ml file of the ground sttaion and will be merged into it in the future.. or you can do it as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
=== AC4868-250 ===&lt;br /&gt;
* Frequency Band 868MHz (For Europe). 868MHz is a limited band. Please read the [[868MHz Issues]]&lt;br /&gt;
* Output Power (w/ 2dBi antenna) 250 mW &lt;br /&gt;
* Sensitivity (@ full RF data rate) -103 dB &lt;br /&gt;
* RF Data Rate Up to 28.8 Kbps &lt;br /&gt;
* INterface Data Rate Up to 57.6 Kbps &lt;br /&gt;
* Power Draw (typical) 240 mA TX / 36 mA RX &lt;br /&gt;
* Supply Voltage 3.3v &amp;amp; 5V or 3.3v only&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 15 kilometers line-of-sight &lt;br /&gt;
* Dimensions 49 x 42 x 5mm &lt;br /&gt;
* Weight &amp;lt; 21 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Antenna MMCX jack Connector &lt;br /&gt;
* price : ~80$&lt;br /&gt;
|&lt;br /&gt;
[[Image:ConnexLink_USB_RF_Modem.jpg|thumb|Aerocomm USB Stand-alone Modem]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
=== AC4790-200 ===&lt;br /&gt;
* Frequency 902-928MHz (North America, Australia, etc).&lt;br /&gt;
* Output Power 5-200mW&lt;br /&gt;
* Sensitivity (@ full RF data rate) -110dB&lt;br /&gt;
* RF Data Rate up to 76.8 Kbps&lt;br /&gt;
* INterface Data Rate Up to Up to 115.2 Kbps &lt;br /&gt;
* Power Draw (typical) 68 mA&lt;br /&gt;
* Supply Voltage 3.3v &amp;amp; 5.5V&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 6.4 kilometers line-of-sight &lt;br /&gt;
* Dimensions 42 x 48 x 5mm &lt;br /&gt;
* Weight &amp;lt; 20 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Antenna MMCX jack Connector or internal&lt;br /&gt;
* price : ~80$&lt;br /&gt;
|&lt;br /&gt;
[[Image:ac4868_transceiver.jpg|thumb|left|AC4868 OEM Modem]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
=== AC4790-1000 ===&lt;br /&gt;
* Frequency 902-928MHz (North America, Australia, etc).&lt;br /&gt;
* Output Power 5-1000mW&lt;br /&gt;
* Sensitivity (@ full RF data rate) -99dB&lt;br /&gt;
* RF Data Rate up to 76.8 Kbps&lt;br /&gt;
* INterface Data Rate Up to Up to 115.2 Kbps &lt;br /&gt;
* Power Draw (typical) 650 mA&lt;br /&gt;
* Supply Voltage 3.3V only&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 32 kilometers with high-gain antenna&lt;br /&gt;
* Dimensions 42 x 48 x 5mm &lt;br /&gt;
* Weight &amp;lt; 20 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Antenna MMCX jack Connector&lt;br /&gt;
* price : ~80$&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Pinout ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Aerocomm_AC4868_pinout.jpg|thumb|left|Aerocomm AC4868 modem pinout]]&lt;br /&gt;
[[Image:Aerocomm_AC4490-200_wired.jpg|thumb|left|Aerocomm AC4490 wiring example]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Wiring the Aerocomm AC4868 to the Tiny&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''AC4868 20-pin Header'''''||'''''Name'''''||'''''Color'''''||'''''Tiny v1.1 Serial-1'''''||'''''Tiny v2.11 Serial'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
||2||Tx||green||7||7||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||3||Rx||blue||8||8||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||5||GND||black||1||1|| -&lt;br /&gt;
|-&lt;br /&gt;
||10+11||VCC||red||2||3||+3.3v ''(Note 2)''&lt;br /&gt;
|-&lt;br /&gt;
||17||C/D||white||3||?||Low = Command High = Data&lt;br /&gt;
|}&lt;br /&gt;
''Note 1 : names are specified with respect to the AEROCOMM module''&lt;br /&gt;
&lt;br /&gt;
''Note 2 : AC4790-1000 needs pins 10 and 11 jumped to work properly''&lt;br /&gt;
&lt;br /&gt;
=== Documentation ===&lt;br /&gt;
* [http://www.aerocomm.com/rf_transceiver_modules/ac4790_mesh-ready_transceiver.htm AC4790 product page]&lt;br /&gt;
* [http://www.aerocomm.com/docs/Datasheet_AC4790_HI.pdf AC4790 Datasheet]&lt;br /&gt;
* [http://www.aerocomm.com/docs/User_Manual_AC4790.pdf AC4790 Manual]&lt;br /&gt;
* [http://www.aerocomm.com/rf_transceiver_modules/ac4868_868mhz_rf_transceiver.htm AC4848 product page]&lt;br /&gt;
* [http://www.aerocomm.com/docs/Datasheet_AC4868_HI.pdf AC4868 Datasheet]&lt;br /&gt;
* [http://www.aerocomm.com/docs/User_Manual_AC4868.pdf AC4868 user manual]&lt;br /&gt;
&lt;br /&gt;
== Laird (ex Aerocomm) ==&lt;br /&gt;
&lt;br /&gt;
=== Laird LT2510 ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Lt2510_prm123.jpg|thumb|LT2510 Modem]]&lt;br /&gt;
&lt;br /&gt;
* Frequency Band 2.4GHz&lt;br /&gt;
* Output Power 50mW (European version)&lt;br /&gt;
* Sensitivity  -98/-94 dBm &lt;br /&gt;
* RF Data Rate 280/500 kbps&lt;br /&gt;
* Interface data rate Up to 460800 kbps&lt;br /&gt;
* Power Draw (typical) 85mA TX / 10mA RX (European version)&lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 2400m line-of-sight (European version)&lt;br /&gt;
* Dimensions 24 x 33mm&lt;br /&gt;
* Weight 4 grams&lt;br /&gt;
* Interface 20-pin mini connector (solder pad or XBee compatible)&lt;br /&gt;
* Chip antenna, or a U.FL antenna connector&lt;br /&gt;
* Price: Approximately $31&lt;br /&gt;
&lt;br /&gt;
The LT2510 uses frequency hopping which needs a client/server model. That means that one modem (most appropriately the ground station modem) needs to be set to server mode. It will transmit a beacon message and have all client modems synchronize to that in a time and frequency hopping scheme manner. For that all modems need to have the same channel (in fact the hopping scheme) and system-id. Clients can be set to auto-channel and auto-system-id to follow any/the first visible server.&lt;br /&gt;
&lt;br /&gt;
All acknowledged messages transmitted need to be adressed to the non-changeable MAC address of the destination modem. There are is a way to automatically set destination adresses but this procedure does have drawbacks (see below).&lt;br /&gt;
&lt;br /&gt;
Make sure you short circuit &amp;quot;D1&amp;quot; if you use the Sparkfun WRL-09132 &amp;quot;XBee Explorer Regulated&amp;quot; adapter. The Laird does not have a pull-up resistor on DIN that Sparkfun assumes.&lt;br /&gt;
&lt;br /&gt;
==== Basic setup ====&lt;br /&gt;
&lt;br /&gt;
You can download a Windows configuration utility from [http://www.lairdtech.com/Products/Wireless-M2M-and-Telematics-Solutions/Proprietary-Radio-Modules/ here], click &amp;quot;Product Information&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 Set client to client mode (default).&lt;br /&gt;
 Set server to server mode.&lt;br /&gt;
&lt;br /&gt;
 Set speed on both modems to 57600 baud, the Paparazzi standard.&lt;br /&gt;
&lt;br /&gt;
 Choose RF profile with low speed (280kbps) for long range (default).&lt;br /&gt;
&lt;br /&gt;
===== Transparent mode =====&lt;br /&gt;
&lt;br /&gt;
The transparent mode is different from the XBee modems transparent mode. It will only allow two modems to communicate with each other.&lt;br /&gt;
&lt;br /&gt;
====== Transparent mode with hard coded address ======&lt;br /&gt;
&lt;br /&gt;
In this mode the destination MAC address is permanently set in the EEPROMs of the modems. Only these two modems can communicate with each other. The advantage of this mode is that other modems can not confuse the communication. You have to read out both modems MAC adresses as they are not printed on the case.&lt;br /&gt;
&lt;br /&gt;
 Set server MAC address in client&lt;br /&gt;
 Set client MAC address in server&lt;br /&gt;
&lt;br /&gt;
====== Transparent mode with auto-address ======&lt;br /&gt;
&lt;br /&gt;
The server will start emitting beacon messages and the client locks to these, starting to send messages to the servers MAC address. The server will then respond to that clients data messages. In this mode only one server can talk to one client. Any appearance of another server or client modem will confuse/disrupt the communication.&lt;br /&gt;
&lt;br /&gt;
 Set server to auto-destination.&lt;br /&gt;
 Set client to auto-destination and auto-destination-beacons-only.&lt;br /&gt;
&lt;br /&gt;
===== API mode =====&lt;br /&gt;
&lt;br /&gt;
We need at least a simple form of address resolution as the modems own (MAC) address can not be changed. This makes the ground station link and on-board software a little more complicated than the XBee API mode.&lt;br /&gt;
&lt;br /&gt;
 tbd&lt;br /&gt;
&lt;br /&gt;
== Radiotronix ==&lt;br /&gt;
These Radiotronix modems are used in transparent mode. Use the WI232EUR Evaluation Software for configuring the modems for the set speed. Connect /CMD and CTS for programming. The DTS version for the US market might cause severe interference with GPS reception, it is not recommended. For a nice ground station modem just add a FTDI232 USB-&amp;gt;serial cable, a 3.3V regulator with 100nF capacitors from supplies to ground, solder a SMA cable/connector and put it in a nice case. Make sure you only connect RTS to /CMD if you want to reprogram the modem with the Evaluation software (see the open jumper connection in the picture, green wire) and leave it floating otherwise as connected RTS/CTS sporadically leads to a reprogramming of the modem. The ANT-GXD105-FME/F from [http://www.roundsolutions.com Roundsolutions] was used as a ground station antenna at many competitions. Note that a 1/2 wave dipole antenna works best on-board as it doesn't require a ground-plane and has a reasonably omnidirectional radiation pattern.&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
=== WI232EUR ===&lt;br /&gt;
* Frequency Band: 868 MHz (for Europe)&lt;br /&gt;
* Output Power: 32 mW &lt;br /&gt;
* RF Data Rate: Up to 76.8 kbps &lt;br /&gt;
* Interface Data Rate: up to 115.2 kbps &lt;br /&gt;
* Power Draw (typical): 65 mA TX / 20 mA RX &lt;br /&gt;
* Supply Voltage: 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment): 500 meters line-of-sight &lt;br /&gt;
* Dimensions: 24 x 21 x 4mm &lt;br /&gt;
* Weight: ~2 grams&lt;br /&gt;
* Interface: solder connector  &lt;br /&gt;
* Antenna: solder connector &lt;br /&gt;
* Price: ~25$&lt;br /&gt;
|&lt;br /&gt;
[[Image:Wi232eur_wiring.jpg|thumb|WI232EUR Modem (picture shows connection to Tiny 1.1)]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
=== Pinout ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Wiring the WI232EUR to the Tiny v1.1&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''WI232 pins'''''||'''''Name'''''||'''''Tiny Serial-1'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
||6||TxD||7||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||5||RxD||8||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||15-18||GND||1|| - &lt;br /&gt;
|-&lt;br /&gt;
||19||VCC||2||+3.3v&lt;br /&gt;
|-&lt;br /&gt;
||4||/CMD||-||''(Note 2)''&lt;br /&gt;
|-&lt;br /&gt;
||7||CTS||-||''(Note 3)''&lt;br /&gt;
|}&lt;br /&gt;
''Note 1 : names are specified with respect to the Radiotronix module''&lt;br /&gt;
&lt;br /&gt;
''Note 2 : connect to RTS to program device with Evaluation software''&lt;br /&gt;
&lt;br /&gt;
''Note 3 : connect to CTS to program device with Evaluation software''&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
[[Image:Wi232eur_bopla.jpg|thumb|WI232EUR Modem in BOPLA case]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
=== Documentation ===&lt;br /&gt;
* [http://www.radiotronix.com/datasheets/new/eur_um.pdf WI232EUR data sheet]&lt;br /&gt;
* [http://www.radiotronix.com/datasheets/new/rk-eur_um.pdf WI232EUR user's manual]&lt;br /&gt;
* [http://www.radiotronix.com/downloads/software/EUR/setup.exe Evaluation software]&lt;br /&gt;
&lt;br /&gt;
== Bluetooth ==&lt;br /&gt;
These modems do not give you a great range but Bluetooth can be found in a lot of recent laptops built-in. Maybe not useful for fixed wing aircrafts it might be used for in-the-shop testing or quadcopters. Make sure you get a recent Class 1 EDR 2.0 stick if you buy one for your computer.&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
=== &amp;quot;Sparkfun&amp;quot; Roving Networks (WRL-08497) ===&lt;br /&gt;
* Frequency Band 2.4GHz&lt;br /&gt;
* Output Power 32 mW &lt;br /&gt;
* RF Data Rate up to ~300 kbps in SPP&lt;br /&gt;
* Interface Data Rate up to 921 kbps &lt;br /&gt;
* Power Draw (typical) 50 mA TX / 40 mA RX &lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) 100 meters line-of-sight &lt;br /&gt;
* Dimensions 26 x 13 x 2mm &lt;br /&gt;
* Weight ~1.5 grams&lt;br /&gt;
* Interface solder connector  &lt;br /&gt;
* price : ~45$&lt;br /&gt;
|&lt;br /&gt;
[[Image:roving_nw_wiring.jpg|thumb|Roving Networks modem wiring]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
To connect to it, get the MAC address of the bluetooth modem&lt;br /&gt;
&lt;br /&gt;
 me@mybox:~$ hcitool scan&lt;br /&gt;
 Scanning ...&lt;br /&gt;
        00:06:66:00:53:AD       FireFly-53AD&lt;br /&gt;
&lt;br /&gt;
either make a virtual connection to a Bluetooth serial port each time you connect&lt;br /&gt;
&lt;br /&gt;
 sudo rfcomm bind 0 00:06:66:00:53:AD&lt;br /&gt;
&lt;br /&gt;
or configure it once in /etc/bluetooth/rfcomm.conf&lt;br /&gt;
&lt;br /&gt;
 rfcomm0 {&lt;br /&gt;
   bind yes;&lt;br /&gt;
   device 00:06:66:00:53:AD;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
now you can use Bluetooth as '''/dev/rfcomm0''' with the Paparazzi 'link'. You might need to restart 'link' in case you get out of range and it disconnects (tbd). Set the Tiny serial speed to 115200 as the modules come preconfigured to that.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Coronis WaveCard ==&lt;br /&gt;
&lt;br /&gt;
These relatively inexpensive and light modules implement a Coronis proprietary protocol. Low power consumption - high latency - I would not recommend these modules mostly because of the low quality of the distribution and support. The documentation is rather poor and not easily available.&lt;br /&gt;
&lt;br /&gt;
'''Suport for these modems has been removed from the airborne code on Dec 10th, 2007.'''&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 400MHz, 868Mhz and 915MHz (3 versions)&lt;br /&gt;
* Output Power 25mW and 500mW (2 versions)&lt;br /&gt;
* Sensitivity  -110 dBm (@ 9600 bps)&lt;br /&gt;
* Data Rate 100 Kbps&lt;br /&gt;
* Power Draw (typical) 45mA (25mW), 450mA (500mW) TX / 15 mA RX &lt;br /&gt;
* Supply Voltage ...&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 1km (25mW) , 5km (500mW) line-of-sight &lt;br /&gt;
* Dimensions 30 x 28 x 7mm (25mW), 37 x 30 x 7mm (500mW)&lt;br /&gt;
* 50 ohm RF port for antenna connection&lt;br /&gt;
|&lt;br /&gt;
[[Image:wavecard.jpg|Coronis Wavecard]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Documentation ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.coronis-systems.com/produit.php?lang=EN&amp;amp;id=WCA  www.coronis-systems.com]&lt;br /&gt;
* [[Media:CS-COM-SPRD-WAVECARD-E03B.pdf|Wavecard datasheet]]&lt;br /&gt;
&lt;br /&gt;
== Telemetry via Video Transmitter==&lt;br /&gt;
&lt;br /&gt;
[[Image:video_tx_small.jpg|thumb|2.4GHz Video Transmitter]]&lt;br /&gt;
In order for the UAV to transmit video from an onboard camera, an analog video transmitter can be used.  These vary in power, and thus range, and run normally on 2.4Ghz.  Small UAVs can get about 600m of range from the 50mW version, and extended range can be achieved using units up to 1W.  Weight for these units varies from a couple grams to about 30 for the 1W with shielding.  Please check for your countries regulations on 2.4Ghz transmission, as each is different. &lt;br /&gt;
&lt;br /&gt;
It is possible to use the audio channel to send simple telemetry data to the groundstation. Uploading telemetry not possible via analog audio transmitter only.&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telemetry via Internet / Raspberry Pi==&lt;br /&gt;
!this is unter construction by NeoFromMatrix!&lt;br /&gt;
&lt;br /&gt;
Idead: &lt;br /&gt;
A Raspberry PI with UMTS stick is used as Modem, gcs is connected to the internet.&lt;br /&gt;
THis resoults in a unlimited range with limited height.&lt;br /&gt;
&lt;br /&gt;
ssh reverse serial tunnel is used --&amp;gt; reconnects if connection is lost, no problems with UMTS stick IP issue&lt;br /&gt;
Mostly UMTS USB stick don't have a own IP adress !&lt;br /&gt;
&lt;br /&gt;
current status: working on Raspberry Pi / UMTS stick connection&lt;br /&gt;
&lt;br /&gt;
Instructions:&lt;br /&gt;
* Setup the Raspberry with the standard image [http://www.raspberrypi.org/downloads|Take Raspbian &amp;quot;wheezy&amp;quot;|Raspbian download]&lt;br /&gt;
* Establish the connection between a UMTS stick and the Raspberry PI, it will take some time, this instructions are not complete ! [http://www.instructables.com/id/Raspberry-Pi-as-a-3g-Huawei-E303-wireless-Edima/step2/Download-and-setup-ppp-UMTSKeeper-and-Sakis3g/|Instructables site]&lt;br /&gt;
not tested yet:&lt;br /&gt;
*set up ssh tunnel [http://www.tunnelsup.com/tup/2013/05/08/raspberry-pi-phoning-home-using-a-reverse-remote-ssh-tunnel|ssh reverse serial tunnel]&lt;br /&gt;
*set up static ip of your gcs [http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html|static IP Ubuntu](or you use a Linux server with static ip, dynamic IP is a bit difficult)&lt;br /&gt;
* Maybe use a external UMTS antenna for better signal strengh (double bi quad)&lt;br /&gt;
&lt;br /&gt;
You can also use a Android Smartphone with USB thetering as connection between Raspberry Pi and the Internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Antennas ==&lt;br /&gt;
&lt;br /&gt;
Here are some examples of lightweight and efficient 868MHz antennas developped by the RF laboratory at ENAC.&lt;br /&gt;
[[Image:868mhz_twinstar_antenna_1.jpg|thumb|left|868MHz copper foil antenna attached to the aircraft tail]] &lt;br /&gt;
[[Image:868mhz_twinstar_antenna_2.jpg|thumb|left|868MHz copper foil antenna bottom view]] &lt;br /&gt;
[[Image:868mhz_ground_antenna.jpg|thumb|left|868MHz ground antenna]] &lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki page might give some ideas about antennas: http://en.wikipedia.org/wiki/Dipole_antenna&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=JSBSim&amp;diff=15504</id>
		<title>JSBSim</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=JSBSim&amp;diff=15504"/>
		<updated>2013-07-19T05:27:23Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
[http://jsbsim.org Jsbsim]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Debian Package ===&lt;br /&gt;
On Debian/Ubuntu you can install the paparazzi-jsbsim package.&lt;br /&gt;
 sudo apt-get install paparazzi-jsbsim&lt;br /&gt;
If you don't have that in your sources, see [[Installation/Linux#Adding_the_APT_repository]]&lt;br /&gt;
&lt;br /&gt;
=== From Source ===&lt;br /&gt;
Compile JSBSIM from source (with specified date to make sure it works and API hasn't changed)&lt;br /&gt;
  cvs -z3 -d:pserver:anonymous@jsbsim.cvs.sourceforge.net:/cvsroot/jsbsim co -D &amp;quot;12 Jun 2012&amp;quot; -P JSBSim &lt;br /&gt;
  cd JSBSim&lt;br /&gt;
  ./autogen.sh&lt;br /&gt;
  ./configure --enable-libraries --enable-shared --prefix=/opt/jsbsim&lt;br /&gt;
  make&lt;br /&gt;
  sudo make install&lt;br /&gt;
&lt;br /&gt;
If you want to install to a different location, change the ''prefix'' to your liking.&lt;br /&gt;
And you need to add a &amp;lt;tt&amp;gt;&amp;lt;makefile&amp;gt;&amp;lt;/tt&amp;gt; section to your airframe file and add the correct flags to point to the include files and libraries, depending on where it is installed.&lt;br /&gt;
&lt;br /&gt;
With the default installation to &amp;lt;tt&amp;gt;/usr/local/&amp;lt;/tt&amp;gt;, this would look like&lt;br /&gt;
  &amp;lt;makefile location=&amp;quot;after&amp;quot;&amp;gt;&lt;br /&gt;
    jsbsim.CFLAGS += -I/usr/local/include/JSBSim&lt;br /&gt;
    jsbsim.LDFLAGS += -L/usr/local/lib&lt;br /&gt;
  &amp;lt;/makefile&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On OSX ===&lt;br /&gt;
* Install the JSBSim libraries onto your system. This should already be installed with &amp;lt;tt&amp;gt;paparazzi-tools&amp;lt;/tt&amp;gt;, but if it isn't:&lt;br /&gt;
  &amp;lt;code&amp;gt;$ sudo port install jsbsim&amp;lt;/code&amp;gt;&lt;br /&gt;
It uses code from the cvs repo, so it should be the most up-to-date source.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
* If you get an error like &amp;quot;undefined reference to `pcre_compile'&amp;quot;, edit file conf/Makefile.jsbsim, look for the line that begins with LDFLAGS and add -lpcre, e.g.:&lt;br /&gt;
 LDFLAGS += $($(TARGET).LDFLAGS) -lpcre&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=15503</id>
		<title>NPS</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=15503"/>
		<updated>2013-07-19T05:25:11Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: /* Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
NPS is our advanced rotorcraft simulator with sensor models and uses [[JSBSim]] as FDM (FlightDynamicModel) to allow fairly complex airframes.&lt;br /&gt;
JSBSim can easily be replaced by the FDM of your choice.&lt;br /&gt;
&lt;br /&gt;
Fixedwing support can also be easily added as soon as someone actually wants to use it ;-)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
See [[Installation|installation of Paparazzi]], [[JSBSim]] and optionally [[FlightGear]].&lt;br /&gt;
&lt;br /&gt;
=== Configuration/Build ===&lt;br /&gt;
Add the ''nps'' target to your [[Rotorcraft Configuration|airframe]] with the fdm you want to use:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;nps&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;SIMULATOR&amp;quot; prefix=&amp;quot;NPS_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ACTUATOR_NAMES&amp;quot; value=&amp;quot;{&amp;amp;quot;front_motor&amp;amp;quot;, &amp;amp;quot;back_motor&amp;amp;quot;, &amp;amp;quot;right_motor&amp;amp;quot;, &amp;amp;quot;left_motor&amp;amp;quot;}&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;INITIAL_CONDITITONS&amp;quot; value=&amp;quot;&amp;amp;quot;reset00&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SENSORS_PARAMS&amp;quot; value=&amp;quot;&amp;amp;quot;nps_sensors_params_default.h&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also take a look at the example airframe ''conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml'' or use it for your first tests.&lt;br /&gt;
&lt;br /&gt;
The xml file with the JSBSim model of the aircraft is located in ''conf/simulator/jsbsim/aircraft/''&lt;br /&gt;
and needs to have the name of the aircraft postfixed with ''.xml''&lt;br /&gt;
(e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml])&lt;br /&gt;
&lt;br /&gt;
* ACTUATOR_NAMES: mapping of the motors defined in the [[Rotorcraft_Configuration#Motor_Mixing|MOTOR_MIXING section]] to the actuators in the JSBSim model (the order is important, also make sure that your motors in JSBSim spin in the same direction as your real ones)&lt;br /&gt;
* INITIAL_CONDITITONS: the xml file containing the initial conditions (location, attitude, wind) for JSBSim in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/reset00.xml reset00])&lt;br /&gt;
* SENSORS_PARAMS: the parameter file for the sensor simulation (noise/delay) under ''conf/simulator/nps/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/nps/nps_sensors_params_default.h nps_sensors_params_default.h])&lt;br /&gt;
&lt;br /&gt;
Then build the nps target...&lt;br /&gt;
&lt;br /&gt;
== Running the Simulation ==&lt;br /&gt;
Since paparazzi version ''v4.9_devel-425'' the most convenient way to start the simulation is via the ''Simulation'' session from the [[Paparazzi Center]].&lt;br /&gt;
Just select e.g. the Quad_LisaM_2 example airframe and start the ''Simulation'' session with the simulator, GCS and server.&lt;br /&gt;
&lt;br /&gt;
You can also start it via the generic simulation launcher:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sw/simulator/pprzsim-launch --aircraft Quad_LisaM_2 --type nps&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In earlier versions, start your tools (e.g. [[GCS]], [[server]] and messages) separately, then launch the nps simulator for your aircraft directly:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Options ===&lt;br /&gt;
Start the simulator with the ''--help'' option to list them all.&lt;br /&gt;
&lt;br /&gt;
* ''--ivy_bus'': Set ivy bus broadcast address to use (default 127.255.255.255, 224.255.255.255 on OSX)&lt;br /&gt;
* ''--rc_script'': Execute script with specified number to emulate RC input.&lt;br /&gt;
* ''--js_dev'': Use joystick for radio control (specify index, normally 0), also see [[NPS#Use_a_joystick]].&lt;br /&gt;
* ''--spektrum_dev'': Spektrum device to use for radio control (e.g. /dev/ttyUSB0)&lt;br /&gt;
* ''--fg_host'': Host for FlightGear visualization (e.g. 127.0.0.1)&lt;br /&gt;
* ''--fg_port'': Port on FlightGear host to connect to (Default: 5501)&lt;br /&gt;
* ''--fg_time_offset'': FlightGear time offset in seconds (e.g. 21600 for 6h), this is useful if it is currently night at the location you are flying and you want to add an offset to fly in daylight. (Since ''v4.9_devel_413-g9d55d6f)&lt;br /&gt;
&lt;br /&gt;
=== Typical Simulation ===&lt;br /&gt;
In general you go through the same steps as with the real aircraft:&lt;br /&gt;
* It should start on the ground and you have to wait a few seconds until the AHRS is aligned.&lt;br /&gt;
* If you have a (simulated) RC, you can now arm the motors and fly around in manual.&lt;br /&gt;
* To fly autonomously, make sure your ''AUTO2'' mode is ''NAV'', you can change it in the GCS-&amp;gt;settings-&amp;gt;system-&amp;gt;auto2.&lt;br /&gt;
** Switch to it if you are using an RC, otherwise you should already be in this mode.&lt;br /&gt;
** Arm your motors: either via the resurrect button or by going to the ''Start Motors'' block of the [[Flight Plans|Flight Plan]].&lt;br /&gt;
** Takeoff: via the takeoff button or the corresponding flight plan block.&lt;br /&gt;
* Do your stuff... :-)&lt;br /&gt;
&lt;br /&gt;
=== Pausing or running the sim at a different speed ===&lt;br /&gt;
If you start the simulation from a terminal, hit ''CTRL-z'' to pause it. You can then enter a different time factor (default 1.0) to make the simulation run slower or faster than real-time. Hit enter to resume the simulation or ''CTRL-z'' again to suspend it like any normal Unix process (use the ''fg'' (foreground) command to un-suspend it again).&lt;br /&gt;
&lt;br /&gt;
=== Use a Joystick ===&lt;br /&gt;
You can use a [[joystick]] (or connect your RC transmitter as a joystick) to control the quad in the simulator.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl -j&amp;lt;/source&amp;gt;&lt;br /&gt;
or, with a specific device index (0 is default):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --js_dev 0&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Joystick support uses the Simple DirectMedia Layer (SDL) library. Rather than specifying an input device name as one normally does on Linux, you just supply an index value (0, 1, 2,...) of the device you wish to use. Typically, the order of devices is the order in which you plugged them into your computer. The sim will display the name of the device being used to double check. If the &amp;lt;tt&amp;gt;-j&amp;lt;/tt&amp;gt; option is used with no argument, the sim defaults to using device on index 0 (which is usually correct if you have only one joystick attached).&lt;br /&gt;
&lt;br /&gt;
Also see [[Joystick#Calibration]].&lt;br /&gt;
&lt;br /&gt;
=== Visualization in [[FlightGear]] ===&lt;br /&gt;
[[FlightGear#Installation|Install]] and [[FlightGear#Using_FlightGear_for_Visualization|start flightgear]], e.g. with a quadrotor model:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;fgfs --fdm=null --native-gui=socket,in,30,,5501,udp --prop:/sim/model/path=Models/Aircraft/paparazzi/mikrokopter.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
restart your simulator with the ''--fg_host'' option:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
* If you get an error like &amp;quot;JSBSim failed to open the configuration file: (null)/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml&amp;quot;, you need to set your $PAPARAZZI_SRC and $PAPARAZZI_HOME environment variables. Add the following to your .bashrc, change paths according to where you put Paparazzi. Open a new terminal and launch the sim again.&lt;br /&gt;
 export PAPARAZZI_SRC=~/paparazzi&lt;br /&gt;
 export PAPARAZZI_HOME=~/paparazzi&lt;br /&gt;
&lt;br /&gt;
* If you did not install the jsbsim package your JSBSim installation under /opt/jsbsim will be used and you will have to set your library path (either in your shell startup file or when running the sim on the command line), e.g.:&lt;br /&gt;
 LD_LIBRARY_PATH=/opt/jsbsim/lib ./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;fatal error: gsl/gsl_rng.h: No such file or directory&amp;quot;, you need to install the GNU Scientific Library and corresponding development packages (libgsl).&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;undefined reference to `pcre_compile'&amp;quot;, edit file conf/Makefile.nps, look for the line that begins with LDFLAGS and add -lpcre, e.g.:&lt;br /&gt;
 LDFLAGS += $($(TARGET).LDFLAGS) -lpcre&lt;br /&gt;
&lt;br /&gt;
== Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Plot the value of a message field ===&lt;br /&gt;
Start the [[RTPlotter|real-time plotter]] tool menu of [[Paparazzi Center]] or with&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./sw/logalizer/plotter&amp;lt;/source&amp;gt;&lt;br /&gt;
for example drag the label 'int32 phi' from the ROTORCRAFT_FP message to the drawing area of the plotter&lt;br /&gt;
&lt;br /&gt;
* Use the datalink to change the telemetry mode&lt;br /&gt;
start 'settings' ( from the tool menu of paparazzi center) or with&lt;br /&gt;
  ./sw/ground_segment/tmtc/settings -ac Quad_LisaM_2&lt;br /&gt;
start 'server' to dispatch datalink messages ( from the tool menu of paparazzi center) or with&lt;br /&gt;
 ./sw/ground_segment/tmtc/server &lt;br /&gt;
change the field &amp;quot;telemetry&amp;quot; on the first page to &amp;quot;Att loop&amp;quot; and send by pressing the green check button. The label on the left or the drop box should change to &amp;quot;Att loop&amp;quot; confirming your message has been received. &amp;quot;message&amp;quot; should now show that the message &amp;quot;STAB_ATTITUDE_INT&amp;quot; is received&lt;br /&gt;
&lt;br /&gt;
=== Tuning the attitude control loop ===&lt;br /&gt;
Here we are going to use the simulator to demonstrate a way of tuning the attitude control loop.&lt;br /&gt;
&lt;br /&gt;
* Restart your previous session&lt;br /&gt;
* Set telemetry mode to &amp;quot;attitude_loop&amp;quot;&lt;br /&gt;
* Display two real time plotter windows&lt;br /&gt;
&lt;br /&gt;
In the first one, plot the field &amp;quot;m_phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_int&amp;quot; message. This is our estimation of roll angle.&lt;br /&gt;
On top of that, plot the field &amp;quot;phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_REF_INT&amp;quot; message. This is our reference roll angle, that is, the roll value we are trying to achieve.&lt;br /&gt;
&lt;br /&gt;
In the second plotter, plot the fields &amp;quot;delta_a_fb&amp;quot; and &amp;quot;delta_a_ff&amp;quot;. Those are respectively the feedback and feedforward part of our roll command. The sum of those two terms is what is used as roll command.The feedforward part is the part used to follow our trajectory and the feedback part is the part used to reject perturbations.&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;Settings&amp;quot;, go to the &amp;quot;Att Loop&amp;quot; tab&lt;br /&gt;
We notice that the vehicle doesn't follow the step trajectory we are trying to make him do accurately.&lt;br /&gt;
 &lt;br /&gt;
Start by setting the value of the proportional gain ('pgain_phi') to 1000 instead of 400. The vehicle now follows the trajectory faster but overshoots. To prevent that, increase the value of the derivative gain ('dgain p') from 300 to 700.&lt;br /&gt;
&lt;br /&gt;
If you look at the plotter where you're plotting the commands, you'll notice that during steps, the feedback command has to work hard. This means that our feedforward command is badly tuned, and namely not working hard enough. Increase the value of the feedforward gain ('ddgain p') from 300 to 540. You'll notice that now the feedback command has become marginal during the steps. This is the right value for the gain. Anything bigger will make the feedback command fight against the feedforward command during steps, anything smaller will make the feedback command have to complement the feedforward command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=15502</id>
		<title>NPS</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=NPS&amp;diff=15502"/>
		<updated>2013-07-19T05:20:17Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: troubleshoot missing libgsl&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
NPS is our advanced rotorcraft simulator with sensor models and uses [[JSBSim]] as FDM (FlightDynamicModel) to allow fairly complex airframes.&lt;br /&gt;
JSBSim can easily be replaced by the FDM of your choice.&lt;br /&gt;
&lt;br /&gt;
Fixedwing support can also be easily added as soon as someone actually wants to use it ;-)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
See [[Installation|installation of Paparazzi]], [[JSBSim]] and optionally [[FlightGear]].&lt;br /&gt;
&lt;br /&gt;
=== Configuration/Build ===&lt;br /&gt;
Add the ''nps'' target to your [[Rotorcraft Configuration|airframe]] with the fdm you want to use:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;target name=&amp;quot;nps&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;SIMULATOR&amp;quot; prefix=&amp;quot;NPS_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ACTUATOR_NAMES&amp;quot; value=&amp;quot;{&amp;amp;quot;front_motor&amp;amp;quot;, &amp;amp;quot;back_motor&amp;amp;quot;, &amp;amp;quot;right_motor&amp;amp;quot;, &amp;amp;quot;left_motor&amp;amp;quot;}&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;INITIAL_CONDITITONS&amp;quot; value=&amp;quot;&amp;amp;quot;reset00&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SENSORS_PARAMS&amp;quot; value=&amp;quot;&amp;amp;quot;nps_sensors_params_default.h&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also take a look at the example airframe ''conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml'' or use it for your first tests.&lt;br /&gt;
&lt;br /&gt;
The xml file with the JSBSim model of the aircraft is located in ''conf/simulator/jsbsim/aircraft/''&lt;br /&gt;
and needs to have the name of the aircraft postfixed with ''.xml''&lt;br /&gt;
(e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml])&lt;br /&gt;
&lt;br /&gt;
* ACTUATOR_NAMES: mapping of the motors defined in the [[Rotorcraft_Configuration#Motor_Mixing|MOTOR_MIXING section]] to the actuators in the JSBSim model (the order is important, also make sure that your motors in JSBSim spin in the same direction as your real ones)&lt;br /&gt;
* INITIAL_CONDITITONS: the xml file containing the initial conditions (location, attitude, wind) for JSBSim in ''conf/simulator/jsbsim/aircraft/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/jsbsim/aircraft/reset00.xml reset00])&lt;br /&gt;
* SENSORS_PARAMS: the parameter file for the sensor simulation (noise/delay) under ''conf/simulator/nps/'' (e.g. [https://github.com/paparazzi/paparazzi/blob/master/conf/simulator/nps/nps_sensors_params_default.h nps_sensors_params_default.h])&lt;br /&gt;
&lt;br /&gt;
Then build the nps target...&lt;br /&gt;
&lt;br /&gt;
== Running the Simulation ==&lt;br /&gt;
Since paparazzi version ''v4.9_devel-425'' the most convenient way to start the simulation is via the ''Simulation'' session from the [[Paparazzi Center]].&lt;br /&gt;
Just select e.g. the Quad_LisaM_2 example airframe and start the ''Simulation'' session with the simulator, GCS and server.&lt;br /&gt;
&lt;br /&gt;
You can also start it via the generic simulation launcher:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;sw/simulator/pprzsim-launch --aircraft Quad_LisaM_2 --type nps&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In earlier versions, start your tools (e.g. [[GCS]], [[server]] and messages) separately, then launch the nps simulator for your aircraft directly:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Options ===&lt;br /&gt;
Start the simulator with the ''--help'' option to list them all.&lt;br /&gt;
&lt;br /&gt;
* ''--ivy_bus'': Set ivy bus broadcast address to use (default 127.255.255.255, 224.255.255.255 on OSX)&lt;br /&gt;
* ''--rc_script'': Execute script with specified number to emulate RC input.&lt;br /&gt;
* ''--js_dev'': Use joystick for radio control (specify index, normally 0), also see [[NPS#Use_a_joystick]].&lt;br /&gt;
* ''--spektrum_dev'': Spektrum device to use for radio control (e.g. /dev/ttyUSB0)&lt;br /&gt;
* ''--fg_host'': Host for FlightGear visualization (e.g. 127.0.0.1)&lt;br /&gt;
* ''--fg_port'': Port on FlightGear host to connect to (Default: 5501)&lt;br /&gt;
* ''--fg_time_offset'': FlightGear time offset in seconds (e.g. 21600 for 6h), this is useful if it is currently night at the location you are flying and you want to add an offset to fly in daylight. (Since ''v4.9_devel_413-g9d55d6f)&lt;br /&gt;
&lt;br /&gt;
=== Typical Simulation ===&lt;br /&gt;
In general you go through the same steps as with the real aircraft:&lt;br /&gt;
* It should start on the ground and you have to wait a few seconds until the AHRS is aligned.&lt;br /&gt;
* If you have a (simulated) RC, you can now arm the motors and fly around in manual.&lt;br /&gt;
* To fly autonomously, make sure your ''AUTO2'' mode is ''NAV'', you can change it in the GCS-&amp;gt;settings-&amp;gt;system-&amp;gt;auto2.&lt;br /&gt;
** Switch to it if you are using an RC, otherwise you should already be in this mode.&lt;br /&gt;
** Arm your motors: either via the resurrect button or by going to the ''Start Motors'' block of the [[Flight Plans|Flight Plan]].&lt;br /&gt;
** Takeoff: via the takeoff button or the corresponding flight plan block.&lt;br /&gt;
* Do your stuff... :-)&lt;br /&gt;
&lt;br /&gt;
=== Pausing or running the sim at a different speed ===&lt;br /&gt;
If you start the simulation from a terminal, hit ''CTRL-z'' to pause it. You can then enter a different time factor (default 1.0) to make the simulation run slower or faster than real-time. Hit enter to resume the simulation or ''CTRL-z'' again to suspend it like any normal Unix process (use the ''fg'' (foreground) command to un-suspend it again).&lt;br /&gt;
&lt;br /&gt;
=== Use a Joystick ===&lt;br /&gt;
You can use a [[joystick]] (or connect your RC transmitter as a joystick) to control the quad in the simulator.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl -j&amp;lt;/source&amp;gt;&lt;br /&gt;
or, with a specific device index (0 is default):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --js_dev 0&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Joystick support uses the Simple DirectMedia Layer (SDL) library. Rather than specifying an input device name as one normally does on Linux, you just supply an index value (0, 1, 2,...) of the device you wish to use. Typically, the order of devices is the order in which you plugged them into your computer. The sim will display the name of the device being used to double check. If the &amp;lt;tt&amp;gt;-j&amp;lt;/tt&amp;gt; option is used with no argument, the sim defaults to using device on index 0 (which is usually correct if you have only one joystick attached).&lt;br /&gt;
&lt;br /&gt;
Also see [[Joystick#Calibration]].&lt;br /&gt;
&lt;br /&gt;
=== Visualization in [[FlightGear]] ===&lt;br /&gt;
[[FlightGear#Installation|Install]] and [[FlightGear#Using_FlightGear_for_Visualization|start flightgear]], e.g. with a quadrotor model:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;fgfs --fdm=null --native-gui=socket,in,30,,5501,udp --prop:/sim/model/path=Models/Aircraft/paparazzi/mikrokopter.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
restart your simulator with the ''--fg_host'' option:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
* If you get an error like &amp;quot;JSBSim failed to open the configuration file: (null)/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml&amp;quot;, you need to set your $PAPARAZZI_SRC and $PAPARAZZI_HOME environment variables. Add the following to your .bashrc, change paths according to where you put Paparazzi. Open a new terminal and launch the sim again.&lt;br /&gt;
 export PAPARAZZI_SRC=~/paparazzi&lt;br /&gt;
 export PAPARAZZI_HOME=~/paparazzi&lt;br /&gt;
&lt;br /&gt;
* If you did not install the jsbsim package your JSBSim installation under /opt/jsbsim will be used and you will have to set your library path (either in your shell startup file or when running the sim on the command line), e.g.:&lt;br /&gt;
 LD_LIBRARY_PATH=/opt/jsbsim/lib ./var/Quad_LisaM_2/nps/simsitl --fg_host 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
* If you get an error like &amp;quot;fatal error: gsl/gsl_rng.h: No such file or directory&amp;quot;, you need to install the GNU Scientific Library and corresponding development packages (libgsl).&lt;br /&gt;
&lt;br /&gt;
== Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Plot the value of a message field ===&lt;br /&gt;
Start the [[RTPlotter|real-time plotter]] tool menu of [[Paparazzi Center]] or with&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;./sw/logalizer/plotter&amp;lt;/source&amp;gt;&lt;br /&gt;
for example drag the label 'int32 phi' from the ROTORCRAFT_FP message to the drawing area of the plotter&lt;br /&gt;
&lt;br /&gt;
* Use the datalink to change the telemetry mode&lt;br /&gt;
start 'settings' ( from the tool menu of paparazzi center) or with&lt;br /&gt;
  ./sw/ground_segment/tmtc/settings -ac Quad_LisaM_2&lt;br /&gt;
start 'server' to dispatch datalink messages ( from the tool menu of paparazzi center) or with&lt;br /&gt;
 ./sw/ground_segment/tmtc/server &lt;br /&gt;
change the field &amp;quot;telemetry&amp;quot; on the first page to &amp;quot;Att loop&amp;quot; and send by pressing the green check button. The label on the left or the drop box should change to &amp;quot;Att loop&amp;quot; confirming your message has been received. &amp;quot;message&amp;quot; should now show that the message &amp;quot;STAB_ATTITUDE_INT&amp;quot; is received&lt;br /&gt;
&lt;br /&gt;
=== Tuning the attitude control loop ===&lt;br /&gt;
Here we are going to use the simulator to demonstrate a way of tuning the attitude control loop.&lt;br /&gt;
&lt;br /&gt;
* Restart your previous session&lt;br /&gt;
* Set telemetry mode to &amp;quot;attitude_loop&amp;quot;&lt;br /&gt;
* Display two real time plotter windows&lt;br /&gt;
&lt;br /&gt;
In the first one, plot the field &amp;quot;m_phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_int&amp;quot; message. This is our estimation of roll angle.&lt;br /&gt;
On top of that, plot the field &amp;quot;phi&amp;quot; from the &amp;quot;STAB_ATTITUDE_REF_INT&amp;quot; message. This is our reference roll angle, that is, the roll value we are trying to achieve.&lt;br /&gt;
&lt;br /&gt;
In the second plotter, plot the fields &amp;quot;delta_a_fb&amp;quot; and &amp;quot;delta_a_ff&amp;quot;. Those are respectively the feedback and feedforward part of our roll command. The sum of those two terms is what is used as roll command.The feedforward part is the part used to follow our trajectory and the feedback part is the part used to reject perturbations.&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;Settings&amp;quot;, go to the &amp;quot;Att Loop&amp;quot; tab&lt;br /&gt;
We notice that the vehicle doesn't follow the step trajectory we are trying to make him do accurately.&lt;br /&gt;
 &lt;br /&gt;
Start by setting the value of the proportional gain ('pgain_phi') to 1000 instead of 400. The vehicle now follows the trajectory faster but overshoots. To prevent that, increase the value of the derivative gain ('dgain p') from 300 to 700.&lt;br /&gt;
&lt;br /&gt;
If you look at the plotter where you're plotting the commands, you'll notice that during steps, the feedback command has to work hard. This means that our feedforward command is badly tuned, and namely not working hard enough. Increase the value of the feedforward gain ('ddgain p') from 300 to 540. You'll notice that now the feedback command has become marginal during the steps. This is the right value for the gain. Anything bigger will make the feedback command fight against the feedforward command during steps, anything smaller will make the feedback command have to complement the feedforward command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Installation/Manual&amp;diff=15476</id>
		<title>Installation/Manual</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Installation/Manual&amp;diff=15476"/>
		<updated>2013-07-11T19:12:42Z</updated>

		<summary type="html">&lt;p&gt;Alonsoac: mention patch needed in xml-light 2.2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Installation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
'''Users of recent Debian/Ubuntu distributions are advised to use the binary packages as described in [[Installation/Linux]].'''&lt;br /&gt;
&lt;br /&gt;
Users of other Linux flavors or anyone needing manual control of each individual package can install them independently.  The list of dependencies of the Debian package is located in the [https://github.com/paparazzi/paparazzi-portability-support/blob/master/linux/paparazzi-dev/debian/control &amp;lt;tt&amp;gt;debian/control&amp;lt;/tt&amp;gt;] file and may help users of other distributions.&lt;br /&gt;
&lt;br /&gt;
Some corresponding source tarballs can be downloaded from [https://launchpad.net/~paparazzi-uav/+archive/ppa/+packages paparazzi-uav ppa] on launchpad.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For distributions using RPM packaging, the [http://packages.debian.org/unstable/source/alien alien] tool can be used to translate a .deb package into a .rpm package.&lt;br /&gt;
&lt;br /&gt;
For Fedora (Core8) users, you can install the following packages from standard repository:&lt;br /&gt;
* ocaml.i386&lt;br /&gt;
* ocaml-camlimages-devel.i386&lt;br /&gt;
* ocaml-lablgtk-devel.i386&lt;br /&gt;
* ocaml-xml-light-devel.i386&lt;br /&gt;
* boa.i386&lt;br /&gt;
* libgnomecanvas-devel.i386&lt;br /&gt;
* libusb-devel.i386&lt;br /&gt;
* pcre-devel.i386&lt;br /&gt;
* arm-gp2x-linux-gcc.i386&lt;br /&gt;
* arm-gp2x-linux-binutils.i386&lt;br /&gt;
* glade2.i386&lt;br /&gt;
* and gcc, make, subversion, gnuplot, imagemagik...&lt;br /&gt;
&lt;br /&gt;
Note that ocaml-xml-light version 2.2 in its official source release and in some distribution packages requires a patch in order to function properly with paparazzi. Find patch [https://github.com/OCamlPro/opam-repository/blob/master/packages/xml-light.2.2/files/fix_dtd_trace.patch here].&lt;br /&gt;
&lt;br /&gt;
Then you need [http://packages.debian.org/unstable/source/alien alien] tool to convert packages from the paparazzi repository:&lt;br /&gt;
* ivy-c&lt;br /&gt;
* ivy-c-dev&lt;br /&gt;
* ivy-ocaml (WARNING: debian and fedora have different path for ocaml (/usr/lib/ocaml/&amp;lt;version&amp;gt; vs. /usr/lib/ocaml), so you need to move by hand the files in /usr/lib/ocaml/&amp;lt;version&amp;gt; to /usr/lib/ocaml)&lt;br /&gt;
* lpc21isp&lt;br /&gt;
&lt;br /&gt;
These Ivy binary packages will only work with the corresponding version of ocaml. Ivy repository is located [http://www.eei.cena.fr/products/ivy/download/packages/ here].&lt;br /&gt;
&lt;br /&gt;
== Using 32Bit on 64Bit ==&lt;br /&gt;
&lt;br /&gt;
If you want to run the 32bit versions on a 64bit machine for whatever reason...&lt;br /&gt;
&lt;br /&gt;
In these cases, a chroot is a good compromise, while avoiding the overhead of a virtual machine (and USB device problems which may occur).&lt;br /&gt;
Initial instructions are here for now: https://help.ubuntu.com/community/DebootstrapChroot&lt;br /&gt;
The command you use for the bootstrap needs to reflect your architecture - I used&lt;br /&gt;
&lt;br /&gt;
  sudo debootstrap --variant=buildd --arch i386 lucid /var/chroot/lucid http://gb.archive.ubuntu.com/ubuntu/&lt;br /&gt;
&lt;br /&gt;
The format for schroot config files has changed as of lucid however - here is mine:&lt;br /&gt;
&lt;br /&gt;
  $ cat /etc/schroot/chroot.d/lucid-i386 &lt;br /&gt;
  [lucid]&lt;br /&gt;
  description=Ubuntu 10.04 Lucid for i386&lt;br /&gt;
  directory=/var/chroot/lucid&lt;br /&gt;
  personality=linux32&lt;br /&gt;
  root-users=my_user&lt;br /&gt;
  type=directory&lt;br /&gt;
  users=my_user&lt;br /&gt;
&lt;br /&gt;
Once you've installed the ubuntu minimal package, make sure you also enable the uni- and multiverse repos (the easiest way for me is to simply copy my host's /etc/apt/sources.lst to /var/chroot/lucid/etc/apt/sources.lst).&lt;br /&gt;
Then follow the standard instructions above.  You may need to manually set the PAPARAZZI_HOME and PAPARAZZI_SRC environment variables. You will also have to set the DISPLAY environment variable to :0.0 like so:&lt;br /&gt;
&lt;br /&gt;
  export DISPLAY=:0.0&lt;br /&gt;
&lt;br /&gt;
Please note, this is more advanced than the standard paparazzi installation and therefore you may encounter strange problems.&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]] [[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Alonsoac</name></author>
	</entry>
</feed>