Difference between revisions of "Rotorcraft Configuration"

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

Latest revision as of 02:25, 28 November 2017

This page describes configuration options specific to the rotorcraft firmware in the airframe file.

Firmware and Hardware definitions

This is one example of a pretty standard quadcopter firmware definition:

File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
    <target name="nps" board="pc">
      <subsystem name="fdm"   type="jsbsim"/>
    </target>
    <target name="ap" board="lisa_m_1.0"/>

    <subsystem name="radio_control" type="ppm"/>
    <subsystem name="telemetry"     type="transparent"/>
    <subsystem name="actuators"     type="mkk"/>
    <subsystem name="imu"           type="aspirin_v1.5"/>
    <subsystem name="gps"           type="ublox"/>
    <subsystem name="ahrs"          type="int_cmpl_quat"/>
    <subsystem name="stabilization" type="int_quat"/>
  </firmware>

Select your Board

Make sure you use the rotorcraft firmware and choose the correct board, e.g.


File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
    <target name="sim" 	board="pc"/>       <!-- For simulation -->
    <target name="ap" 	board="lisa_m_2.0"/> <!-- Select your board here -->
     ...
  </firmware>

The ap board name can be found in /conf/boards.

Actuators

You have to specify which ESCs you have by adding the appropriate actuators subsystem.

File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="actuators" type="mkk"/>
  </firmware>

Control Loops

See the stabilization subsystem page to choose which attitude control algorithm to use and how to configure them.

The Control Loops page has some diagrams.

INS

The INS (Integrated Navigation System) subsystem contains estimations filter to e.g. fuse GPS and IMU data for better position and speed estimates. The INS subsystem is optional in <= v4.2.

Since v4.9x the INS subsystem is mandatory, to use the same as in v4.2 omit the type.

File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="ins"/>
  </firmware>

You can also compensate for GPS lag in hff (horizontal filter float) if it is known (in seconds):

File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
    <target name="ap" board="booz_1.0"/>
     ...
    <subsystem name="ins" type="hff">
      <define name="GPS_LAG=0.2"/>
    </subsystem>
  </firmware>

Motor Arming

By default the motors are armed with zero-throttle and full yaw. The motors are never started if AHRS is not aligned (disable it with AUTOPILOT_DISABLE_AHRS_KILL).

Other arming sequences can be configured:

  • USE_KILL_SWITCH_FOR_MOTOR_ARMING defined (to 1):
    • switch kill switch off to arm the motors
    • if kill switch is off during startup, you need to kill again first, then unkill to start
    • throttle needs to be down, other sticks (including the trims) centered to start motors
    • need to be in MANUAL mode to start the motors
  • USE_THROTTLE_FOR_MOTOR_ARMING defined (to 1):
    • automatically start motors when applying throttle
    • if throttle was not down at startup, you need to put throttle down again first
    • other sticks (including the trims) need to be centered to start motors
    • need to be in MANUAL mode to start the motors

Autopilot modes

For rotorcrafts we have a lot of different modes that can be mapped to your 3-position switch (Manual, Auto1, Auto2). The horizontal and vertical mode can be set differently as the following possible modes indicate (in parenthesis are the abbreviations displayed in the GCS strip).

Limiting max thrust via RC
Modes with 'automatic' thrust control (e.g. x_Z_HOLD and NAV) let you limit the maximum thrust via RC by default. So you should push your throttle stick up after entering such a mode so the vertical controller has some "room" to stabilize the altitude. Should something weird happen you can limit the max thrust by taking throttle back.
You can turn this behavior off by defining NO_RC_THRUST_LIMIT


AP_MODE_FAILSAFE (SAFE) 

This is a failsafe mode that gets triggered if:

  • RC signal is lost (and you are not in KILL or NAV mode)
  • GPS and RC is lost in NAV mode

The standard behaviour is that autopilot will level the rotorcraft out (setpoints to zero pitch and roll angles) and descend at 0.5m/s downwards. But this behavior can also be changed to something else ofcourse.

AP_MODE_KILL (KILL) 

Motors are simply switched off.

AP_MODE_RATE_DIRECT (RATE) 

This is basically the "most" 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.

AP_MODE_ATTITUDE_DIRECT (ATT) 

You control the attitude (roll, pitch and yaw angles), but the throttle is directly proportional to your stick position.

AP_MODE_RATE_RC_CLIMB (R_RCC) 

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 kept, down goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it can recenter itself.

AP_MODE_ATTITUDE_RC_CLIMB (A_RCC) 

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 kept, if you move the stick down it goes down at a speed proportional to your stick position (same for up). In this mode it makes sense to mount the spring for your throttle stick so it recenter itself.

AP_MODE_ATTITUDE_CLIMB (ATT_C) 

