AeroCoder Logo

Concepts

Controller Diagrams

Cascaded PID loops for multicopter, fixed-wing, and VTOL — from position setpoints down to rate commands.

PX4 uses cascaded PID controllers for all vehicle types. The outermost loop controls position, which feeds into velocity, then attitude, then angular rate. Each loop runs faster than the one above it.

Multicopter controller cascade

Position controller (mc_pos_control) → outputs velocity setpoint · Velocity controller (also in mc_pos_control) → outputs attitude + collective thrust setpoint · Attitude controller (mc_att_control) → outputs body rate setpoint · Rate controller (mc_rate_control) → outputs torque and thrust → Mixer → motor PWMs.

text

Multicopter controller cascade
─────────────────────────────────────────────────────────────────

  Position SP ──→ [Position Ctrl] ──→ Velocity SP
                         │
                         ▼
  Velocity SP ──→ [Velocity Ctrl] ──→ Attitude + Thrust SP
                         │
                         ▼
  Attitude SP ──→ [Attitude Ctrl] ──→ Rate SP
                         │
                         ▼
  Rate SP ─────→ [Rate Ctrl] ──────→ Torque + Thrust
                         │
                         ▼
                  [Control Allocator] ──→ Motor PWMs

  Modules:
    mc_pos_control   → position + velocity loops
    mc_att_control   → attitude loop
    mc_rate_control  → rate loop

Fixed-wing controller cascade

L1 / NPFG navigation → roll angle setpoint for lateral, pitch angle for longitudinal · TECS (Total Energy Control System) → manages altitude and airspeed by distributing energy between potential and kinetic · Attitude controller (fw_att_control) → outputs angular rate setpoints · Rate controller → outputs surface deflections.

text

Fixed-wing controller cascade
─────────────────────────────────────────────────────────────────

  Waypoint ──→ [NPFG Nav] ──→ Roll SP    (lateral)
  Altitude ──→ [TECS]     ──→ Pitch SP + Throttle (longitudinal)
                    │
                    ▼
  Attitude SP ──→ [FW Att Ctrl] ──→ Rate SP
                    │
                    ▼
  Rate SP ────→ [FW Rate Ctrl] ──→ Surface deflections
                    │
                    ▼
              [Control Allocator] ──→ Servo PWMs + Throttle

VTOL transition

VTOL vehicles switch between the multicopter and fixed-wing controller stacks during transition. The vtol_att_control module manages blending: it ramps MC motors down and FW surfaces up (or vice versa) based on airspeed and transition progress.

The key PID parameters follow a naming convention: MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D for the roll rate loop; MC_ROLL_P for the attitude loop; MPC_XY_P for position. The auto-tune feature (MC_AT_START) can automatically find rate PID gains.

← Previous

Flight Stack (Estimation & Control)

Next →

Flight Modes

Source: docs.px4.io ↗

On This Page

Multicopter controller cascadeFixed-wing controller cascadeVTOL transition

© 2024 AeroCoder. All rights reserved

TwitterYouTubeInstagram