<?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=Timo</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=Timo"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Timo"/>
	<updated>2026-04-17T17:00:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5432</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5432"/>
		<updated>2009-09-02T01:44:54Z</updated>

		<summary type="html">&lt;p&gt;Timo: /* Airframe integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Example.jpg|thumb|right|float|Connected current sensor to the Twog]]&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
In the BAT section of the airframe file add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and remove the line:&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MILLIAMP_AT_FULL_THROTTLE&amp;quot; value=&amp;quot;4000&amp;quot; unit=&amp;quot;mA&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
In the makefile section following lines must set to you needs (ADC_0 - ADC_2 are in use for IR sensors):&lt;br /&gt;
&lt;br /&gt;
  ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3&lt;br /&gt;
  ap.srcs += $(SRC_ARCH)/adc_hw.c&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message. Use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5431</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5431"/>
		<updated>2009-09-01T22:50:22Z</updated>

		<summary type="html">&lt;p&gt;Timo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Example.jpg|thumb|right|float|Connected current sensor to the Twog]]&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message. Use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Airframe_Configuration&amp;diff=5430</id>
		<title>Airframe Configuration</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Airframe_Configuration&amp;diff=5430"/>
		<updated>2009-09-01T21:54:05Z</updated>

		<summary type="html">&lt;p&gt;Timo: /* Bat */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The airframe configuration file is located in &amp;lt;tt&amp;gt;conf/airframes&amp;lt;/tt&amp;gt; and contains&lt;br /&gt;