You control the attitude (roll, pitch and yaw angles) and the vertical speed. The vertical speed is set via fms (e.g. joystick).

AP_MODE_RATE_Z_HOLD (R_ZH) 

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 unless disabled with NO_RC_THRUST_LIMIT.

AP_MODE_ATTITUDE_Z_HOLD (A_ZH) 

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 unless disabled with NO_RC_THRUST_LIMIT.

AP_MODE_HOVER_DIRECT (HOVER) 

The rotorcraft hovers at the horizontal position you were at when entering this mode (position control). You still set the throttle directly with your RC. Yaw command on the RC allows for heading change. If USE_SPEED_REF=1 then pitch and roll commands in the RC control speed according to max speed set with REF_MAX_SPEED in the GUIDANCE_H section of airframe file.

AP_MODE_HOVER_CLIMB (HOV_C) 

The rotorcraft hovers at the position you were at when entering this mode (position control). RC commands work the same as in HOVER mode. The vertical speed is set via fms (e.g. joystick).

AP_MODE_HOVER_Z_HOLD (H_ZH)

The rotorcraft hovers at the 3D position you were at when entering this mode (position and altitude control). RC commands work the same as in HOVER mode.
Your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.

AP_MODE_NAV (NAV) 

Full navigation mode. The rotorcraft follows your flightplan.
If you have a valid RC signal, your throttle stick position still limits the max throttle authority unless disabled with NO_RC_THRUST_LIMIT.

AP_MODE_RC_DIRECT (RC_D) 

Safety pilot direct commands for helicopter.

AP_MODE_CARE_FREE_DIRECT (CF)

Same as AP_MODE_ATTITUDE_DIRECT, but the roll and pitch commands are based on the yaw angle when entering this mode.

XML Parameters

Mode

In the mode section you can set the autopilot modes associated with your 3-way mode switch on your RC.

File: conf/airframes/myrotorcraft.xml
  <section name="MODE" prefix="MODE_">
    <define name="MANUAL" value="AP_MODE_ATTITUDE_DIRECT" />
    <define name="AUTO1" value="AP_MODE_ATTITUDE_Z_HOLD" />
    <define name="AUTO2" value="AP_MODE_NAV" />
  </section>

Commands

The commands lists the abstract commands you need to control the aircraft. For most multicopter you just need:

File: conf/airframes/myrotorcraft.xml
  <commands>
    <axis name="PITCH" failsafe_value="0"/>
    <axis name="ROLL" failsafe_value="0"/>
    <axis name="YAW" failsafe_value="0" />
    <axis name="THRUST" failsafe_value="0"/>
  </commands>

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.

Motor Mixing

This section describes the "mixing" used for your particular multirotor configuration. This section is needed for all ESCs except "asctec_v1" wich do their mixing themselves.

Used since v5.0, for previous version see Supervision.

Differences with the older supervision (used prior to v4.9_devel-164-gdb0d004):
  • names: SUPERVISION -> MOTOR_MIXING
  • independent of the actuators, needs to be loaded in the subsystems and call in the command_laws section
  • internal values have pprz format (int16, between [-9600; 9600])
  • min and max are not needed, coming from the servos definition
  • trim are renamed with more explicit names

This subsystem takes roll, pitch, yaw and thrust commands as inputs and "mixes" them to get the final commands for your individual motors according to the layout of them. See RotorcraftMixing for the details behind this.

Note that after mixing the separate motor commands can "saturate", meaning you can't simply give negative thrust or more than the maximum. If a saturation is reached (desired motor command outside of possible MIN_MOTOR/MAX_MOTOR range), a saturation offset is applied to all motors in order to give attitude commands a higher priority than thrust. This offset is limited to MOTOR_MIXING_MAX_SATURATION_OFFSET (default is 10% of maximum command).

See also issue #385.

In firmware section:

File: conf/airframes/myrotorcraft.xml
  <firmware name="rotorcraft">
     ...
    <subsystem name="motor_mixing"/>
     ...
  </firmware>

Configuration of the motor mixing:

File: conf/airframes/myrotorcraft.xml
  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TRIM_ROLL" value="0"/>
    <define name="TRIM_PITCH" value="0"/>
    <define name="TRIM_YAW" value="0"/>
    <define name="MAX_SATURATION_OFFSET"	value="MAX_PPRZ/10"/>
    <define name="NB_MOTOR" value="4"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{  0  ,    0,  256, -256 }"/>
    <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
    <define name="YAW_COEF"    value="{ -256, -256,  256,  256 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
  </section>
