<?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=Matejkarasek</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=Matejkarasek"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Matejkarasek"/>
	<updated>2026-05-08T04:34:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=24163</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=24163"/>
		<updated>2019-02-07T16:37:35Z</updated>

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

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

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

		<summary type="html">&lt;p&gt;Matejkarasek: Links added&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 (including the trims) centered to start motors &lt;br /&gt;
** need to be in [[AutopilotModes|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 (including the trims) need to be centered to start motors&lt;br /&gt;
** need to be in [[AutopilotModes|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;quot; /&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;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;BACK&amp;quot;  value=&amp;quot;motor_mixing.commands[1]&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;RIGHT&amp;quot; value=&amp;quot;motor_mixing.commands[2]&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;set servo=&amp;quot;LEFT&amp;quot;  value=&amp;quot;motor_mixing.commands[3]&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/command_laws&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== 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>Matejkarasek</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=AutopilotModes&amp;diff=23950</id>
		<title>AutopilotModes</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=AutopilotModes&amp;diff=23950"/>
		<updated>2017-11-28T10:22:22Z</updated>

		<summary type="html">&lt;p&gt;Matejkarasek: Possibility of mapping the 3 modes explained&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
Paparazzi allows you to define three modes, '''MANUAL''', '''AUTO1''' and '''AUTO2''' , which are associated to a [[Rc_transmitter_and_receiver_setup#Flight_MODE_switch|3-position switch of your remote]].&lt;br /&gt;
&lt;br /&gt;
== Mode mapping ==&lt;br /&gt;
&lt;br /&gt;
Because especially rotorcraft can be operated in [[Rotorcraft_Configuration#Autopilot_modes|multiple modes]], you can define the mapping to these three easily switchable modes in your [[Rotorcraft_Configuration#XML_Parameters|airframe file]]. Moreover, the mode associated to AUTO2 can be changed in the Settings tab of the [[GCS]].&lt;br /&gt;
&lt;br /&gt;
In the following text, the typical configuration is described, which is also why (legacy reasons) the three modes were named as they were named.&lt;br /&gt;
&lt;br /&gt;
== Manual ==&lt;br /&gt;
&lt;br /&gt;
The '''MANUAL''' flight mode is for directly controling your airframe by your transmitter. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;'''Caution!'''&amp;lt;/span&amp;gt; Please note that any trims and deflections set in your airframe config file still apply.&lt;br /&gt;
&lt;br /&gt;
When flying in Manual mode please consider the [[Failsafe#RC_link_failure_while_manual_or_AUTO1|failsafes]].&lt;br /&gt;
&lt;br /&gt;
== Auto 1 ==&lt;br /&gt;
&lt;br /&gt;
The '''AUTO1''' is typically used for controller stabilized flight. &lt;br /&gt;
&lt;br /&gt;
Although the autopilot will keep the airframe level and stabilized, you need to steer the airframe yourself, ie. where you want it to go.&lt;br /&gt;
&lt;br /&gt;
When flying in Auto 1 mode please consider the [[Failsafe#RC_link_failure_while_manual_or_AUTO1|failsafes]].&lt;br /&gt;
&lt;br /&gt;
== Auto 2 ==&lt;br /&gt;
&lt;br /&gt;
In '''AUTO2''' your aircraft is typically fully autonomous in stabilization and navigation. &lt;br /&gt;
&lt;br /&gt;
You are not required to steer or stabilize the aircraft via your [[Radio_Control|radio]].&lt;br /&gt;
&lt;br /&gt;
In such mode, the aircraft follows the [[Flight_Plans|flightplan]] and - as always - commands issued via the [[GCS]].&lt;/div&gt;</summary>
		<author><name>Matejkarasek</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23936</id>
		<title>Units</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23936"/>
		<updated>2017-11-28T09:21:48Z</updated>

		<summary type="html">&lt;p&gt;Matejkarasek: Added a correct link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Paparazzi tries to use SI units everywhere.&lt;br /&gt;
&lt;br /&gt;
All angles should be in radians and not in degrees! (But there are still exceptions [https://wiki.paparazziuav.org/wiki/Units#Defines_still_using_degrees]...)&lt;br /&gt;
&lt;br /&gt;
== Automatic unit conversion ==&lt;br /&gt;
For convenience Paparazzi handles some unit conversions automatically for you (since v3.9):&lt;br /&gt;
&lt;br /&gt;
In the [[Airframe_Configuration]] the &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; attributes are used for automatic conversion:&lt;br /&gt;
&lt;br /&gt;
* if &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; '''and''' &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; are specified the value is converted to &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and then written to the &amp;lt;tt&amp;gt;generated/airframe.h&amp;lt;/tt&amp;gt; file&lt;br /&gt;
* conversion is only done if the contents of the value attribute can be converted to float, otherwise string is simply copied like for any normal define&lt;br /&gt;
* '''special treatment for &amp;lt;tt&amp;gt;unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;''' (and &amp;lt;tt&amp;gt;unit=&amp;quot;deg/s&amp;quot;&amp;lt;/tt&amp;gt;): if &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; is not specified, &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad&amp;quot;&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad/s&amp;quot;&amp;lt;/tt&amp;gt;) is implicitly assumed!&lt;br /&gt;
** if you really want the define in degrees, explicitly specify &amp;lt;tt&amp;gt;code_unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E.g. now you can write&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-4.0&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;3.5&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;-45.&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
instead of&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-0.0698&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;RadOfDeg(3.5)&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;RadOfDeg(-45.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The units that you can use for &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and their conversion are specified in PPRZlink [https://wiki.paparazziuav.org/wiki/Pprzlink] in units.xml [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/common/units.xml] and hence can easily be extended.&lt;br /&gt;
&lt;br /&gt;
== Save settings == &lt;br /&gt;
Also &amp;quot;save settings&amp;quot; now gracefully handles values containing the deprecated &amp;lt;tt&amp;gt;RadOfDeg(x)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;DegOfRad(x)&amp;lt;/tt&amp;gt; macros and converts it to the correct unit when reading from the airframe file. When saving the new value it will be correctly written without that macro.&lt;br /&gt;
&lt;br /&gt;
When saving the settings the values are still always displayed in the actual unit (e.g. rad).&lt;br /&gt;
&lt;br /&gt;
== Defines still using degrees ==&lt;br /&gt;
Regarding radians in the code: the defines&lt;br /&gt;
&lt;br /&gt;
   CAM_PAN_MAX&lt;br /&gt;
   CAM_PAN_MIN&lt;br /&gt;
   CAM_PAN_NEUTRAL&lt;br /&gt;
   CAM_PAN0&lt;br /&gt;
   CAM_PAN_POSITION_FOR_FPV&lt;br /&gt;
   CAM_TILT_MAX&lt;br /&gt;
   CAM_TILT_MIN&lt;br /&gt;
   CAM_TILT_NEUTRAL&lt;br /&gt;
   CAM_TILT0&lt;br /&gt;
   CAM_TILT_POSITION_FOR_FPV&lt;br /&gt;
&lt;br /&gt;
are still in degrees and need to be defined in the airframe file either without any unit or with unit and code_unit both set to deg:&lt;br /&gt;
  &amp;lt;define name=&amp;quot;TILT_MAX&amp;quot; value=&amp;quot;45&amp;quot; unit=&amp;quot;deg&amp;quot; code_unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matejkarasek</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23935</id>
		<title>Units</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23935"/>
		<updated>2017-11-28T09:18:51Z</updated>

		<summary type="html">&lt;p&gt;Matejkarasek: Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Paparazzi tries to use SI units everywhere.&lt;br /&gt;
&lt;br /&gt;
All angles should be in radians and not in degrees! (But there are still exceptions...)&lt;br /&gt;
&lt;br /&gt;
== Automatic unit conversion ==&lt;br /&gt;
For convenience Paparazzi handles some unit conversions automatically for you (since v3.9):&lt;br /&gt;
&lt;br /&gt;
In the [[Airframe_Configuration]] the &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; attributes are used for automatic conversion:&lt;br /&gt;
&lt;br /&gt;
* if &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; '''and''' &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; are specified the value is converted to &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and then written to the &amp;lt;tt&amp;gt;generated/airframe.h&amp;lt;/tt&amp;gt; file&lt;br /&gt;
* conversion is only done if the contents of the value attribute can be converted to float, otherwise string is simply copied like for any normal define&lt;br /&gt;
* '''special treatment for &amp;lt;tt&amp;gt;unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;''' (and &amp;lt;tt&amp;gt;unit=&amp;quot;deg/s&amp;quot;&amp;lt;/tt&amp;gt;): if &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; is not specified, &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad&amp;quot;&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad/s&amp;quot;&amp;lt;/tt&amp;gt;) is implicitly assumed!&lt;br /&gt;
** if you really want the define in degrees, explicitly specify &amp;lt;tt&amp;gt;code_unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E.g. now you can write&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-4.0&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;3.5&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;-45.&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
instead of&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-0.0698&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;RadOfDeg(3.5)&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;RadOfDeg(-45.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The units that you can use for &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and their conversion are specified in PPRZlink [https://wiki.paparazziuav.org/wiki/Pprzlink] in units.xml [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/common/units.xml] and hence can easily be extended.&lt;br /&gt;
&lt;br /&gt;
== Save settings == &lt;br /&gt;
Also &amp;quot;save settings&amp;quot; now gracefully handles values containing the deprecated &amp;lt;tt&amp;gt;RadOfDeg(x)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;DegOfRad(x)&amp;lt;/tt&amp;gt; macros and converts it to the correct unit when reading from the airframe file. When saving the new value it will be correctly written without that macro.&lt;br /&gt;
&lt;br /&gt;
When saving the settings the values are still always displayed in the actual unit (e.g. rad).&lt;br /&gt;
&lt;br /&gt;
== Defines still using degrees ==&lt;br /&gt;
Regarding radians in the code: the defines&lt;br /&gt;
&lt;br /&gt;
   CAM_PAN_MAX&lt;br /&gt;
   CAM_PAN_MIN&lt;br /&gt;
   CAM_PAN_NEUTRAL&lt;br /&gt;
   CAM_PAN0&lt;br /&gt;
   CAM_PAN_POSITION_FOR_FPV&lt;br /&gt;
   CAM_TILT_MAX&lt;br /&gt;
   CAM_TILT_MIN&lt;br /&gt;
   CAM_TILT_NEUTRAL&lt;br /&gt;
   CAM_TILT0&lt;br /&gt;
   CAM_TILT_POSITION_FOR_FPV&lt;br /&gt;
&lt;br /&gt;
are still in degrees and need to be defined in the airframe file either without any unit or with unit and code_unit both set to deg:&lt;br /&gt;
  &amp;lt;define name=&amp;quot;TILT_MAX&amp;quot; value=&amp;quot;45&amp;quot; unit=&amp;quot;deg&amp;quot; code_unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matejkarasek</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23930</id>
		<title>Units</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Units&amp;diff=23930"/>
		<updated>2017-11-28T08:57:33Z</updated>

		<summary type="html">&lt;p&gt;Matejkarasek: /* Automatic unit conversion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Paparazzi tries to use SI units everywhere.&lt;br /&gt;
&lt;br /&gt;
All angles should be in radians and not in degrees!&lt;br /&gt;
&lt;br /&gt;
== Automatic unit conversion ==&lt;br /&gt;
For convenience Paparazzi handles some unit conversions automatically for you (since v3.9):&lt;br /&gt;
&lt;br /&gt;
In the [[Airframe_Configuration]] the &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; attributes are used for automatic conversion:&lt;br /&gt;
&lt;br /&gt;
* if &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; '''and''' &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; are specified the value is converted to &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and then written to the &amp;lt;tt&amp;gt;generated/airframe.h&amp;lt;/tt&amp;gt; file&lt;br /&gt;
* conversion is only done if the contents of the value attribute can be converted to float, otherwise string is simply copied like for any normal define&lt;br /&gt;
* '''special treatment for &amp;lt;tt&amp;gt;unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;''' (and &amp;lt;tt&amp;gt;unit=&amp;quot;deg/s&amp;quot;&amp;lt;/tt&amp;gt;): if &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; is not specified, &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad&amp;quot;&amp;lt;/tt&amp;gt; (or &amp;lt;tt&amp;gt;code_unit=&amp;quot;rad/s&amp;quot;&amp;lt;/tt&amp;gt;) is implicitly assumed!&lt;br /&gt;
** if you really want the define in degrees, explicitly specify &amp;lt;tt&amp;gt;code_unit=&amp;quot;deg&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E.g. now you can write&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-4.0&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;3.5&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;-45.&amp;quot; unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;br /&gt;
instead of&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PHI&amp;quot;   value=&amp;quot;-0.0698&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_THETA&amp;quot; value=&amp;quot;RadOfDeg(3.5)&amp;quot; unit=&amp;quot;rad&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BODY_TO_IMU_PSI&amp;quot;   value=&amp;quot;RadOfDeg(-45.)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The units that you can use for &amp;lt;tt&amp;gt;unit&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;code_unit&amp;lt;/tt&amp;gt; and their conversion are specified in PPRZlink [https://wiki.paparazziuav.org/wiki/Pprzlink] in units.xml [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/common/units.xml] and hence can easily be extended.&lt;br /&gt;
&lt;br /&gt;
== Save settings == &lt;br /&gt;
Also &amp;quot;save settings&amp;quot; now gracefully handles values containing the deprecated &amp;lt;tt&amp;gt;RadOfDeg(x)&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;DegOfRad(x)&amp;lt;/tt&amp;gt; macros and converts it to the correct unit when reading from the airframe file. When saving the new value it will be correctly written without that macro.&lt;br /&gt;
&lt;br /&gt;
When saving the settings the values are still always displayed in the actual unit (e.g. rad).&lt;br /&gt;
&lt;br /&gt;
== defines still using degrees ==&lt;br /&gt;
Regarding radians in the code: the defines&lt;br /&gt;
&lt;br /&gt;
   CAM_PAN_MAX&lt;br /&gt;
   CAM_PAN_MIN&lt;br /&gt;
   CAM_PAN_NEUTRAL&lt;br /&gt;
   CAM_PAN0&lt;br /&gt;
   CAM_PAN_POSITION_FOR_FPV&lt;br /&gt;
   CAM_TILT_MAX&lt;br /&gt;
   CAM_TILT_MIN&lt;br /&gt;
   CAM_TILT_NEUTRAL&lt;br /&gt;
   CAM_TILT0&lt;br /&gt;
   CAM_TILT_POSITION_FOR_FPV&lt;br /&gt;
&lt;br /&gt;
are still in degrees and need to be defined in the airframe file either without any unit or with unit and code_unit both set to deg:&lt;br /&gt;
  &amp;lt;define name=&amp;quot;TILT_MAX&amp;quot; value=&amp;quot;45&amp;quot; unit=&amp;quot;deg&amp;quot; code_unit=&amp;quot;deg&amp;quot;/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Matejkarasek</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Lisa/S&amp;diff=19725</id>
		<title>Lisa/S</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Lisa/S&amp;diff=19725"/>
		<updated>2015-04-07T17:31:19Z</updated>

		<summary type="html">&lt;p&gt;Matejkarasek: Brushed ESCs are included, not brush-less...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:tudelft_logo.jpg|left|120px|link=http://mavlab.lr.tudelft.nl/en/]]&lt;br /&gt;
[[File:1bitsquared_logo.png|left|120px|link=http://1bitsquared.com]]&lt;br /&gt;
[[Image:Lisa S V0 1 r2 on finger.jpg|300px|right]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Lisa/S ==&lt;br /&gt;
&lt;br /&gt;
Lisa/S is a very small general purpose autopilot. The main goal of creating an autopilot of minimal size and weight, while providing enough functionality to enable fully autonomous operation.&lt;br /&gt;
&lt;br /&gt;
=== Mechanical Dimensions ===&lt;br /&gt;
&lt;br /&gt;
* '''Size: 20mm x 20mm x 5mm (0.787&amp;quot; x 0.787&amp;quot; x 0.197&amp;quot;)'''&lt;br /&gt;
* '''Weight: 2.8g (0.1oz)'''&lt;br /&gt;
&lt;br /&gt;
=== Features ===&lt;br /&gt;
&lt;br /&gt;
* 72MHz 32bit ARM Cortex M3 MCU with 16KB RAM and 512KB Flash&lt;br /&gt;
* Combined 3 Axis Gyroscope and 3 Axis Accelerometer&lt;br /&gt;
* 3 Axis Magnetometer&lt;br /&gt;
* Barometer (Altimeter)&lt;br /&gt;
* Onboard U-Blox GPS&lt;br /&gt;
* Pads to simply connect a [[SuperbitRF|Superbit CYRF]] RC and telemetry module&lt;br /&gt;
* Switching buck/boost converter allowing wide range of power input making it perfect and stable for operation from a 1S LiPO cell.&lt;br /&gt;
* 2 MOSFET switches connected to PWM output channels&lt;br /&gt;
* 6 PWM (servo) outputs&lt;br /&gt;
* 1 UART port&lt;br /&gt;
* 1 CAN interface&lt;br /&gt;
* 1 Bind/Boot tact switch&lt;br /&gt;
* SWD programming/debugging interface&lt;br /&gt;
* Size: 20mm x 20mm x 5mm (0.787&amp;quot; x 0.787&amp;quot; x 0.197&amp;quot;)&lt;br /&gt;
* Weight: 2.8g (0.1oz)&lt;br /&gt;
&lt;br /&gt;
=== Pictures ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Lisa_s_v0_1_r2_top_ruler.jpg|300px]]&lt;br /&gt;
[[Image:Lisa_s_v0_1_r2_bottom_ruler.jpg|300px]]&lt;br /&gt;
[[Image:Lisa_s_v0_1_r2_top_superbit.jpg|300px]]&lt;br /&gt;
[[Image:Lisa_s_v0_1_r2_bottom_superbit.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
So if you are ready to make your tiny plane fly autonomously,[http://1bitsquared.com/collections/frontpage/products/lisa-s you can already order one here]&lt;br /&gt;
&lt;br /&gt;
== Get one ==&lt;br /&gt;
&lt;br /&gt;
[[File:1bitsquared_logo.png|100px|link=http://1bitsquared.com]]&lt;br /&gt;
&lt;br /&gt;
A nice Lisa/S is available for purchase from [http://1bitsquared.com/products/lisa-s-starter-kit 1 BIT SQUARED].&lt;br /&gt;
&lt;br /&gt;
== Pinout ==&lt;br /&gt;
&lt;br /&gt;
For a good example with which pins to connect where go to [[Lisa/S/Tutorial/Nano_Quadcopter]]. For more pinout info the site of manufacturer [http://cdn.shopify.com/s/files/1/0245/8645/products/LisaS_pinout_61ab6205-3e69-4602-8fbc-4c27ac55bbc4_1024x1024.jpg]&lt;br /&gt;
&lt;br /&gt;
== Block Diagrams ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== Barometer ==&lt;br /&gt;
&lt;br /&gt;
In order to use the barometer, you just need to add one line to your firmware block (in your airframe file) :&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;firmware name=&amp;quot;fixedwing&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;target name=&amp;quot;ap&amp;quot;   board=&amp;quot;lisa_s_0.1&amp;quot;&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/target&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;define name=&amp;quot;USE_BAROMETER&amp;quot; value=&amp;quot;TRUE&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;
Once that line is added to the airframe file, you should be able to get the values of the barometer and paparazzi is going to take them into account when doing it's calculations.&lt;br /&gt;
&lt;br /&gt;
Warning : the barometer doesn't seams to be working at a higher frequency than 120Hz in a fixed wing airframe. Than mean that in a fixed wing airframe the PERIODIC_FREQUENCY must be equal or lower than 120. In rotorcraft the barometer works fine.&lt;br /&gt;
&lt;br /&gt;
== Schematics ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Lisa_s_0_1_r1_schematic.png|300px|thumb|none|Lisa/S V0.1 R1 Schematic]]&lt;br /&gt;
[[Image:Lisa_s_1_0_r12_schematic.png|300px|thumb|none|Lisa/S V1.0 R12 Schematic]]&lt;br /&gt;
&lt;br /&gt;
== Pre-release v0.1 ==&lt;br /&gt;
&lt;br /&gt;
One of the earliest versions of the board which is still used in the [http://www.mavlab.info/ MAVlab] of the TU-Delft is the Lisa/S V0.1R2. If you are not working there, this info is of no importance to you...Else as a reminder to all: This version is slightly different from newer versions:&lt;br /&gt;
&lt;br /&gt;
* The SWIO and GND pin from the Serial Wire Debug (SWD) headers are flipped, such that the order becomes TRACE-SWCLK-SWDIO-GND.&lt;br /&gt;
* There is no capacitor to enable a warm start for the GPS.&lt;br /&gt;
* Instead of four, only two brushed motors can be connected.&lt;br /&gt;
&lt;br /&gt;
=Tips=&lt;br /&gt;
&lt;br /&gt;
1. Go the the [[Lisa/S/Tutorial/Nano_Quadcopter]] Page to get a good explanation of how to connect your board on a quadcoper&lt;br /&gt;
&lt;br /&gt;
[[Category:Lisa]] [[Category:User_Documentation]] [[Category:Autopilots]]&lt;/div&gt;</summary>
		<author><name>Matejkarasek</name></author>
	</entry>
</feed>