<?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=Eazy</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=Eazy"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Eazy"/>
	<updated>2026-04-07T05:00:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=21154</id>
		<title>Rotorcraft Configuration</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=21154"/>
		<updated>2016-04-16T21:03:36Z</updated>

		<summary type="html">&lt;p&gt;Eazy: &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/myrotorcraft.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/myrotorcraft.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/myrotorcraft.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/myrotorcraft.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/myrotorcraft.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 is 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;
Same as AP_MODE_ATTITUDE_DIRECT, 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;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;
&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;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;
&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;
{{Box Code|conf/airframes/myrotorcraft.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;motor_mixing&amp;quot;/&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;
Configuration of the motor mixing:&lt;br /&gt;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;MAX_SATURATION_OFFSET&amp;quot;	value=&amp;quot;MAX_PPRZ/10&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;
&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;
; ''MAX_SATURATION_OFFSET'' : set at &amp;quot;MAX_PPRZ/10&amp;quot; by default&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;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;
&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, RIGHT, BACK, LEFT.&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;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, -256,    0,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256,    0, -256,    0 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -128,  128, -128,  128 }&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;
This is equivalent to (available since v5.5_devel-602-g0129d3e):&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;TYPE&amp;quot; value=&amp;quot;QUAD_PLUS&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;
; 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 NW, NE, SE, SW.&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;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;{  181, -181, -181,  181 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  181,  181, -181, -181 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{  128, -128,  128,  128 }&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;
This is equivalent to (available since v5.5_devel-602-g0129d3e):&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;TYPE&amp;quot; value=&amp;quot;QUAD_X_CCW&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This is equivalent to (available since v5.9_devel):&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;TYPE&amp;quot; value=&amp;quot;QUAD_X&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;REVERSE&amp;quot; value=&amp;quot;true&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;
; Hex (Time Cross) : [[Image:Hex_cross_layout.png|200px]]&lt;br /&gt;
Assuming that the order of motors, described in the &amp;quot;servos&amp;quot; section is FRONT_LEFT, FRONT_RIGHT, RIGHT, BACK_RIGHT, BACK_LEFT, LEFT.&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;NB_MOTOR&amp;quot; value=&amp;quot;6&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;{  128, -128,  -256,  -128,  128, 256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  222,  222,     0,  -222, -222,   0 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -128,  128,  -128,   128, -128, 128 }&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 }&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This is equivalent to (available since v5.5_devel-602-g0129d3e):&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;TYPE&amp;quot; value=&amp;quot;HEXA_X&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;
; 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;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;NB_MOTOR&amp;quot; value=&amp;quot;8&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;{   98,  -98, -237, -237,  -98,   98,  237,  237 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  237,  237,   98,  -98, -237, -237,  -98,   98 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{ -128,  128, -128,  128, -128,  128, -128,  128 }&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;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This is equivalent to (available since v5.5_devel-602-g0129d3e):&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;TYPE&amp;quot; value=&amp;quot;OCTO_X&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;
; Octo (plus cross): [[Image:Octo_plus_motor_layout.png|border|200px]]&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;NB_MOTOR&amp;quot; value=&amp;quot;8&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, -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;{ -128,  128, -128,  128, -128,  128, -128,  128 }&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;/section&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This is equivalent to (available since v5.5_devel-602-g0129d3e):&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;TYPE&amp;quot; value=&amp;quot;OCTO_PLUS&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;
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;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;
&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;
{{Box Code|conf/airframes/myrotorcraft.xml|&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;
&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>Eazy</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Sensors/Current&amp;diff=19838</id>
		<title>Sensors/Current</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Sensors/Current&amp;diff=19838"/>
		<updated>2015-05-03T11:57:52Z</updated>

		<summary type="html">&lt;p&gt;Eazy: &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;Sensors&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
Current sensors can be easily added.&lt;br /&gt;
&lt;br /&gt;
Examples are the one from Sparkfun (AttoPilot Voltage and Current Sense Breakout [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Current sensor]) or a linear hall-effect device such as the Allegro ACS755 or ACS715. The [http://www.teamnovak.com/products/data_logger/2000_sentry/index.html Novak Sentry current sensor] is based on the ACS755LCB-100 hall-effect sensor and has a range of 100A. The smaller and lighter [http://www.pololu.com/catalog/product/1186 Pololu Current Sensor Carrier] is based on the ACS715 with a current of up to 30A.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Current_volt_sensor_01.jpg |Atto 01&lt;br /&gt;
Image:Current_volt_sensor_02.jpg |Atto 01&lt;br /&gt;
Image:Current_volt_sensor_03.jpg |Atto 01&lt;br /&gt;
Image:Current_volt_sensor_04.jpg |Atto 01&lt;br /&gt;
Image:Current_volt_sensor_05.jpg |Atto 01&lt;br /&gt;
Image:Current_volt_sensor_closeup_01.jpg |Atto 01 Closeup&lt;br /&gt;
Image:Current_volt_sensor_09028-01-L.jpg |Atto A/V&lt;br /&gt;
Image:Current_volt_sensor_09028-02-L.jpg |Atto A/V&lt;br /&gt;
Image:Current_volt_sensor_09028-03-L.jpg |Atto A/V&lt;br /&gt;
Image:Current_volt_sensor_alt_5360.jpg | Alternative sensor&lt;br /&gt;
Image:Current_volt_sensor_telemetry_data.jpg | The Current and volt sensor telemetry&lt;br /&gt;
Image:Current_volt_sensor_first_data_in_graph.jpg | The Current and volt sensor raw ADC first data in graph&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Example.jpg|thumb|right|float|Current sensor connected to the TWOG v1]]&lt;br /&gt;
Typically, the current sensor is used to measure the current flowing through the main battery (rather than the motor). Connect the + and - pole of the sensor through the battery red lead. The + and - have to be soldered directly. &lt;br /&gt;
&lt;br /&gt;
On the Sparkfun breakout board, a wire is connected to the &amp;quot;VI&amp;quot; pin. It must have a voltage between 0 and 3.3V. On a TWOG v1 or Tiny v2 board, the current sense output wire (&amp;quot;IA&amp;quot; on the Sparkfun sensor) is connected to the ADC_3 (or ADC_4) pin.&lt;br /&gt;
&lt;br /&gt;
On the Novak Sentry current sensor, the red wire is connected to +5 volts. The black wire is ground. The yellow wire is the output (40mV/amp. 0.6v=0amps, 5.0v=110amps) and is connected to the ADC_3 (or ADC_4) pin. [[Image:NovakCurrentSensor.jpg|thumb|right|float|Novak 100A current sensor]]&lt;br /&gt;
&lt;br /&gt;
== Airframe integration ==&lt;br /&gt;
&lt;br /&gt;
Following code needs to be added to the airframe conf:&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;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_ADC&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_ADC_3&amp;quot;/&amp;gt;    &amp;lt;!-- motor current--&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;section name=&amp;quot;BAT&amp;quot;&amp;gt;&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;Max(0,adc*88)&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;
The ''Max(0,x)'' ensures that instead of getting a negative current when using a motor brake it is set to zero, thus not corrupting your energy estimate. If you have a setup where the current can become negative (e.g. charging the battery via solar cells) don't use ''Max''.&lt;br /&gt;
&lt;br /&gt;
Remove the line:&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;
&lt;br /&gt;
The correct multiplier for the raw measurement conversion depends on the current sensor. The Sparkfun sensor returns a linear voltage of 0 V - 3.3 V and at 90.15 A it reaches the maximum of 3.3 V. The TWOG v1 or Tiny v2 have a A/D converter with 10-bit precision (1024 different values) to represent the voltage. So you can calculate the multiplier with the following formula:&lt;br /&gt;
&lt;br /&gt;
'''1000 / precision * A_at_max_voltage'''&lt;br /&gt;
&lt;br /&gt;
For the Sparkfun sensor, the 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;
For the ACS755LCB-100 sensor, there is a 0.6 volts offset. At 3.3v, the current is 67.5A. The formula is thus: value=&amp;quot;(80.55*(adc-185))&amp;quot;&lt;br /&gt;
&lt;br /&gt;
For the ACS755LCB-50 sensor, there is a 0.6 volts offset. At 3.3v, the current is 45.A. The formula is thus: value=&amp;quot;(43.94*(adc-185))&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Values By AGRESSiVA:&lt;br /&gt;
&lt;br /&gt;
For the ACS755LCB-50 sensor using resistive divisor (1k8/3k3). The formula is thus: value=&amp;quot;(68.017*(adc-120))&amp;quot; (not confirmed / tested)&lt;br /&gt;
&lt;br /&gt;
For the ACS755LCB-100 sensor using resistive divisor (1k8/3k3). The formula is thus: value=&amp;quot;(122.5*(adc-120))&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Display on Ground Control Station (GCS) ==&lt;br /&gt;
&lt;br /&gt;
Use the Messages application to show it.&lt;br /&gt;
&lt;br /&gt;
The total energy consumed during the flight (in mAh) is sent in the &amp;quot;BAT&amp;quot; message. &lt;br /&gt;
&lt;br /&gt;
The actual current flowing through the sensor (in mA) is sent in the &amp;quot;fbw_status&amp;quot; message. &lt;br /&gt;
&lt;br /&gt;
You can display the energy or current on the GCS by just dragging and dropping them on the 2d map.&lt;br /&gt;
&lt;br /&gt;
== Current / Voltage Sensor ==&lt;br /&gt;
&lt;br /&gt;
If you would like to install the autopilot on a bigger airframe, you can face the problem, that the nominal voltage of the battery-pack is higher then allowed for the autopilot. (i.e. 6 cell LiPo and TWOG ) But if you use a voltage regulator, then the autopilot has no information on the real voltage of the battery-pack. The GCS will show the autopilot input voltage, which is irrelevant regarding the remaining capacity of the battery-pack.&lt;br /&gt;
&lt;br /&gt;
Fortunately the AttoPilot [http://www.sparkfun.com/commerce/product_info.php?products_id=9028 Voltage and Current Sensor (Sparkfun)] provides a voltage signal scaled down to 3.3V, too. This can be connected to a general analog input of the autopilot (for example ADC_4) similar to the current signal. If you configure the airframe file in the following way, the autopilot will provide all of the warnings (i.e. Battery Low) and calculations (i.e. power consumption) as it does in case of a direct connection between autopilot and battery-pack. &lt;br /&gt;
&lt;br /&gt;
Further information can be found on [[Airframe_Configuration#Battery]].&lt;br /&gt;
&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;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_ADC&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_ADC_4&amp;quot;/&amp;gt;    &amp;lt;!-- Battery voltage--&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ADC_CHANNEL_VSUPPLY&amp;quot; 	value=&amp;quot;ADC_4&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;section name=&amp;quot;BAT&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    &amp;lt;define name=&amp;quot;VOLTAGE_ADC_A&amp;quot; value=&amp;quot;0.05&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;VOLTAGE_ADC_B&amp;quot; value=&amp;quot;1&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;section/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Don't need to load the adc_generic module! You will get wrong values in the energy messages!'''&lt;br /&gt;
&lt;br /&gt;
(The above method was tested with Sparkfun Attopilot Current Sensor and TWOG.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sensors]] [[Category:Software]] [[Category:User_Documentation]]&lt;/div&gt;</summary>
		<author><name>Eazy</name></author>
	</entry>
</feed>