px4: actuators control, control group 和 mixer科普

原文链接:https://pixhawk.org/dev/mixing


Control Mixing

This page discusses the general-purpose control mixing architecture in PX4. If you are looking for specific mixer setup instructions, you should go to the Platforms page.

The description of the mixer definition language is in the  source code README file on Github.  Check out the graphical example below as well!

Custom Mixer

Custom mixer files can be put onto the microSD card. This is described in the startup documentation.

Terminology

  • Actuator Control Groups: An actuator control group is a set of 8 outputs which cover one type of actuation, e.g. for the airframe, payload or gimbals. It is emitted by an actuator and the  input to the mixer. Different control groups can be emitted by different processes.
  • Mixers: A mixer is a set of individual scalers / mappers which read from control inputs and write to actuator outputs.
  • Actuator Output Groups: An actuator output group is a set of 1 to 8 outputs which are part of one physical output device, e.g. PX4FMU or PX4IO. It represents the output of the mixer.

Video Example

The mixing architecture is capable to deal with relatively complex airframes, as shown in this video:



Example Mixers and Syntax Explanation

The following image explains the mixing for a wing only elevon configuration (roll and pitch inputs mixed together for 2 elevon servo actuators) The “output channels” (Pixhawk pins) are assigned to the mixer description file based upon the order they appear in the mix's file:

If you wanted to change only the second output, channel-1 (Pixhawk pin 2), you still need an entry for first output, channel-0 (Pixhawk pin 1)

EXAMPLE:  Roll has no mix here, but is needed to have the pitch description be second in the file.

When using the multirotor mixer (R:), it takes the place of the first three output pins mixes. The first mix after an “R:” is pin4.

Output Groups and Rates

Setting a high output rate (>50Hz) can burn analog servos. Due to physical constraints some output channel rates can only be set in conjunction with other channels.

Configuration

The output rates can be configured with this command line app: pwm (Application) or via IOCTLs (please refer to the source code of the app for examples on how to use the IOCTL interface).

Output Rates