TRIM_ROLL 
trim added to roll command
TRIM_PITCH 
trim added to pitch command
TRIM_YAW 
trim added to yaw command
MAX_SATURATION_OFFSET 
set at "MAX_PPRZ/10" by default
x_COEF 
roll/pitch/yaw/thrust coefficients, see RotorcraftMixing for details or the examples below

In command_laws section (placed after section MIXING):

File: conf/airframes/myrotorcraft.xml
  <command_laws>
    <call fun="motor_mixing_run(autopilot_motors_on, FALSE, values)"/>
    <set servo="FRONT" value="motor_mixing.commands[0]"/>
    <set servo="BACK"  value="motor_mixing.commands[1]"/>
    <set servo="RIGHT" value="motor_mixing.commands[2]"/>
    <set servo="LEFT"  value="motor_mixing.commands[3]"/>
  </command_laws>

Mixing Examples

Hint: If your rotors are spinning opposite to the direction shown in the picture, reverse signs in the YAW_COEF line.

Plus Cross 
Cross plus simple.png

Assuming that the order of motors, described in the "servos" section is FRONT, RIGHT, BACK, LEFT.

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="NB_MOTOR" value="4"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{    0, -256,    0,  256 }"/>
    <define name="PITCH_COEF"  value="{  256,    0, -256,    0 }"/>
    <define name="YAW_COEF"    value="{ -128,  128, -128,  128 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
  </section>

This is equivalent to (available since v5.5_devel-602-g0129d3e):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="QUAD_PLUS"/>
  </section>
Time Cross 
Cross time simple.png

Assuming that the order of motors, described in the "servos" section is NW, NE, SE, SW.

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="NB_MOTOR" value="4"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{  181, -181, -181,  181 }"/>
    <define name="PITCH_COEF"  value="{  181,  181, -181, -181 }"/>
    <define name="YAW_COEF"    value="{  128, -128,  128,  128 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
  </section>

This is equivalent to (available since v5.5_devel-602-g0129d3e):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="QUAD_X_CCW"/>
  </section>

This is equivalent to (available since v5.9_devel):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="QUAD_X"/>
    <define name="REVERSE" value="true"/>
  </section>


Hex (Time Cross) 
Hex cross layout.png

Assuming that the order of motors, described in the "servos" section is FRONT_LEFT, FRONT_RIGHT, RIGHT, BACK_RIGHT, BACK_LEFT, LEFT.

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="NB_MOTOR" value="6"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{  128, -128,  -256,  -128,  128, 256 }"/>
    <define name="PITCH_COEF"  value="{  222,  222,     0,  -222, -222,   0 }"/>
    <define name="YAW_COEF"    value="{ -128,  128,  -128,   128, -128, 128 }"/>
    <define name="THRUST_COEF" value="{  256,  256,   256,   256,  256, 256 }"/>
  </section>

This is equivalent to (available since v5.5_devel-602-g0129d3e):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="HEXA_X"/>
  </section>


Octo (time cross)
Octo.jpg
  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="NB_MOTOR" value="8"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{   98,  -98, -237, -237,  -98,   98,  237,  237 }"/>
    <define name="PITCH_COEF"  value="{  237,  237,   98,  -98, -237, -237,  -98,   98 }"/>
    <define name="YAW_COEF"    value="{ -128,  128, -128,  128, -128,  128, -128,  128 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256,  256,  256,  256,  256 }"/>
  </section>

This is equivalent to (available since v5.5_devel-602-g0129d3e):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="OCTO_X"/>
  </section>


Octo (plus cross)
Octo plus motor layout.png
  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="NB_MOTOR" value="8"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{    0, -181, -256, -181,    0,  181,  256,  181 }"/>
    <define name="PITCH_COEF"  value="{  256,  181,    0, -181, -256, -181,    0,  181 }"/>
    <define name="YAW_COEF"    value="{ -128,  128, -128,  128, -128,  128, -128,  128 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256,  256,  256,  256,  256 }"/>
  </section>

This is equivalent to (available since v5.5_devel-602-g0129d3e):

  <section name="MIXING" prefix="MOTOR_MIXING_">
    <define name="TYPE" value="OCTO_PLUS"/>
  </section>


If you want to compute mixing for a special configuration, please see the RotorcraftMixing page.

Supervision

Prior to v5.0 motor mixing was called supervision. Click expand to see the details.

Valid before v4.9_devel-164-gdb0d004

  <section name="SUPERVISION" prefix="SUPERVISION_">
    <define name="STOP_MOTOR" value="0"/> <!-- this defaults to zero, set to a different value if needed, e.g. for pwm controllers -->
    <define name="MIN_MOTOR" value="3"/>
    <define name="MAX_MOTOR" value="200"/>
    <define name="TRIM_A" value="0"/>
    <define name="TRIM_E" value="0"/>
    <define name="TRIM_R" value="0"/>
    <define name="NB_MOTOR" value="4"/>
    <define name="SCALE" value="256"/>
    <define name="ROLL_COEF"   value="{  0  ,    0,  256, -256 }"/>
    <define name="PITCH_COEF"  value="{  256, -256,    0,    0 }"/>
    <define name="YAW_COEF"    value="{ -256, -256,  256,  256 }"/>
    <define name="THRUST_COEF" value="{  256,  256,  256,  256 }"/>
  </section>
