Difference between revisions of "Rotorcraft Configuration"

From PaparazziUAV
Jump to navigation Jump to search
m (Links added)
 
(6 intermediate revisions by 4 users not shown)
Line 90: Line 90:
** switch kill switch off to arm the motors
** 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
** if kill switch is off during startup, you need to kill again first, then unkill to start
** throttle needs to be down, other sticks centered to start motors
** throttle needs to be down, other sticks (including the trims) centered to start motors  
** need to be in manual mode to start the motors
** need to be in [[AutopilotModes|MANUAL mode]] to start the motors


* USE_THROTTLE_FOR_MOTOR_ARMING defined (to 1):
* USE_THROTTLE_FOR_MOTOR_ARMING defined (to 1):
** automatically start motors when applying throttle
** automatically start motors when applying throttle
** if throttle was not down at startup, you need to put throttle down again first
** if throttle was not down at startup, you need to put throttle down again first
** other sticks need to be centered to start motors
** other sticks (including the trims) need to be centered to start motors
** need to be in manual mode to start the motors
** need to be in [[AutopilotModes|MANUAL mode]] to start the motors


== Autopilot modes ==
== Autopilot modes ==
Line 177: Line 177:
     <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>
Line 245: Line 245:
   <command_laws>
   <command_laws>
     <call fun="motor_mixing_run(autopilot_motors_on, FALSE, values)"/>
     <call fun="motor_mixing_run(autopilot_motors_on, FALSE, values)"/>
     <set servo="FRONT" value="motor_mixing.commands[0]/>
     <set servo="FRONT" value="motor_mixing.commands[0]"/>
     <set servo="BACK"  value="motor_mixing.commands[1]/>
     <set servo="BACK"  value="motor_mixing.commands[1]"/>
     <set servo="RIGHT" value="motor_mixing.commands[2]/>
     <set servo="RIGHT" value="motor_mixing.commands[2]"/>
     <set servo="LEFT"  value="motor_mixing.commands[3]/>
     <set servo="LEFT"  value="motor_mixing.commands[3]"/>
   </command_laws>
   </command_laws>
</source>
</source>
Line 258: Line 258:


; 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>
</source>


Line 280: Line 306:
Assuming that the order of motors, described in the "servos" section is FRONT_LEFT, FRONT_RIGHT, RIGHT, BACK_RIGHT, BACK_LEFT, LEFT.
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">
<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="ROLL_COEF"  value="{  128, -128,  -256,  -128,  128, 256 }"/>
     <define name="PITCH_COEF"  value="{  256256,    0,  -256, -256,  0 }"/>
     <define name="PITCH_COEF"  value="{  222222,    0,  -222, -222,  0 }"/>
     <define name="YAW_COEF"    value="{ -256256,  -256256, -256, 256 }"/>
     <define name="YAW_COEF"    value="{ -128128,  -128128, -128, 128 }"/>
     <define name="THRUST_COEF" value="{  256,  256,  256,  256,  256, 256 }"/>
     <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 289: 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>
</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>


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.

Latest revision as of 03: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_Kx
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).