The default output rate in the RC industry is 50 Hz, which normal analog servos sustain well. Digital servos can accept higher rates. The recommended output rate for multicopter ESCs is 400 Hz, in order to minimise latency (NOT because the outputs would require 400 Hz, as multicopter rotors spin only at 80-120 Hz and can't change speed multiple times during a single revolution, but to actually overcome the input filtering most motor controllers have and to minimize worst-case latency if the attitude control loop is not synchronized to the PWM generation).

Output Groups

The hardware generating the PWM signal is grouped into different timers, and each timer outputs on one or multiple pins. These pins can change their output rate only together. The three groups for IO (MAIN output on Pixhawk) are:

  • channel group 0: channels 1 2
  • channel group 1: channels 5 6 7 8
  • channel group 2: channels 3 4

Attempting to set only a part of the channels of an output group to a different rate will fail, as the whole group has to be set at once

Mixing Details

Terminology

Mixer

A module that combines a set of inputs according to pre-defined rules and parameters to produce a set of outputs.

Scaler

An arithmetic module that adjusts a single input according to parameters to generate a single output.

Input

Inputs are expected to be in the range -1.0 (-10000) to 1.0 (10000) for roll, pitch and yaw, and 0 - 1.0 (10000) for thrust and made available to the mixer by the module or component that owns the mixer. This may be a vehicle control such as 'roll', or any other number.

Output

The result of applying the mixer rules to zero or more inputs.

Mixing Basics

A module invokes a mixer (or mixer group, see below) when it wants to generate a fresh set of outputs; for example, when it is notified that the inputs it has been watching have changed.

The mixer will obtain the inputs it requires, scale and mix them according to the mixer definition, and generate the output set. The module is then free to use the outputs as required; for example to update servo outputs, or to publish the results for other modules to use.

Scaling

Mixer inputs are often scaled in order to adjust the relative significance of each input during the mixing phase. Several different scaling approaches are used, depending on circumstance.

Simple Scaling

The simplest form of scaling simply multiplies the input value by a constant scaling factor. This approach is used when the base value for an input is well-known, or the value is not otherwise required to be adjusted.

Linear Scaling

This scaling technique allows for asymmetrical scaling either side of input zero, as well as biasing the result and clamping the output.

Inputs to this scaler are:

  • negative scale factor
  • positive scale factor
  • offset
  • lower output limit
  • upper output limit

The scaling workflow looks like this:

if (input < 0)
    output = (input * NEGATIVE_SCALE) + OFFSET
else
    output = (input * POSITIVE_SCALE) + OFFSET

if (output < LOWER_LIMIT)
    output = LOWER_LIMIT
if (output > UPPER_LIMIT)
    output = UPPER_LIMIT

Mixers

The rules that are applied vary from mixer to mixer, with the following mixers being defined:

Simple Mixer

As its name suggests, the simple mixer reads one or more inputs, scales them, sums the scaled values, scales the result and returns a single output.

 input      input     input
   |          |         |
   v          v         v
 scale      scale     scale
   |          |         |
   |          v         |
   +-------> mix <------+
              |
            scale
              |
              v
            output

Parameters to the simple mixer are:

  • the set of inputs
  • scaling parameters for each input
  • scaling parameters for the output

Both the input and output scaling is performed using linear scalers.

Multirotor Mixer

This mixer is designed for mixing flight controls (roll, pitch, yaw, thrust) to produce motor speed control outputs suitable for multirotor air vehicles.

Parameters to the multirotor mixer (R:) are:

R: <geometry> <roll scale> <pitch scale> <yaw scale> <deadband>

  • the geometry of the vehicle
  • separate roll, pitch and yaw control scaling factors
  • motor output deadband

A variety of vehicle geometries are known to the mixer, including common quad (4X,4+), hex (6X,6+) and octo (8X,8+) and tri (3y)configurations. The mixer can be extended to any configuration that can be expressed using separate roll, pitch and yaw compensation factors for each rotor. In all cases, simple scaling is applied to the inputs.

Ratio Clamping

The output from the multirotor mixer is clamped such that at most one rotor output is saturated, in order to avoid issues rolling heavy vehicles, and the output value is never permitted to fall into the deadband in order to avoid issues with motor re-start whilst in flight.

In addition to that, any clamping respects the ratio of the input, to prevent multi rotors from flipping over. If a motor gets into positive or negative saturation, the overall thrust will be reduced so that the ratio between the individual motors can be satisfied without saturation.

Clamping Example

Input (quadrotor, four motors), Limit is 100:

150 75 75 75

Resulting clamped output:

100 50 50 50

Note that motor 1 has still double the speed of motors 2-4, so the resulting attitude will be correct. The vehicle will however not increase altitude (or decrease altitude) compared to the non-clamped motor inputs. If the clamping would just limit motor 1, the vehicle may flip over or become unstable, because the ratio between the motors that defines the collective thrust plane is violated.

Control Groups

Control groups are grouped actuator control positions. These functional groups are centered around core flight control (group 0), auxiliary flight control (group 1), payload (group 2) and manual passthrough (group 3, e.g. for gimbal control).

Control groups 1, 2, and 3 are not sent to the actuators unless there is a change in control group 0. If, for example, aux0 was being used to control the pitch setting of a gimbal motor, the pitch would only change when the flight control motors associated with control group 0 were armed.

Control Group #0 (Flight Control)

  • 0: roll (-1..1)
  • 1: pitch (-1..1)
  • 2: yaw (-1..1)
  • 3: throttle (0..1 normal range, -1..1 for variable pitch / thrust reversers)
  • 4: flaps (-1..1)
  • 5: spoilers (-1..1)
  • 6: airbrakes (-1..1)
  • 7: landing gear (-1..1)

Control Group #1 (Flight Control VTOL/Alternate)

  • 0: roll ALT (-1..1)
  • 1: pitch ALT (-1..1)
  • 2: yaw ALT (-1..1)
  • 3: throttle ALT (0..1 normal range, -1..1 for variable pitch / thrust reversers)
  • 4: reserved / aux0
  • 5: reserved / aux1
  • 6: reserved / aux2
  • 7: reserved / aux3

Control Group #2 (Payload)

  • 0: gimbal roll
  • 1: gimbal pitch
  • 2: gimbal yaw
  • 3: gimbal shutter
  • 4: reserved
  • 5: reserved
  • 6: reserved
  • 7: reserved (parachute, -1..1)

Control Group #3 (Manual Passthrough)

  • 0: RC roll
  • 1: RC pitch
  • 2: RC yaw
  • 3: RC throttle
  • 4: RC mode switch
  • 5: RC aux1
  • 6: RC aux2
  • 7: RC aux3

Virtual Control Groups

These groups are NOT mixer inputs, but serve as meta-channels to feed fixed wing and multicopter controller outputs into the VTOL governor module.

Control Group #4 (Flight Control MC VIRTUAL)

  • 0: roll ALT (-1..1)
  • 1: pitch ALT (-1..1)
  • 2: yaw ALT (-1..1)
  • 3: throttle ALT (0..1 normal range, -1..1 for variable pitch / thrust reversers)
  • 4: reserved / aux0
  • 5: reserved / aux1
  • 6: reserved / aux2
  • 7: reserved / aux3

Control Group #5 (Flight Control FW VIRTUAL)

  • 0: roll ALT (-1..1)
  • 1: pitch ALT (-1..1)
  • 2: yaw ALT (-1..1)
  • 3: throttle ALT (0..1 normal range, -1..1 for variable pitch / thrust reversers)
  • 4: reserved / aux0
  • 5: reserved / aux1
  • 6: reserved / aux2
  • 7: reserved / aux3

你可能感兴趣的:(px4: actuators control, control group 和 mixer科普)