STOP_MOTOR 
actuator specific command value to stop the motors
MIN_MOTOR 
actuator specific command value for idling motors
MAX_MOTOR 
actuator specific command value for maximum power
TRIM_A 
trim added to roll command
TRIM_E 
trim added to pitch command
TRIM_R 
trim added to yaw command
x_COEF 
roll/pitch/yaw/thrust coefficients, see RotorcraftMixing for details or the examples in the above Motor Mixing section

Guidance

There are two sets of parameters for guidance: vertical (altitude) and horizontal (position).

vertical guidance

File: conf/airframes/myrotorcraft.xml
  <section name="GUIDANCE_V" prefix="GUIDANCE_V_">
    <define name="HOVER_KP"    value="150"/>
    <define name="HOVER_KD"    value="80"/>
    <define name="HOVER_KI"    value="20"/>

    <!-- optional parameters -->
    <define name="NOMINAL_HOVER_THROTTLE" value="0.5"/>
    <define name="ADAPT_THROTTLE_ENABLED" value="TRUE"/>
    <define name="REF_MIN_ZD" value="-3.0" unit="m/s"/>
    <define name="REF_MAX_ZD" value="3.0" unit="m/s"/>
    <define name="MAX_RC_CLIMB_SPEED" value="-3.0" unit="m/s"/>
    <define name="MAX_RC_DESCENT_SPEED" value="3.0" unit="m/s"/>
  </section>
HOVER_K
PID parameters for vertical hover control loop
NOMINAL_HOVER_THROTTLE 
expected throttle percentage needed for hovering (default is 0.4 = 40%)
ADAPT_THROTTLE_ENABLED 
enable adaptive nominal hover throttle estimation (default is TRUE, set to FALSE to disable)
REF_MIN_ZD 
vertical speed reference lower limit (since z-down is positive -> max speed upwards) (default -3.0m/s)
REF_MAX_ZD 
vertical speed reference upper limit (since z-down is positive -> max speed downwards) (default 3.0m/s)
MAX_RC_CLIMB_SPEED 
climb speed at max RC input in RC_CLIMB mode (default is REF_MIN_ZD)
MAX_RC_DESCENT_SPEED 
descent speed at max RC input in RC_CLIMB mode (default is REF_MAX_ZD)

horizontal guidance

File: conf/airframes/myrotorcraft.xml
  <section name="GUIDANCE_H" prefix="GUIDANCE_H_">
    <define name="PGAIN" value="50"/>
    <define name="DGAIN" value="100"/>
    <define name="IGAIN" value="20"/>

    <!-- optional parameters -->
    <define name="AGAIN" value="0"/>
    <define name="VGAIN" value="0"/>

    <define name="MAX_BANK" value="20" unit="deg"/>
    <define name="USE_SPEED_REF" value="TRUE"/>
    <define name="REF_MAX_SPEED" value="5.0" unit="m/s"/>
    <define name="REF_MAX_ACCEL" value="5.66" unit="m/s2"/>
    <define name="REF_OMEGA" value="67" unit="deg"/>
    <define name="REF_ZETA" value="0.85"/>
    <define name="REF_TAU" value="0.5"/>
    <define name="APPROX_FORCE_BY_THRUST" value="FALSE"/>
  </section>
[PID]GAIN 
PID gains for horizontal control
AGAIN 
acceleration feedforward gain (default 0)
VGAIN 
velocity feedforward gain (default 0)
MAX_BANK 
maximum roll/pitch angle that is set from horizontal guidance (default 20deg, max 40deg)
USE_SPEED_REF 
since v5.1, give velocity commands via RC in GUIDANCE_H_MODE_HOVER (default: TRUE)
REF_MAX_SPEED 
maximum reference horizontal speed in m/s (default 5.0m/s)
REF_MAX_ACCEL 
maximum reference horizontal acceleration in m/s² (default tanf(RadOfDeg(30.))*9.81 = 5.66)
REF_OMEGA 
second order model natural frequency
REF_ZETA 
second order model damping
REF_TAU 
first order time constant
APPROX_FORCE_BY_THRUST 
try to better approximate force commands by taking thrust into account (default FALSE, set to TRUE to use it)

Simulation

See NPS (New Paparazzi Sim).