all the hardware and software settings for an aircraft. This is an [http://en.wikipedia.org/wiki/Xml XML] document containing some [http://en.wikipedia.org/wiki/Makefile Makefile] code at the bottom. All gains, trims, and behavior settings are defined with standard XML elements. The hardware definitions such as processor type, modem protocol, servo driver, etc. are contained in the makefile raw section.&lt;br /&gt;
&lt;br /&gt;
== Selecting the Airframe File ==&lt;br /&gt;
Each airframe file must be assigned a name, unique ID, flight plan, etc. in [[Conf.xml|&amp;lt;tt&amp;gt;conf/conf.xml&amp;lt;/tt&amp;gt;]] as follows:&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;conf&amp;gt;&lt;br /&gt;
  &amp;lt;aircraft &lt;br /&gt;
    name=&amp;quot;Twin1&amp;quot;&lt;br /&gt;
    ac_id=&amp;quot;1&amp;quot;&lt;br /&gt;
    airframe=&amp;quot;airframes/twinstar1.xml&amp;quot; &lt;br /&gt;
    radio=&amp;quot;radios/mc3030.xml&amp;quot; &lt;br /&gt;
    flight_plan=&amp;quot;flight_plans/mav05_cw.xml&amp;quot;&lt;br /&gt;
    telemetry=&amp;quot;telemetry/default.xml&amp;quot;&lt;br /&gt;
    gui_color=&amp;quot;blue&amp;quot;&lt;br /&gt;
  /&amp;gt;&lt;br /&gt;
  &amp;lt;aircraft &lt;br /&gt;
    name=&amp;quot;Plaster&amp;quot;&lt;br /&gt;
    ac_id=&amp;quot;2&amp;quot;&lt;br /&gt;
    airframe=&amp;quot;airframes/plaster1.xml&amp;quot; &lt;br /&gt;
    radio=&amp;quot;radios/cockpitMM.xml&amp;quot; &lt;br /&gt;
    telemetry=&amp;quot;telemetry/default.xml&amp;quot;&lt;br /&gt;
    flight_plan=&amp;quot;flight_plans/dummy.xml&amp;quot;&lt;br /&gt;
  /&amp;gt;&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  &amp;lt;/conf&amp;gt;&lt;br /&gt;
Then, to compile and flash the airframe settings and associated flight plan to your autopilot, simply select the appropriate A/C and target in the [[Paparazzi_Center|Paparazzi Center]] or specify your airframe name in the flash command typed from the prompt:&lt;br /&gt;
 make AIRCRAFT=&amp;lt;b&amp;gt;Twin1&amp;lt;/b&amp;gt; ap.upload&lt;br /&gt;
More information can be found on the [[Conf.xml|conf.xml]] page&lt;br /&gt;
&lt;br /&gt;
== XML Parameters ==&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. In our example, we have only three:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;commands&amp;gt;&lt;br /&gt;
  &amp;lt;axis name=&amp;quot;THROTTLE&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;PITCH&amp;quot;    failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/commands&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
Each command is associated with a failsafe value which will be used if no controller is active (during initialization for example). The range of these values is [-9600:9600]. Note that these commands do not necessarily match the servo actuators. For example, the ROLL command is typically linked to two aileron actuators.&lt;br /&gt;
&lt;br /&gt;
=== Servos ===&lt;br /&gt;
&lt;br /&gt;
The above commands get translated to the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;servos&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; here.  In this example we use two ailevons (surfaces used for both pitch and roll as on a flying wing) and a motor. These are listed in the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;servos&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; section:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;servos&amp;gt;&lt;br /&gt;
  &amp;lt;servo name=&amp;quot;THROTTLE&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;AILEVON_LEFT&amp;quot;  no=&amp;quot;1&amp;quot; min=&amp;quot;2000&amp;quot; neutral=&amp;quot;1500&amp;quot; max=&amp;quot;1000&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;servo name=&amp;quot;AILEVON_RIGHT&amp;quot; no=&amp;quot;2&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;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where names are associated to the corresponding servo channel number on the autopilot and the neutral value, total range and direction are defined.  Min/max/neutral values are expressed in milliseconds and the direction of travel can be reversed by exchanging min with max (as in &amp;lt;tt&amp;gt;&amp;quot;AILEVON_LEFT&amp;quot;&amp;lt;/tt&amp;gt;, above).  The ''standard'' travel for a hobby servo is 1000ms - 2000ms with a 1500ms neutral.  Trim can be added by changing this neutral value, and absolute travel limits can be increased or reduced with the min/max values.  The &amp;lt;tt&amp;gt;&amp;quot;THROTTLE&amp;quot;&amp;lt;/tt&amp;gt; servo typically has the same value for the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;neutral&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;min&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt;.  Note the following tips:&lt;br /&gt;
* Reverse the servo direction by exchanging min/max&lt;br /&gt;
* Trim should always be adjusted mechanically if possible to avoid asymetrical travel&lt;br /&gt;
* Any reduction of the total travel range should be done mechanically to maintain precision&lt;br /&gt;
* Many servos will respond well to values slightly outside the normal 1000-2000ms range but experiment carefully as the servo may not operate reliably outside this range and may even suffer permanent damage.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;servos&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; are then linked to the commands in the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;command_laws&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; section:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;command_laws&amp;gt;&lt;br /&gt;
  &amp;lt;let var=&amp;quot;aileron&amp;quot;         value=&amp;quot;@ROLL  * 0.3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;let var=&amp;quot;elevator&amp;quot;        value=&amp;quot;@PITCH * 0.7&amp;quot;/&amp;gt;  &lt;br /&gt;
  &amp;lt;set servo=&amp;quot;THROTTLE&amp;quot;      value=&amp;quot;@THROTTLE&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;set servo=&amp;quot;AILEVON_LEFT&amp;quot;  value=&amp;quot;$elevator + $aileron&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;set servo=&amp;quot;AILEVON_RIGHT&amp;quot; value=&amp;quot;$elevator - $aileron&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/command_laws&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
[[Image:airframe_sign_conventions.jpg|thumb|Sign conventions for flight dynamics]]&lt;br /&gt;
where the third line is the simplest: the throttle servo value equals throttle command value. The other lines define and control the pitch/roll mixing.  Ailevon values are computed with a combination of two commands, '''ROLL''' and '''PITCH'''. This ''mixer'' is defined with two intermediate variables '''aileron''' and '''elevator''' introduced with the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;let&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; element.  The '''@''' symbol is used to reference a command value in the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;value&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; attribute of the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;set&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;let&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; elements.  In the above example, the servos are limited to +/- 70% of their full travel for pitch and 30% for roll, only in combination can the servos reach 100% deflection.  Note that these numbers ''should add up 100% or more, never less''.  For example, you may want 100% travel available for pitch - this means if a roll is commanded along with maximum pitch only one servo will respond to the roll command as the other has already reached its mechanical limit.  If you find after tuning that these numbers add to less than 100% consider reducing the surface travel mechanically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that the signs used in the description follow the standard convention.&lt;br /&gt;
&lt;br /&gt;
=== Manual ===&lt;br /&gt;
The &amp;lt;tt&amp;gt;rc_command&amp;lt;/tt&amp;gt; sections links the channels of the RC transmitter (defined in the [[Radio_Control|Radio Control]] file) to the &amp;lt;tt&amp;gt;commands&amp;lt;/tt&amp;gt; defined above:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;rc_commands&amp;gt;&lt;br /&gt;
   &amp;lt;set command=&amp;quot;THROTTLE&amp;quot; value=&amp;quot;@THROTTLE&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;set command=&amp;quot;ROLL&amp;quot;     value=&amp;quot;@ROLL&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;set command=&amp;quot;PITCH&amp;quot;    value=&amp;quot;@PITCH&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/rc_commands&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example looks trivial since the channel values have the same name than the commands.&lt;br /&gt;
&lt;br /&gt;
=== Autopilot Only Commands ===&lt;br /&gt;
For certain missions it might be required to control servos (payload) from the autopilot (gcs) at all times (even during manual flight). These commands should not be in the &amp;lt;rc_commands&amp;gt; block but in the special &amp;lt;ap_only_commands&amp;gt; block. This allows for instance the pantilt operator to keep working when in manual flight, or safety logic to automatically close cameras below a certain altitude during manual landings.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;ap_only_commands&amp;gt;&lt;br /&gt;
   &amp;lt;copy command=&amp;quot;PAN&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;copy command=&amp;quot;TILT&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;copy command=&amp;quot;SHOOT&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/ap_only_commands&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Auto1 ===&lt;br /&gt;
The next section, named &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;AUTO1&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt;, gives the maximum roll and pitch (in radians) allowed for the augmented stability mode.&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;AUTO1&amp;quot; prefix=&amp;quot;AUTO1_&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MAX_ROLL&amp;quot; value=&amp;quot;RadOfDeg(35)&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MAX_PITCH&amp;quot; value=&amp;quot;RadOfDeg(35)&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADC === &lt;br /&gt;
In the &amp;quot;adc&amp;quot; section, you will find the conformity between arguments and their assigned pins on the autopilot board.&lt;br /&gt;
 &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
'''Important note''': To ''activate'' an ADC entry, a flag must be defined in the &amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt; section. For the previous example, we would have to write:&lt;br /&gt;
&lt;br /&gt;
 ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2&lt;br /&gt;
 ap.srcs += $(SRC_ARCH)/adc_hw.c&lt;br /&gt;
&lt;br /&gt;
==== ADC Generic ====&lt;br /&gt;
&lt;br /&gt;
In addition, if you want to receive the value of some ADC channel, you can use the &amp;quot;ADC Generic&amp;quot; service. When activated, the aircraft sends 2 values corresponding to the selected ADC channels. They can be read from the &amp;quot;Messages&amp;quot; application.&lt;br /&gt;
  ap.CFLAGS += -DUSE_ADC_GENERIC -DUSE_ADC_3 -DADC_CHANNEL_GENERIC1=ADC_3 -DUSE_ADC_4 -DADC_CHANNEL_GENERIC2=ADC_4&lt;br /&gt;
  ap.srcs += adc_generic.c&lt;br /&gt;
In this example, the ADC channels 3 and 4 are read and sent by telemetry at 4Hz:&lt;br /&gt;
  &amp;lt;message name=&amp;quot;ADC_GENERIC&amp;quot; ID=&amp;quot;18&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;field name=&amp;quot;val1&amp;quot; type=&amp;quot;uint16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;field name=&amp;quot;val2&amp;quot; type=&amp;quot;uint16&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/message&amp;gt;&lt;br /&gt;
Only two channels can be defined. If only one is activated, 0 will send for the second value.&lt;br /&gt;
&lt;br /&gt;
=== Infrared === &lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;INFRARED&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; section describes the configuration of the infrared sensors.&lt;br /&gt;
&lt;br /&gt;
The first definitions are relative to the electronic neutral of the sensors (a sensor here is a '''pair''' of thermopiles). A perfect sensor should give 512 if it measures the same value on both sides.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;section name=&amp;quot;INFRARED&amp;quot; prefix=&amp;quot;IR_&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;ADC_IR1_NEUTRAL&amp;quot; value=&amp;quot;512&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;ADC_IR2_NEUTRAL&amp;quot; value=&amp;quot;512&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;ADC_TOP_NEUTRAL&amp;quot; value=&amp;quot;512&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These neutrals are tuned with the &amp;quot;cupboard test&amp;quot;: Put the sensor in a close box (a cupboard) and read the values of the IR_SENSORS message (ir1, ir2 and vertical). Set the neutrals (they are subtracted from the measurement) to get null values. E.g. if you read 5 for the ir1 value with ADC_IR1_NEUTRAL equal to 512, change the latter to 517.&lt;br /&gt;
&lt;br /&gt;
The next lines define the installation of the horizontal and vertical sensors. The vertical sensor must  give a positive value when the temperature under the aircraft is higher than the temperature above. The two channels of the horizontal sensor must give positive values when it is warmer on the right side and the rear side. To adjust these signs, use the following declarations:&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;define name=&amp;quot;IR1_SIGN&amp;quot; value=&amp;quot;-1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;IR2_SIGN&amp;quot; value=&amp;quot;-1&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;TOP_SIGN&amp;quot; value=&amp;quot;-1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, define how the horizontal sensor is connected to the airframe, orientation '''aligned''' or '''tilted'''. In the aligned case, ir'''1''' is along the lateral axis (The axis that passes through the plane from wingtip to wingtip) and ir'''2''' along the longitudinal one. In the '''tilted''' case, the sensors are tilted by 45 degrees; ir'''1''' is along rear-left -- front-right, and ir'''2''' along rear-right -- front-left. The parameter &amp;quot;value&amp;quot; has no effect! If the airframe construction allows choose an aligned sensor orientation since this gives the best stabilization response results.&lt;br /&gt;
&lt;br /&gt;
For help with orientation of '''Previous Versions of Infrared Sensor Boards''' try here : http://paparazzi.enac.fr/wiki/Previous_Infrared_Sensors&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;define name=&amp;quot;HORIZ_SENSOR_ALIGNED&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
  or&lt;br /&gt;
   &amp;lt;define name=&amp;quot;HORIZ_SENSOR_TILTED&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three axis must give similar values for similar contrasts. The following factors can be used to scale these values. For example with an horizontal tilted sensor, the following ratios are usually needed:&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;define name=&amp;quot;LATERAL_CORRECTION&amp;quot; value=&amp;quot;0.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;LONGITUDINAL_CORRECTION&amp;quot; value=&amp;quot;0.7&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;VERTICAL_CORRECTION&amp;quot; value=&amp;quot;1.&amp;quot;/&amp;gt;&lt;br /&gt;
Default values are 1.&lt;br /&gt;
&lt;br /&gt;
It may be hard to align the horizontal sensor with the aircraft. A tuning in flight will be needed to adjust the following neutrals. Adjust the roll neutral to fly straight. Adjust the pitch neutral to fly level with the desired throttle.&lt;br /&gt;
   &amp;lt;define name=&amp;quot;ROLL_NEUTRAL_DEFAULT&amp;quot; value=&amp;quot;-2.5&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;PITCH_NEUTRAL_DEFAULT&amp;quot; value=&amp;quot;6&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, an asymmetric (left/right, front/rear) correction can be added with a last set of factors.&lt;br /&gt;
   &amp;lt;define name=&amp;quot;CORRECTION_UP&amp;quot; value=&amp;quot;1.&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;CORRECTION_DOWN&amp;quot; value=&amp;quot;1.&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;CORRECTION_LEFT&amp;quot; value=&amp;quot;1.&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;CORRECTION_RIGHT&amp;quot; value=&amp;quot;1.&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
These corrections are set on the angles.&lt;br /&gt;
&lt;br /&gt;
The old way to define the parameters is still possible, but must not be mixed with the new one describe above.&lt;br /&gt;
&lt;br /&gt;
=== Gyro === &lt;br /&gt;
Defines the type of gyro installed, each axis neutral, and any required temperature compensation. If the gyro has two axes, the pitch neutral is defined as well. Many gyros output their internal temperature and require a temperature-dependent linear correction be made to the neutral value.  No correction is done for the temperature in this example.(&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;ADC_TEMP_SLOPE=0&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;GYRO&amp;quot; prefix=&amp;quot;GYRO_&amp;quot;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_ROLL_COEFF&amp;quot; value=&amp;quot;1&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ROLL_NEUTRAL&amp;quot; value=&amp;quot;500&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_TEMP_NEUTRAL&amp;quot; value=&amp;quot;476&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_TEMP_SLOPE&amp;quot; value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Bat === &lt;br /&gt;
This section give characteristics for the monitoring of the main power battery. &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;MILLIAMP_AT_FULL_THROTTLE&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; represents the actual current (in mA) when full THROTTLE is applied. It is used to compute the &amp;lt;tt&amp;gt;energy&amp;lt;/tt&amp;gt; value of the &amp;lt;tt&amp;gt;BAT&amp;lt;/tt&amp;gt; message when no current sensor is mounted in the airframe. This value can also be used in flight plans. For example, if at full throttle your motor consumes 10 Amps, use a value of 10000. At 50% throttle it is likely to use about 5 Amps so the autopilot can have a better idea how much energy is remaining. You can &amp;quot;tweak&amp;quot; this number after a few flights to match the capacity of your battery. If upon landing your bat.energy messages says that you used 2500 mAh while the battery has only 2000 mAh capacity, you could reduce the MILLIAMP_AT_FULL_THROTTLE value by 20% to match your in-flight current consumption.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;CATASTROPHIC_BAT_LEVEL&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; (was previously &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;LOW_BATTERY&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt;) value defines the voltage at which the autopilot will lock the throttle at 0% in autonomous mode (kill_throttle mode). This value is also used by the ground server to issue a '''CATASTROPHIC''' alarm message on the bus (this message will be displayed in the console of the GCS).  &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;CRITIC&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;LOW&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; values will also used as threshold for '''CRITIC''' and '''WARNING''' alarms. They are optional and the respective defaults are 10.0 and 10.5V.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;MAX_BAT_LEVEL&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; may be specified to improve the display of the battery gauge in the strip. This definition is optional with a default value of 12.5V.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;BAT&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MILLIAMP_AT_FULL_THROTTLE&amp;quot; value=&amp;quot;12000&amp;quot; unit=&amp;quot;mA&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;VOLTAGE_ADC_A&amp;quot; value=&amp;quot;0.0177531&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;VOLTAGE_ADC_B&amp;quot; value=&amp;quot;0.173626&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;VoltageOfAdc(adc)&amp;quot; value =&amp;quot;(VOLTAGE_ADC_A * adc + VOLTAGE_ADC_B)&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;CATASTROPHIC_BAT_LEVEL&amp;quot; value=&amp;quot;6.0&amp;quot; unit=&amp;quot;V&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;CRITIC_BAT_LEVEL&amp;quot; value=&amp;quot;6.5&amp;quot; unit=&amp;quot;V&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;LOW_BAT_LEVEL&amp;quot; value=&amp;quot;7.0&amp;quot; unit=&amp;quot;V&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MAX_BAT_LEVEL&amp;quot; value=&amp;quot;8.4&amp;quot; unit=&amp;quot;V&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A description how to get a current sensor working is here: [[Current_sensor|Current sensor]]&lt;br /&gt;
&lt;br /&gt;
=== Horizontal Control ===&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;HORIZONTAL CONTROL&amp;quot; prefix=&amp;quot;H_CTL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;COURSE_PGAIN&amp;quot; value=&amp;quot;-0.4&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_MAX_SETPOINT&amp;quot; value=&amp;quot;0.35&amp;quot; unit=&amp;quot;radians&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_ATTITUDE_GAIN&amp;quot; value=&amp;quot;-7500.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_RATE_GAIN&amp;quot; value=&amp;quot;-1500&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_PGAIN&amp;quot; value=&amp;quot;-8000.&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ELEVATOR_OF_ROLL&amp;quot; value=&amp;quot;1250&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The outer loop acts on the route. It will produce a roll command from a course setpoint and a course measurement. The COURSE_PGAIN parameter is the factor multiplied by the course error (in radian) to get a roll setpoint (in radian). So if the plane is expected to go north (course=0) and is actually flying to 57 degrees (course=1 radian, i.e. ENE), with a gain of '''-0.4''', a roll of -0.4 (23 degrees) will be set for the lower control loop.&lt;br /&gt;
&lt;br /&gt;
The ROLL_ATTITUDE_GAIN is used to compute a ROLL command from the roll error (setpoint minus measurement). If a gyro in installed, the ROLL_RATE_GAIN to keep a null roll rate. So these two gains provide a P-D controller.&lt;br /&gt;
&lt;br /&gt;
===Vertical Control===&lt;br /&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;
    &amp;lt;!-- outer loop proportional gain --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ALTITUDE_PGAIN&amp;quot; value=&amp;quot;-0.1&amp;quot; unit=&amp;quot;(m/s)/m&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;!-- outer loop saturation --&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ALTITUDE_MAX_CLIMB&amp;quot; value=&amp;quot;3.&amp;quot; unit=&amp;quot;m/s&amp;quot;/&amp;gt;&lt;br /&gt;
These lines are associated with vertical control loops contained in ./sw/airborne/fw_v_ctl.c.  These are outer loop parameters that calculate a desired climb rate based on altitude error. Here, if the altitude error is 10m, the climb setpoint will be set to 1m/s. ALTITUDE_MAX_CLIMB is a bounded value (in m/s) so that the outer loop does not calculate too large of a climb rate&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE&amp;quot; value=&amp;quot;0.65&amp;quot; unit=&amp;quot;%&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_MIN_CRUISE_THROTTLE&amp;quot; value=&amp;quot;.4&amp;quot; unit=&amp;quot;%&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_MAX_CRUISE_THROTTLE&amp;quot; value=&amp;quot;1&amp;quot; unit=&amp;quot;%&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_LOITER_TRIM&amp;quot; value=&amp;quot;1000&amp;quot; unit=&amp;quot;pprz_t&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_DASH_TRIM&amp;quot; value=&amp;quot;-2500&amp;quot; unit=&amp;quot;pprz_t&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT&amp;quot; value=&amp;quot;0.15&amp;quot; unit=&amp;quot;%/(m/s)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_PGAIN&amp;quot; value=&amp;quot;-0.008&amp;quot; unit=&amp;quot;%/(m/s)&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_IGAIN&amp;quot; value=&amp;quot;0.25&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_THROTTLE_PITCH_OF_VZ_PGAIN&amp;quot; value=&amp;quot;0.35&amp;quot; unit=&amp;quot;rad/(m/s)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These lines are associated with vertical rate control loops contained in ./sw/airborne/fw_v_ctl.c and are used by default in most cases.  The default vertical control law is for the vertical rate to be managed by a combination of throttle and pitch.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_PITCH_PGAIN&amp;quot; value=&amp;quot;-0.1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_PITCH_IGAIN&amp;quot; value=&amp;quot;0.025&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_PITCH_MAX_PITCH&amp;quot; value=&amp;quot;0.5&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;AUTO_PITCH_MIN_PITCH&amp;quot; value=&amp;quot;-0.5&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These lines are associated with vertical control loops contained in ./sw/airborne/fw_v_ctl.c but are not used in default. The non-default vertical control law is for the vertical rate to be managed by the pitch.&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;define name=&amp;quot;THROTTLE_SLEW_LIMITER&amp;quot; value=&amp;quot;2&amp;quot; unit=&amp;quot;s&amp;quot;/&amp;gt;&lt;br /&gt;
THROTTLE_SLEW_LIMITER is the required time is seconds to change throttle from 0% to 100%.&lt;br /&gt;
&lt;br /&gt;
=== Misc ===&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;MISC&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;NOMINAL_AIRSPEED&amp;quot; value =&amp;quot;12.&amp;quot; unit=&amp;quot;m/s&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;CARROT&amp;quot; value=&amp;quot;5.&amp;quot; unit=&amp;quot;s&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;KILL_MODE_DISTANCE&amp;quot; value=&amp;quot;(1.5*MAX_DIST_FROM_HOME)&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;CONTROL_RATE&amp;quot; value&amp;quot;60&amp;quot; unit=&amp;quot;Hz&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The &amp;quot;NOMINAL_AIRSPEED&amp;quot; is mainly used in the simulator.&lt;br /&gt;
* &amp;quot;CARROT&amp;quot; gives the distance (in seconds, so ground speed is taken into account) between the carrot and the aircraft.&lt;br /&gt;
* &amp;quot;KILL_MODE_DISTANCE&amp;quot; is the threshold distance to switch the autopilot into KILL mode (defined descent with no throttle)&lt;br /&gt;
* &amp;quot;CONTROL_RATE&amp;quot; is the rate of the low level control loops in Hertz (60 or 20).&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
The [[Modules|modules]] allow to add new code in a flexible way with initialisation, periodic and event functions without modifying the main AP loop.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&lt;br /&gt;
 &amp;lt;modules main_freq=&amp;quot;60&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;load name=&amp;quot;demo_module.xml&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/modules&amp;gt;&lt;br /&gt;
 &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The main_freq parameter (in Hz) allows to specify the frequency of the main loop. Default is 60 Hz&lt;br /&gt;
&lt;br /&gt;
== Hardware definitions - Makefile ==&lt;br /&gt;
&lt;br /&gt;
The airframe file must include the description of the controller board and it's low-level settings.  This is done in one &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;makefile&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; section starting with the autopilot model and flashing mode:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
 &amp;lt;makefile&amp;gt;&lt;br /&gt;
  include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;FLASH_MODE=IAP&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS +=  -DFBW -DAP -DBOARD_CONFIG=\&amp;quot;tiny.h\&amp;quot; -DLED -DTIME_LED=1&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
 &amp;lt;/makefile&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Please note that -DCONFIG was changed to -DBOARD_CONFIG on 18 July 2009.&lt;br /&gt;
&lt;br /&gt;
Below this are the definintions and configuration of the peripherals and interfaces.&lt;br /&gt;
&lt;br /&gt;
=== Radio Control ===&lt;br /&gt;
The Paparazzi autpilot can interface directly with the PWM signal from any standard hobby R/C receiver.  Signal decoding configuration settings for this are stored in the [[Radio_Control|Radio Control]] file.&lt;br /&gt;
&lt;br /&gt;
If you have a Tiny v1.1 Autopilot:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DACTUATORS=\&amp;quot;servos_4015_MAT_hw.h\&amp;quot; -DSERVOS_4015_MAT&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
If you have a Tiny v2 or TWOG v1 Autopilot:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DACTUATORS=\&amp;quot;servos_4017_hw.h\&amp;quot; -DSERVOS_4017&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
If you want to output standard PPM to a R/C receiver:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DACTUATORS=\&amp;quot;servos_ppm_hw.h\&amp;quot; -DSERVOS_PPM_MAT&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += $(SRC_ARCH)/servos_ppm_hw.c actuators.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
This is used in the case where you want to directly drive a receiver which has a microcontroller to do the decoding and driving of the servos (not a 4015 or 4017 decoder chip). The PPM is output on the SERV_CLK pin. The PPM frame rate, pulse width, and number of channels can be adjusted in the &amp;quot;servos_ppm_hw.h&amp;quot; file to suit your particular receiver. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have a Classix Autopilot:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.EXTRA_SRCS += radio_control.c $(SRC_ARCH)/ppm_hw.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DACTUATORS=\&amp;quot;servos_direct_hw.h\&amp;quot;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;ap.EXTRA_SRCS += $(SRC_ARCH)/servos_direct_hw.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You can set RADIO_CONTROL_TYPE to RC_FUTABA, for falling edge PPM, or RC_JR for rising edge PPM. &amp;quot;RC_FUTABA&amp;quot; is for the Futaba or compatible brands, and &amp;quot;RC_JR&amp;quot; for JR (a.k.a Graupner outside of the USA) or compatible brands.&lt;br /&gt;
&lt;br /&gt;
For the Classix, you must specify which pins to use for PWM by adding &amp;quot;-DPWM_SERVO_0, etc.&amp;quot; to the line fbw.CFLAGS. This activate the PWM channel. &lt;br /&gt;
  &amp;lt;tt&amp;gt;wiring on classix PWM connector&lt;br /&gt;
  connector   LPC   shared         port &lt;br /&gt;
  PWM1        PWM5  AD1_6  CAP1_3  P0.21&lt;br /&gt;
  PWM2        PWM3  RXD0   EINT0   P0.1&lt;br /&gt;
  PWM3        PWM1  TXD0           P0.0&lt;br /&gt;
  PWM4        PWM6  RXD1   EINT3   P0.9&lt;br /&gt;
  PWM5        PWM4  TXD1   AD1_1   P0.8&lt;br /&gt;
  PWM6        PWM2  SSEL0  EINT2   P0.7&amp;lt;/tt&amp;gt;&lt;br /&gt;
PWM1 and PWM6 should be safe. PWM4 and PWM5 should be OK if you're not using UART1 on the FBW processor - same for PWM2 and PWM3 if you're not using UART0 (disable FBW telemetry for that ).&lt;br /&gt;
&lt;br /&gt;
=== Modem ===&lt;br /&gt;
The modem protocol and baud rate must be set in both the airframe file and ground station.  Any standard baud rate can be used, with 9600 being adequate and 57600 recommended for most users to allow high speed telemetry for more detailed flight data analysis.  The actual data rate is determined by the number of messages being sent and the period of each message as defined in &amp;lt;tt&amp;gt;conf/telemetry/default.xml&amp;lt;/tt&amp;gt;.  Those wishing to experiment with &amp;quot;alternative&amp;quot; modems can reduce the number and period of each telemetry message to fit within most any bandwidth constraint.&lt;br /&gt;
&lt;br /&gt;
Paparazzi supports the following modem protocols:&lt;br /&gt;
* Standard transparent serial (pprz) - this is compatible with all modems and can be used to connect the autopilot directly to a PC for testing without a modem.&lt;br /&gt;
* Maxstream API protocol (xbee) - compatible with all Maxstream modems including the 9XTend and Zigbee.  This protocol enables hardware addressing, allowing multiple aircraft to be managed from a single ground modem.&lt;br /&gt;
* Coronis Wavecard - necessary for operation with the unusual Coronis Wavecard modem.&lt;br /&gt;
Select the baud/protocol in the airframe file by commenting/uncommenting the appropriate section as follows:&lt;br /&gt;
==== Configuring The Serial Protocol ====&lt;br /&gt;
New users are advised to start with the standard serial protocol before attempting to setup an addressed API link. There are no real reasons for the novice user to use the xbee protocol over the standard PPRZTransport. Even if you are using a Maxstream modem you should still start out with the standard. Lastly it should be pointed out that using a single UAV there is no disadvantage and that the [http://www.engr.usu.edu/wiki/index.php/OSAM OSAM] Paparazzi Team at UAS 2008 took second place using the STANDARD protocol. The serial protocol works with virtually any modem as well as direct cable connections.  The baud rates of the airborne modem, autopilot, ground modem, and PC must be configured correctly.  The PC and autopilot serial ports do not need to be set to the same baud rate, i.e. when running multiple aircraft from a single ground modem, the ground modem may require a higher baud rate than any of the airborne modems in order to stream the data from multiple simultaneous sources.&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;DATALINK&amp;quot; prefix=&amp;quot;DATALINK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEVICE_TYPE&amp;quot; value=&amp;quot;PPRZ&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEVICE_ADDRESS&amp;quot; value=&amp;quot;....&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The above example tells the autopilot to send and recieve data in standard serial form.&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml - makefile section at the bottom|&lt;br /&gt;
 # Serial modem &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_BAUD=B57600&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The above example configures the autopilot serial port (Uart0) to 57,600 baud and calls the serial transport protocol (pprz_transport.c).  Use the &amp;quot;#&amp;quot; symbol to comment lines in this section of the airframe file. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Note:&lt;br /&gt;
* The autopilot and modem serial port baud rates must match at all times and also must match the ground modem rate, check your modem documentation to find the default baud rate and configure a different rate as needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that the ground station is using the same protocol and an equal or higher baud rate:&lt;br /&gt;
{{Box Code|conf/control_panel.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;session name=&amp;quot;USB&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;program name=&amp;quot;link&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-d&amp;quot; constant=&amp;quot;/dev/paparazzi/ttyUSB0&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;!-- &amp;lt;arg flag=&amp;quot;-transport&amp;quot; constant=&amp;quot;xbee&amp;quot;/&amp;gt; Comment this line for standard serial protocol --&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-uplink&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-s&amp;quot; constant=&amp;quot;57600&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/program&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
 &amp;lt;/session&amp;gt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Use this constant /dev/paparazzi/ttyUSB0 when using either the ftdi cable or a Maxstream USB ground modem.. Otherwise use /dev/ttyUSB0 (the ttyUSB0 being the device that you are using. Note: it might not always be ttyUSB0). This paparazzi directory in the dev folder is created when setting the udev rules. [http://paparazzi.enac.fr/wiki/index.php/Installation#Setting_access_rights_for_USB_download Setting Udev rules]&lt;br /&gt;
&lt;br /&gt;
==== Configuring The Maxstream API Protocol ====&lt;br /&gt;
The optional API protocol enables hardware addressing so that multiple aircraft can be managed from a single ground modem, or multiple aircraft and multiple ground stations can work simultaneously without interference from one another.  API mode is enabled by sending an escape sequence (+++) followed by AT commands, this can be done automatically at each boot or can be permanently configured with the &amp;quot;ATWR&amp;quot; command for greater reliability.&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;MISC&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;XBEE_INIT&amp;quot; value=&amp;quot;\&amp;quot;ATPL2\rATRN1\rATTT80\r\ATBD6\rATWR\r\&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
 &amp;lt;/section&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The above example will program the Maxstream to API mode, 100mW power (ATPL2), 57600 baud (ATBD6), and permanently store the changes (ATWR).  After flashing allow 30 seconds for the modem to store the changes, then disable the init string by adding the line &amp;lt;tt&amp;gt;&amp;lt;define name=&amp;quot;NO_XBEE_API_INIT&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&amp;lt;/tt&amp;gt; (the parameter &amp;quot;value&amp;quot; has no effect), update the baud rate as needed, and re-flash the autopilot.  The modem and autopilot serial port baud rates must match eachother at all times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Notes: &lt;br /&gt;
* Maxtream modems are factory configured for 9600 baud, in order to change baud rates, first configure the autopilot serial port to match the modem (DUART0_BAUD=B9600), boot the system so that the baud rate change command is sent to the modem (ATBD6) and permanently saved (ATWR), allow 30 seconds for the modem configuration to complete, then reprogram the autopilot with the new baud rate (DUART0_BAUD=B57600) and disabled modem configuration string &amp;lt;tt&amp;gt;&amp;lt;define name=&amp;quot;NO_XBEE_API_INIT&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt; &amp;lt;/tt&amp;gt;.&lt;br /&gt;
* The ac_id defined in &amp;lt;tt&amp;gt;conf/conf.xml&amp;lt;/tt&amp;gt; is permanently programmed into the modem so this procedure would need to be re-run if the modem is moved to another plane.&lt;br /&gt;
* For temporary boot-time API configuration remove any baud rate changes, remove &amp;lt;tt&amp;gt;ATWR\r&amp;lt;/tt&amp;gt; from the end of the string.&lt;br /&gt;
* Upgrade your Maxstream firmware to the latest version before attempting API mode operation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Box Code|confAgain/airframes/myplane.xml - makefile section at the bottom|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# Maxstream API protocol&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B57600&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}} &lt;br /&gt;
The above example configures the autopilot serial port (Uart0) to 57,600 baud and calls the Maxstream transport protocol (xbee.c).  Use the &amp;quot;#&amp;quot; symbol to comment lines in this section of the airframe file.&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ensure that the ground station is using the same protocol and an equal or higher baud rate:&lt;br /&gt;
{{Box Code|conf/control_panel.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;session name=&amp;quot;USB&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;program name=&amp;quot;link&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-d&amp;quot; constant=&amp;quot;/dev/paparazzi/ttyUSB0&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-transport&amp;quot; constant=&amp;quot;xbee&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-uplink&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;arg flag=&amp;quot;-s&amp;quot; constant=&amp;quot;57600&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/program&amp;gt;&lt;br /&gt;
   ...&lt;br /&gt;
 &amp;lt;/session&amp;gt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Use this constant /dev/paparazzi/ttyUSB0 when using either the ftdi cable or a Maxstream USB ground modem.. Otherwise use /dev/ttyUSB0 (the ttyUSB0 being the device that you are using. Note: it might not always be ttyUSB0). This paparazzi directory in the dev folder is created when setting the udev rules. [http://paparazzi.enac.fr/wiki/index.php/Installation#Setting_access_rights_for_USB_download Setting Udev rules]&lt;br /&gt;
=====Alternate Method=====&lt;br /&gt;
This is the way it is done in funjet1.xml and has been tested to work by Danstah&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/funjet1.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;section name=&amp;quot;MISC&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;XBEE_INIT&amp;quot; value=&amp;quot;\&amp;quot;ATPL2\rATRN1\rATTT80\r\&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;!--    &amp;lt;define name=&amp;quot;NO_XBEE_API_INIT&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt; --&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
 &amp;lt;/section&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Also use this&lt;br /&gt;
{{Box Code|conf/airframes/funjet1.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;section name=&amp;quot;DATALINK&amp;quot; prefix=&amp;quot;DATALINK_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEVICE_TYPE&amp;quot; value=&amp;quot;XBEE&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;DEVICE_ADDRESS&amp;quot; value=&amp;quot;....&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
And Finally use this in the makefile section&lt;br /&gt;
{{Box Code|conf/airframes/funjet1.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B9600&lt;br /&gt;
ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
By reading all the information above you should be able to infer what the above does.&lt;br /&gt;
&lt;br /&gt;
Now keep in mind that the ground modem baud rate and airplanes modem baud rates do not have to match. The only things that need to match are the the modem on the planes baud rate and the rate defined in the airframe file. For example this planes modem is set to 9600 and this could be used with the ground modem configured above using 57600... &lt;br /&gt;
Also for multiple UAV's a good way to configure them is to use 9600 for the ap and use a ground modem configured to 57600 and its not a bad idea to use minimal telemetry.&lt;br /&gt;
&lt;br /&gt;
=== GPS ===&lt;br /&gt;
The serial port settings must match that of the GPS and are configured here along with the necessary files to interpret the u-blox UBX binary protocol:&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DGPS -DUBX -DUSE_UART1 -DGPS_LINK=Uart1 -DUART1_BAUD=B38400&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.srcs += gps_ubx.c gps.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
'''Note:'''&lt;br /&gt;
* u-blox GPS modules are factory configured for 9600 baud, 38,400 baud is recommended along with the other required changes.  The GPS can be accessed directly thru the [[Compiling#USB_flashing|UART Tunnel]] and [[GPS#GPS_configuration_using_U-Center Configured with|u-center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If using the u-blox LEA-5H, add the flag -DGPS_USE_LATLONG in the makefile section of the airframe xml file in the gps section. This flag must be inserted above &amp;quot;ap.srcs += gps_ubx.c gps.c&amp;quot; for proper operation.&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DGPS -DUBX -DUSE_UART1 -DGPS_LINK=Uart1 -DUART1_BAUD=B38400 -DGPS_USE_LATLONG&lt;br /&gt;
ap.srcs += gps_ubx.c gps.c&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Sensors ===&lt;br /&gt;
&lt;br /&gt;
=== Control loops ===&lt;br /&gt;
&lt;br /&gt;
The control loops can be divided in two largely independent groups : the vertical ones and the horizontal ones (files sw/airborne/fw_h_ctl.c and sw/airborne/fw_v_ctl.c ). Those loops can be commanded at different levels by either the R/C transmitter or the autonomous navigation routine.&lt;br /&gt;
&lt;br /&gt;
First the horizontal loop:&lt;br /&gt;
{{Box Code|conf/airframes/funjet1.xml|&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM&lt;br /&gt;
ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5429</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5429"/>
		<updated>2009-09-01T21:50:43Z</updated>

		<summary type="html">&lt;p&gt;Timo: /* Display on ground station */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Example.jpg|thumb|right|float|Connected current sensor to the Twog]]&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message. Use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5428</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5428"/>
		<updated>2009-09-01T21:48:37Z</updated>

		<summary type="html">&lt;p&gt;Timo: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Example.jpg|thumb|right|float|Connected current sensor to the Twog]]&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5427</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5427"/>
		<updated>2009-09-01T21:43:42Z</updated>

		<summary type="html">&lt;p&gt;Timo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
[[Image:Example.jpg|right|300px|Connected current sensor to the Twog]]&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Example.jpg&amp;diff=5426</id>
		<title>File:Example.jpg</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Example.jpg&amp;diff=5426"/>
		<updated>2009-09-01T21:29:51Z</updated>

		<summary type="html">&lt;p&gt;Timo: Soldered sparkfun current sensor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Soldered sparkfun current sensor&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5425</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5425"/>
		<updated>2009-09-01T21:24:19Z</updated>

		<summary type="html">&lt;p&gt;Timo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
[[Image:Example.jpg]]&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;br /&gt;
[[Image:[[Image:Example.jpg]]]]&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5424</id>
		<title>Current sensor</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Current_sensor&amp;diff=5424"/>
		<updated>2009-09-01T21:23:24Z</updated>

		<summary type="html">&lt;p&gt;Timo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you have a current sensor like the one from sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor] it is very easy to get the paparazzi working with that.&lt;br /&gt;
&lt;br /&gt;
I do have only a TWOG 1.0 so i am only able to descibe the way for this device. The Tiny v2 should be the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
I use the current sensor also for power supply so i have 3 wires to the current sensor. The + and - pole and the wire for the current measurement. The + and - have to be soldered directly to the cabels which came from the power supply. The 3rd wire is connected to the VI pin on the sparkfun breakout board. It must have a voltage between 0 and 3.3V. On the Twog or Tiny side you connect the 3rd wire to the ADC_3 or ADC_4 pin.&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Add to the adc section of the airframe file following line:&lt;br /&gt;
&amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt; With the right ADC where you connected the wire.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;section name=&amp;quot;adc&amp;quot; prefix=&amp;quot;ADC_CHANNEL_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR1&amp;quot; value=&amp;quot;ADC_1&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR2&amp;quot; value=&amp;quot;ADC_2&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_TOP&amp;quot; value=&amp;quot;ADC_0&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;IR_NB_SAMPLES&amp;quot; value=&amp;quot;16&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SUPPLY_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not sure the abouve lines are really necessary ( i will check it later). &lt;br /&gt;
&lt;br /&gt;
In the BAT section add this lines:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;define name=&amp;quot;ADC_CHANNEL_CURRENT&amp;quot; value=&amp;quot;ADC_3&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;define name=&amp;quot;MilliAmpereOfAdc(adc)&amp;quot; value=&amp;quot;(88*adc)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The right multiplicator for the raw measurement conversion depends on the current sensor. The sparkfun sensor returns a voltage of 0 V - 3.3 V it is linear and at 90.15 A it reaches the maximum of 3.3 V. The Twog have a A/D with 10-bit precision wich leads to 1024 different values for the voltage. So you can calculate the multiplicator with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
In case of the sparkfun sensor precision is 1024 and A_at_max_voltage is 90.15 =&amp;gt; 1000/1024*90.15 = 88.037&lt;br /&gt;
&lt;br /&gt;
== Display on ground station ==&lt;br /&gt;
&lt;br /&gt;
After following the instruction the energy consumed during the flight is send in the BAT message use the Messages application to show it.&lt;br /&gt;
In the fbw_status message the current value show the actual current flow through the current sensor.&lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just drag and drop them on the 2d map.&lt;/div&gt;</summary>
		<author><name>Timo</name></author>
	</entry>
</feed>