<?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=Alexandremendes</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=Alexandremendes"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Alexandremendes"/>
	<updated>2026-04-17T18:48:45Z</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=12290</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=12290"/>
		<updated>2012-05-10T13:24:17Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Global View */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed. This is especially the case when using extra features such as '''AGR_CLIMB''', '''STRONG_WIND''', etc.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
= Rotorcraft autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes of the multi-rotor autopilot were made with the drawing tool from Google docs. To edit the drawings, send an e-mail to microuav@gmail.com.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
INV_M is basically the inverse of the mass. Since m.g=thrust when hovering in RC Direct mode, it can be calculated by INV_M=9.81/(thrust). (thrust message[0-256] in ROTORCRAFT_FP)&lt;br /&gt;
&lt;br /&gt;
if you specify INV_M, it will be used instead of the observer for the adaptive control (so in most cases it makes more sense to not specify this explicitly and use the adaptive controller instead)&lt;br /&gt;
the adaptative controller code is located in '''guidance\guidance_v_adpt.h'''&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;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=12289</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=12289"/>
		<updated>2012-05-10T13:19:19Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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 one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
The best way to determine vehicle behavior is to look at the source code. For determining which control loops are engaged by various flight plan blocks and stages, it may be helpful to look at sw/airborne/subsystems/nav.h and the generated flightplan file in var/&amp;lt;AIRCRAFT_NAME&amp;gt;/generated/flight_plan.h.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/subsystems/nav.*'''. The navigation routines are called from the [[Flight Plans]]. Advanced navigation routines are in '''sw/airborne/subsystems/navigation/'''.&lt;br /&gt;
&lt;br /&gt;
== Course loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_course_loop.png|Course loop]]&lt;br /&gt;
&lt;br /&gt;
The course loop is the upper stage of the horizontal control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/stabilization/stabilization_attitude.c''' (formerly fw_h_ctl.c).&lt;br /&gt;
&lt;br /&gt;
== Roll loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_roll_loop.png|Roll loop]]&lt;br /&gt;
&lt;br /&gt;
The roll loop is the lower stage of the horizontal control and is used for lateral attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
If &amp;lt;tt&amp;gt;H_CTL_ROLL_ATTITUDE_GAIN&amp;lt;/tt&amp;gt; is undefined, the code will fallback to a attitude-only loop, where &amp;lt;tt&amp;gt;estimator_p&amp;lt;/tt&amp;gt; is disregarded and the gain for &amp;lt;tt&amp;gt;estimator_phi&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;H_CTL_ROLL_PGAIN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note; estimator_phi is the measured roll angle, and estimator_p is the measured rate of change in roll angle.&lt;br /&gt;
&lt;br /&gt;
== Altitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_altitude_loop.png|Altitude loop]]&lt;br /&gt;
&lt;br /&gt;
The altitude loop is the upper stage of the vertical control.&lt;br /&gt;
It is located in '''sw/airborne/firmwares/fixedwing/guidance/guidance_v.c''' (formerly fw_v_ctl.c)&lt;br /&gt;
If AGR_CLIMB is defined in the airframe file, the altitude loop also sets the v_ctl_auto_throttle_submode for use in the climb loop.&lt;br /&gt;
&lt;br /&gt;
== Auto Throttle and Auto Pitch climb loops ==&lt;br /&gt;
&lt;br /&gt;
Two climb loops are available. The are called from the [[Flight Plans#Navigation_modes|flight plan]] by changing the vertical navigation mode. The default mode is '''Auto Throttle'''. The '''Auto Pitch''' loop is only available if '''V_CTL_AUTO_PITCH_PGAIN''' is defined. Only one loop is active at a time. Note also that if '''USE_AIRSPEED''' is defined, then the Auto Throttle loop is replaced by the Auto Airspeed loop, see [Control_Loops#Control_loops_using_Airspeed_Sensor|below].&lt;br /&gt;
&lt;br /&gt;
=== Auto throttle loop ===&lt;br /&gt;
[[Image:Diagram_auto_throttle_loop.png|Auto Throttle climb loop]]&lt;br /&gt;
&lt;br /&gt;
If '''AGR_CLIMB''' is defined, then the auto throttle submode is used to determine setpoint outputs. This may be the standard control loop outputs, the aggressive outputs (static setpoints defined in airframe file) or a blend of both.&lt;br /&gt;
&lt;br /&gt;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|924px|Auto Pitch climb loop]]&lt;br /&gt;
&lt;br /&gt;
The climb loop is the intermediate stage of the vertical control. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
== Pitch loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_pitch_loop.png|Pitch loop]]&lt;br /&gt;
&lt;br /&gt;
The pitch loop is the lower stage of the vertical control and is used for longitudinal attitude stabilization. It is located in '''stabilization_attitude.c'''.&lt;br /&gt;
The first sum block of the diagram is not completely accurate. The input to the pitch stabilization loop is h_ctl_pitch_setpoint, though v_ctl_pitch_of_vz is not a direct input. Rather h_ctl_pitch_setpoint is assigned in the main autopilot loop from nav_pitch, in general (in auto1, it is assigned directly from the pitch r/c input). The nav_pitch value is obtained in a few ways, depending on which control loop(s) are active. If auto throttle is active, nav_pitch is the sum of v_ctl_pitch_of_vz and a fixed setpoint defined using the pitch attribute in the flightplan. If AGR_CLIMB is set, nav_pitch is either the airframe file defined ascent and descent pitch setpoints, the standard sum, or a blend of each. If auto pitch is active, nav_pitch is defined directly from the output of that loop. If airspeed is active, nav_pitch is defined in the auto airspeed pitch loop.&lt;br /&gt;
&lt;br /&gt;
== Control loops using Airspeed Sensor ==&lt;br /&gt;
&lt;br /&gt;
Adding an airspeed sensor measures actual airspeed resulting in better throttle control and aircraft performance especially in windy conditions. The use of an airspeed sensor is described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_auto_airspeed_loop.png|Auto Airspeed climb loop]]&lt;br /&gt;
&lt;br /&gt;
The auto airspeed cascaded control loops control both pitch and throttle. This control loop set replaces the Auto Throttle climb loop; it is engaged in the same manner in the flight plan. It is located in '''guidance_v.c'''.&lt;br /&gt;
&lt;br /&gt;
= 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
[[File:Rc_climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
[[File:Climb.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
[[File:Z_hold.png]]&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Vertical loop ==&lt;br /&gt;
[[File:vertical_loop.png]]&lt;br /&gt;
&lt;br /&gt;
the source code is located in '''guidance\guidance_v.c'''&lt;br /&gt;
&lt;br /&gt;
INV_M is basically the inverse of the mass. Since m.g=thrust when hovering in RC Direct mode, it can be calculated by INV_M=9.81/(thrust). (thrust message[0-256] in ROTORCRAFT_FP)&lt;br /&gt;
&lt;br /&gt;
if you specify INV_M, it will be used instead of the observer for the adaptive control (so in most cases it makes more sense to not specify this explicitly and use the adaptive controller instead)&lt;br /&gt;
the adaptative controller code is located in '''guidance\guidance_v_adpt.h'''&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;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9641</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9641"/>
		<updated>2011-06-20T16:13:28Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from pos set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9640</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9640"/>
		<updated>2011-06-20T16:11:50Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Rate 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9639</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9639"/>
		<updated>2011-06-20T16:11:35Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Attitude 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9638</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9638"/>
		<updated>2011-06-20T16:11:13Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9637</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9637"/>
		<updated>2011-06-20T16:10:58Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9636</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9636"/>
		<updated>2011-06-20T16:09:46Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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 reference generator 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;
(to be developed later..)&lt;br /&gt;
&lt;br /&gt;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9635</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9635"/>
		<updated>2011-06-20T16:08:42Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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 reference generator 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;
Integral action or tracking algorithm:&lt;br /&gt;
&lt;br /&gt;
if (|guidance_h_pos_err| &amp;lt; HOLD_DISTANCE) -&amp;gt; intregal error * guidance_h_igain&lt;br /&gt;
&lt;br /&gt;
else -&amp;gt; path tracking error * guidance_h_ngain&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9634</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9634"/>
		<updated>2011-06-20T15:39:05Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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 reference generator 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;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Booz_horizontal_nav.png&amp;diff=9633</id>
		<title>File:Booz horizontal nav.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Booz_horizontal_nav.png&amp;diff=9633"/>
		<updated>2011-06-20T15:34:04Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9632</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9632"/>
		<updated>2011-06-20T14:53:11Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_NAV */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
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 reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:GUIDANCE_H_MODE_NAV.png&amp;diff=9631</id>
		<title>File:GUIDANCE H MODE NAV.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:GUIDANCE_H_MODE_NAV.png&amp;diff=9631"/>
		<updated>2011-06-20T14:46:27Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9630</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9630"/>
		<updated>2011-06-20T14:36:22Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from x or y set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
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 reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9629</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9629"/>
		<updated>2011-06-20T11:26:56Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Reference generators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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 x or y set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_xy_sp.png]]&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 reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Booz_refgen_xy_sp.png&amp;diff=9628</id>
		<title>File:Booz refgen xy sp.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Booz_refgen_xy_sp.png&amp;diff=9628"/>
		<updated>2011-06-20T11:26:19Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9627</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9627"/>
		<updated>2011-06-20T11:11:20Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from z set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Refgen_from_z_sp.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Refgen_from_z_sp.png&amp;diff=9626</id>
		<title>File:Refgen from z sp.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Refgen_from_z_sp.png&amp;diff=9626"/>
		<updated>2011-06-20T11:10:49Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9625</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9625"/>
		<updated>2011-06-19T20:40:12Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_HOVER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=9570</id>
		<title>Rotorcraft Configuration</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Rotorcraft_Configuration&amp;diff=9570"/>
		<updated>2011-06-12T01:15:35Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Autopilot modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The airframe configuration file is located in &amp;lt;tt&amp;gt;conf/airframes&amp;lt;/tt&amp;gt; and contains&lt;br /&gt;
all the hardware and software settings for an aircraft. All gains, trims, and behavior settings are defined with standard XML elements. Optionally you can also add a raw [http://en.wikipedia.org/wiki/Makefile Makefile] section.&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:&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_FAILSAFE :&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 autopilot will level the rotorcraft out (setpoints to zero pitch and roll angles) and descend at 0.5m/s downwards.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_KILL :&lt;br /&gt;
Motors are simply switched off.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RATE_DIRECT :&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 :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles), but the throttle directly proportional to your stick position.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_RATE_RC_CLIMB :&lt;br /&gt;
You control the rotation rate and the vertical speed according to your throttle stick position. If you have your throttle stick in the middle position, the altitude is keept, 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 recenter itself.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_RC_CLIMB :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles) and the vertical speed according to your throttle stick position. If you have your throttle stick in the middle position, the altitude is keept, 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 recenter itself.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_CLIMB :&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 :&lt;br /&gt;
You control the rotation rate and it holds the altitude you were at when entering this mode. Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this 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.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_ATTITUDE_Z_HOLD :&lt;br /&gt;
You control the attitude (roll, pitch and yaw angles) and it holds the altitude you were at when entering this mode. Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this 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.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_DIRECT :&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.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_CLIMB :&lt;br /&gt;
The rotorcraft hovers at the position you were at when entering this mode (position control). The vertical speed is set via fms (e.g. joystick).&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_HOVER_Z_HOLD :&lt;br /&gt;
The rotorcraft hovers at the 3D position you were at when entering this mode (position and altitude control). Your throttle stick position still limits the max throttle authority, so you should push your throttle stick up after entering this 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.&lt;br /&gt;
&lt;br /&gt;
; AP_MODE_NAV :&lt;br /&gt;
Full navigation mode. The rotorcraft follows your flightplan.&lt;br /&gt;
&lt;br /&gt;
=== Control Loops ===&lt;br /&gt;
&lt;br /&gt;
The control loops for rotorcraft can be found in [[Control Loops]].&lt;br /&gt;
&lt;br /&gt;
== XML Parameters ==&lt;br /&gt;
&lt;br /&gt;
=== Mode ===&lt;br /&gt;
In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.&lt;br /&gt;
 &amp;lt;tt&amp;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_HOVER_Z_HOLD&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Commands ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;commands&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; lists the abstract commands you need to control the aircraft. For most multicopter you just need:&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;commands&amp;gt;&lt;br /&gt;
   &amp;lt;axis name=&amp;quot;PITCH&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;axis name=&amp;quot;ROLL&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;axis name=&amp;quot;YAW&amp;quot; failsafe_value=&amp;quot;0 /&amp;gt;&lt;br /&gt;
   &amp;lt;axis name=&amp;quot;THRUST&amp;quot; failsafe_value=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/commands&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each command is also associated with a failsafe value which will be used if no controller is active, for example during initialization of the autopilot board.&lt;br /&gt;
&lt;br /&gt;
=== Supervision ===&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 &amp;quot;mkk&amp;quot; (mikrokopter) and &amp;quot;asctecV2&amp;quot; controllers, as &amp;quot;asctecV1&amp;quot; do their mixing themselves.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&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;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;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Below are values for the common &amp;quot;plus cross&amp;quot;, &amp;quot;time cross&amp;quot; quadrirotor configurations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Plus Cross : [[Image:cross_plus_simple.png|200px]]&lt;br /&gt;
Assuming that the order of motors, described in the &amp;quot;servos&amp;quot; section is FRONT, BACK, LEFT, RIGHT.&lt;br /&gt;
&amp;lt;pre&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;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Time Cross : [[Image:cross_time_simple.png|200px]]&lt;br /&gt;
Assuming that the order of motors, described in the &amp;quot;servos&amp;quot; section is NE, SE, SW, NW.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;ROLL_COEF&amp;quot;   value=&amp;quot;{ -256, -256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PITCH_COEF&amp;quot;  value=&amp;quot;{  256, -256, -256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;YAW_COEF&amp;quot;    value=&amp;quot;{  256, -256,  256, -256 }&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;THRUST_COEF&amp;quot; value=&amp;quot;{  256,  256,  256,  256 }&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if your rotors are spinning opposite to the direction showed in the picture, just reverse signs in the YAW_COEF line.&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;
=== Bat === &lt;br /&gt;
This section give characteristics for the monitoring of the main power battery.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;CATASTROPHIC_BAT_LEVEL&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; (was previously &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;LOW_BATTERY&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt;) value defines the voltage at which the autopilot will lock the throttle at 0% in autonomous mode (kill_throttle mode). This value is also used by the ground server to issue a '''CATASTROPHIC''' alarm message on the bus (this message will be displayed in the console of the GCS).  &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;CRITIC&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;LOW&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; values will also used as threshold for '''CRITIC''' and '''WARNING''' alarms. They are optional and the respective defaults are 10.0 and 10.5V.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;MAX_BAT_LEVEL&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; may be specified to improve the display of the battery gauge in the strip or in &amp;quot;papgets&amp;quot;. Note that this definition is optional, with a default value of 12.5V.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;section name=&amp;quot;BAT&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;MILLIAMP_PER_PERCENT&amp;quot; value=&amp;quot;0.86&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;CATASTROPHIC_BAT_LEVEL&amp;quot; value=&amp;quot;9.3&amp;quot; unit=&amp;quot;V&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;MAX_BAT_LEVEL&amp;quot; value=&amp;quot;12.0&amp;quot; unit=&amp;quot;V&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BATTERY_SENS&amp;quot; value=&amp;quot;0.246&amp;quot; integer=&amp;quot;16&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;BATTERY_OFFSET&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simulation ===&lt;br /&gt;
Values from this section can be used to tweak the SITL simulation. The NPS (New Paparazzi Sim) currently uses JSBSim as for the flight dynamic modeling, but other FDMs are possible.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;section name=&amp;quot;SIMULATOR&amp;quot; prefix=&amp;quot;NPS_&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;ACTUATOR_NAMES&amp;quot; value=&amp;quot;{&amp;amp;quot;front_motor&amp;amp;quot;, &amp;amp;quot;back_motor&amp;amp;quot;, &amp;amp;quot;right_motor&amp;amp;quot;, &amp;amp;quot;left_motor&amp;amp;quot;}&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;INITIAL_CONDITITONS&amp;quot; value=&amp;quot;&amp;amp;quot;reset00&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
   &amp;lt;define name=&amp;quot;SENSORS_PARAMS&amp;quot; value=&amp;quot;&amp;amp;quot;nps_sensors_params_booz2_a1.h&amp;amp;quot;&amp;quot; /&amp;gt;&lt;br /&gt;
 &amp;lt;/section&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
The [[Modules|modules]] allow to add new code in a flexible way with initialisation, periodic and event functions without modifying the main AP loop.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tt&amp;gt;&amp;lt;modules main_freq=&amp;quot;512&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;load name=&amp;quot;sys_mon.xml&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/modules&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The main_freq parameter (in Hz) allows to specify the frequency of the main loop. Default is 60 Hz, for rotorcraft you should use 512 Hz.&lt;br /&gt;
&lt;br /&gt;
== Firmware and Hardware definitions ==&lt;br /&gt;
&lt;br /&gt;
This is one example of a pretty standard quadcopter firmware definition:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;&lt;br /&gt;
      &amp;lt;subsystem name=&amp;quot;fdm&amp;quot;   type=&amp;quot;nps&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&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;configure name=&amp;quot;MODEM_BAUD&amp;quot; value=&amp;quot;B57600&amp;quot;/&amp;gt;&amp;lt;!--this is already the default, add and change this line only if needed--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;define name=&amp;quot;USE_ADAPT_HOVER&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;GUIDANCE_H_USE_REF&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;b2_v1.1&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;cmpl&amp;quot;/&amp;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;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
=== Select your Board ===&lt;br /&gt;
The airframe file must include the description of the controller board and it's low-level settings.&lt;br /&gt;
This is done in the &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;firmware&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; section by specifying the ''board'' attribute for the ''target'' &amp;quot;ap&amp;quot; (autopilot).&lt;br /&gt;
&lt;br /&gt;
Select the appropriate board:&lt;br /&gt;
&amp;quot;twog_1.0&amp;quot;, &amp;quot;tiny_2.11&amp;quot;, &amp;quot;tiny_2.1&amp;quot;, &amp;quot;tiny_1.1&amp;quot;, &amp;quot;tiny_0.99&amp;quot;, &amp;quot;booz_1.0&amp;quot;, &amp;quot;lisa_l_1.0&amp;quot;, &amp;quot;lisa_l_1.1&amp;quot;, &amp;quot;pc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;&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;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Radio Control ===&lt;br /&gt;
The Paparazzi autopilot can interface directly with the PWM signal from any standard hobby R/C receiver.  Signal decoding configuration settings for this are stored in the [[Radio_Control|Radio Control]] file.&lt;br /&gt;
&lt;br /&gt;
Just specify the appropriate subsystem in your firmware section:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;&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;radio_control&amp;quot;     type=&amp;quot;ppm&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
On the autopilots with a STM32 processor (lisa) you can use the type ''spektrum''.&lt;br /&gt;
&lt;br /&gt;
=== Telemetry (Modem) ===&lt;br /&gt;
The modem protocol and baud rate must be set in both the airframe file and ground station.  Any standard baud rate can be used, with 9600 being adequate and 57600 recommended for most users to allow high speed telemetry for more detailed flight data analysis.  The actual data rate is determined by the number of messages being sent and the period of each message as defined in &amp;lt;tt&amp;gt;conf/telemetry/default.xml&amp;lt;/tt&amp;gt;.  Those wishing to experiment with &amp;quot;alternative&amp;quot; modems can reduce the number and period of each telemetry message to fit within most any bandwidth constraint.&lt;br /&gt;
&lt;br /&gt;
Paparazzi supports the following modem protocols:&lt;br /&gt;
* Standard transparent serial (pprz) - this is compatible with all modems and can be used to connect the autopilot directly to a PC for testing without a modem.&lt;br /&gt;
* Maxstream API protocol (xbee) - compatible with all Maxstream modems including the 9XTend and Zigbee.  This protocol enables hardware addressing, allowing multiple aircraft to be managed from a single ground modem.&lt;br /&gt;
&lt;br /&gt;
Just specify the appropriate subsystem in your firmware section. You can currently choose between the types '''transparent''' and '''xbee_api'''.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The correct UART is already defined by default according to your board.&lt;br /&gt;
The default modem baudrate is 57600baud.&lt;br /&gt;
&lt;br /&gt;
If you use different baud rate or UART set the according parameters, e.g.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;MODEM_BAUD&amp;quot;          value=&amp;quot;B9600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;MODEM_PORT&amp;quot;          value=&amp;quot;UART1&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;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== GPS ===&lt;br /&gt;
For rotorcraft you can use the GPS types: 'ublox' and 'skytraq'. The ublox type is good for both lea-4p and lea-5h.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;gps&amp;quot;               type=&amp;quot;ublox&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The serial port settings must match that of the GPS:&lt;br /&gt;
&lt;br /&gt;
The correct UART is already defined by default according to your board. The default gps baudrate is 38400baud.&lt;br /&gt;
&lt;br /&gt;
If you use different baud rates set the according parameters, e.g.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;gps&amp;quot;               type=&amp;quot;ublox&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;GPS_BAUD&amp;quot;          value=&amp;quot;B9600&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;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
* u-blox GPS modules are factory configured for 9600 baud, 38,400 baud is recommended along with the other required changes.  The GPS can be accessed directly thrugh the [[Compiling#USB_flashing|UART Tunnel]] and [[GPS#GPS_configuration_using_U-Center|Configured with u-center]]&lt;br /&gt;
&lt;br /&gt;
=== IMU ===&lt;br /&gt;
Add the imu subsystem with the type you are using. Currently possible IMU subsystems are &amp;quot;b2_v1.0&amp;quot;, &amp;quot;b2_v1.1&amp;quot;, &amp;quot;b2_v1.2&amp;quot;, &amp;quot;crista&amp;quot; and &amp;quot;[[AspirinIMU|aspirin]]&amp;quot;. Other IMUs can be used through modules or you can just add a subsystem makefile for your own. Also see the [[ImuCalibration|IMU calibration]] page.&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;imu&amp;quot;       type=&amp;quot;b2_v1.0&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== AHRS ===&lt;br /&gt;
The AHRS subsystem specifies which attitude estimation filter you are using, e.g. for the complementary filter:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;ahrs&amp;quot; type=&amp;quot;cmpl&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
For the latest integer complementary filter (ic):&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;ahrs&amp;quot; type=&amp;quot;ic&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;section name=&amp;quot;AHRS&amp;quot; prefix=&amp;quot;AHRS_&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;PROPAGATE_FREQUENCY&amp;quot; value=&amp;quot;512&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;H_X&amp;quot; value=&amp;quot; 0.51562740288882&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;H_Y&amp;quot; value=&amp;quot;-0.05707735220832&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;H_Z&amp;quot; value=&amp;quot; 0.85490967783446&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
H is the normalised local magnetic field which can be derived by following instructions on the IMU calibration page [http://paparazzi.enac.fr/wiki/BoozSensorsCalibration#AHRS-integer_complementary_.28ic.29_filter_normalised_magnetic_X.2CY.2CZ_fields here].&lt;br /&gt;
&lt;br /&gt;
Other flags of interest are;&lt;br /&gt;
&lt;br /&gt;
*AHRS_PROPAGATE_LOW_PASS_RATES : apply a low pass filter on rotational velocity&lt;br /&gt;
*AHRS_MAG_UPDATE_YAW_ONLY : use mag to update yaw only&lt;br /&gt;
&lt;br /&gt;
There is a test program ( sw/airborne/test/ahrs/compare_ahrs.py ) to compare different AHRS implementations on simple test cases.&lt;br /&gt;
&lt;br /&gt;
=== INS ===&lt;br /&gt;
The optional 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;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;pre&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;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
Beware, this code is kinda bad/ugly and should be replaced/improved!&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:User_Documentation]] [[Category:Rotorcraft]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9569</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9569"/>
		<updated>2011-06-12T01:04:06Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Multi-rotor (Booz) autopilot */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9568</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9568"/>
		<updated>2011-06-12T01:03:22Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Multi-rotor (Booz) autopilot */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
The schemes 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;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9567</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9567"/>
		<updated>2011-06-12T00:51:47Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from z dot set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zdot.png]]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Booz_refgen_zdot.png&amp;diff=9566</id>
		<title>File:Booz refgen zdot.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Booz_refgen_zdot.png&amp;diff=9566"/>
		<updated>2011-06-12T00:50:56Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9476</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9476"/>
		<updated>2011-06-01T23:11:24Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from z dot set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
Image has a little mistake. Arrow should go from z dot ref. I will fix this soon.&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9475</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9475"/>
		<updated>2011-06-01T23:10:40Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from z set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
Image has a little mistake. Should be feedback of z dot ref. I will fix this soon.&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9474</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9474"/>
		<updated>2011-06-01T23:10:13Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from z dot set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
Image has a little mistake. Should be feedback of z dot ref. I will fix this soon.&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9469</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9469"/>
		<updated>2011-06-01T13:13:18Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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 reference generator is located in '''guidance/guidance_h.c'''&lt;br /&gt;
&lt;br /&gt;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9468</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9468"/>
		<updated>2011-06-01T13:10:44Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Attitude 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this reference generator 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 reference generator 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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9467</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9467"/>
		<updated>2011-06-01T13:10:03Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Rate 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&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 reference generator 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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9466</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9466"/>
		<updated>2011-06-01T13:09:39Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from angular rate set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9465</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9465"/>
		<updated>2011-06-01T13:06:11Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from angular rate set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9464</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9464"/>
		<updated>2011-06-01T12:56:36Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from euler attitude angle set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9463</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9463"/>
		<updated>2011-06-01T12:45:17Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.png]]&lt;br /&gt;
&lt;br /&gt;
The '''adjust accel''' is a simple algorithm to set acceleration to zero when velocity reaches boundaries.&lt;br /&gt;
&lt;br /&gt;
The code for these reference generators is located in '''guidance/guidance_v_ref.h'''&lt;br /&gt;
&lt;br /&gt;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9462</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9462"/>
		<updated>2011-06-01T11:36:54Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_HOVER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
[[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;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:GUIDANCE_H_MODE_HOVER.png&amp;diff=9461</id>
		<title>File:GUIDANCE H MODE HOVER.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:GUIDANCE_H_MODE_HOVER.png&amp;diff=9461"/>
		<updated>2011-06-01T11:20:31Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9447</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9447"/>
		<updated>2011-05-29T16:56:44Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal hover loop + rotation to body + ref generator + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Guidance horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9446</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9446"/>
		<updated>2011-05-29T16:54:45Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&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;
Horizontal hover loop + rotation to body + ref generator + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9445</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9445"/>
		<updated>2011-05-29T16:53:56Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + rotation to body + ref generator + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&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;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Guidance_horizontal_hover.png&amp;diff=9444</id>
		<title>File:Guidance horizontal hover.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Guidance_horizontal_hover.png&amp;diff=9444"/>
		<updated>2011-05-29T16:53:04Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9443</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9443"/>
		<updated>2011-05-29T14:37:06Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_NAV */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + rotation to body + ref generator + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + rotation to body + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9442</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9442"/>
		<updated>2011-05-29T14:36:50Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_HOVER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + rotation to body + ref generator + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9441</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9441"/>
		<updated>2011-05-29T14:35:54Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_NAV */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + ref generator + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9440</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9440"/>
		<updated>2011-05-29T14:35:11Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Multi-rotor (Booz) autopilot */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Horizontal hover loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
== Horizontal navigation loop ==&lt;br /&gt;
&lt;br /&gt;
(coming soon...)&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9439</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9439"/>
		<updated>2011-05-29T14:33:15Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_NAV */&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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
Horizontal navigation loop + attitude loop (coming soon...)&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9438</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9438"/>
		<updated>2011-05-29T14:32:29Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* mode: GUIDANCE_H_MODE_HOVER */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page presents the default control loops used by the Paparazzi airborne code for navigation, guidance and control.&lt;br /&gt;
&lt;br /&gt;
= General Information =&lt;br /&gt;
&lt;br /&gt;
All the possible combinations of control loops might not be fully detailed.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
Horizontal hover loop + attitude loop (coming soon...)&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_H_MODE_NAV ===&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9437</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9437"/>
		<updated>2011-05-29T14:30:33Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Rate 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
=== mode: GUIDANCE_H_MODE_NAV ===&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:rate_loop.png]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Rate_loop.png&amp;diff=9436</id>
		<title>File:Rate loop.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Rate_loop.png&amp;diff=9436"/>
		<updated>2011-05-29T14:29:20Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9435</id>
		<title>Control Loops</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Control_Loops&amp;diff=9435"/>
		<updated>2011-05-29T14:28:47Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: /* Attitude 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.&lt;br /&gt;
&lt;br /&gt;
In the following diagrams, the block '''s''' is used for the '''derivative''' function and '''1/s''' is used for the '''integrator''' function.&lt;br /&gt;
&lt;br /&gt;
The variables' names are the one used in the airborne code (written in '''C'''). Most of this name can the used capitalized in the [[Airframe Configuration]] file in order to define the default value of these variables. If in capital letters in the diagrams, the value is fixed and cannot be changed using [[Settings]] mechanism.&lt;br /&gt;
&lt;br /&gt;
= Fixed-wing autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global view ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Diagram_general.png|General overview]]&lt;br /&gt;
&lt;br /&gt;
The elements '''servos''', '''rc_commands''', '''commands''' and '''command_laws''' correspond to specific section of the [[Airframe Configuration]] file. Most of the code located in these blocks is generated from the xml of th configuration file.&lt;br /&gt;
&lt;br /&gt;
The value '''+/-9600''' correspond to '''+/-MAX_PPRZ'''. This '''pprz''' unit is used as a normalized internal unit for input and output values of the '''control_laws''' block.&lt;br /&gt;
&lt;br /&gt;
== Navigation loop ==&lt;br /&gt;
&lt;br /&gt;
The navigation loop is located in '''sw/airborne/nav.*'''. The navigation routines are called from the [[Flight Plans]].&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;
== 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;
&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'''.&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;
=== Auto pitch loop ===&lt;br /&gt;
[[Image:Diagram_auto_pitch_loop.png|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;
&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 control loops using an airspeed sensor are described [[Airspeed_sensor|here]].&lt;br /&gt;
&lt;br /&gt;
= Multi-rotor (Booz) autopilot =&lt;br /&gt;
&lt;br /&gt;
== Global View ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_autopilot_globalview.png]]&lt;br /&gt;
&lt;br /&gt;
The code for this autopilot is located in '''sw/airborne/firmwares/rotorcraft'''.&lt;br /&gt;
&lt;br /&gt;
== Vertical Control ==&lt;br /&gt;
&lt;br /&gt;
Depending on the general mode selected, one of the following vertical modes is used.&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_RC_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_CLIMB ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_HOVER ===&lt;br /&gt;
&lt;br /&gt;
=== mode: GUIDANCE_V_MODE_NAV ===&lt;br /&gt;
&lt;br /&gt;
== Reference generators ==&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_z.png]]&lt;br /&gt;
&lt;br /&gt;
=== from &amp;lt;math&amp;gt;\dot{z}&amp;lt;/math&amp;gt; set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_zd.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;
== Hover loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&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;
=== mode: GUIDANCE_H_MODE_NAV ===&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;
=== from angular rate set point ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Booz_refgen_rate.png]]&lt;br /&gt;
&lt;br /&gt;
== Attitude loop ==&lt;br /&gt;
&lt;br /&gt;
[[Image:attitude_loop.png]]&lt;br /&gt;
&lt;br /&gt;
== Rate loop ==&lt;br /&gt;
&lt;br /&gt;
coming soon...&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Attitude_loop.png&amp;diff=9434</id>
		<title>File:Attitude loop.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Attitude_loop.png&amp;diff=9434"/>
		<updated>2011-05-29T14:27:41Z</updated>

		<summary type="html">&lt;p&gt;Alexandremendes: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Alexandremendes</name></author>
	</entry>
</feed>