MAVLINKHUD

Overview

The PTCH parameter group (often appearing as PTCH_ or PTCH2SRV_) configures the Pitch Attitude Controller for ArduPlane.

This library is responsible for maintaining the requested pitch angle (e.g., "Nose up 5 degrees") and rotation rates of the aircraft by driving the elevator servos.

Key Concepts

1. Pitch-to-Servo (PTCH2SRV_...)

This is the primary PID controller for fixed-wing pitch.

  • PTCH2SRV_P/I/D: Standard PID gains.
  • PTCH2SRV_TCONST: The time constant (seconds) for the pitch response. Lower values make the plane more responsive but require higher gains.

2. Rate Limits (PTCH2SRV_RMAX_UP / DN)

Defines the maximum physical rotation rate (deg/s) of the airframe. This prevents the autopilot from requesting a maneuver so sharp that it stalls the wing or damages the structure.

3. Trim (PTCH_TRIM_DEG)

Allows for a software-defined pitch offset. If the plane requires a few degrees of up-elevator to fly level at cruise speed, you can enter that offset here to avoid "fighting" the PID integrator.

Parameter Breakdown

  • PTCH2SRV_P: Proportional gain (immediate elevator response).
  • PTCH2SRV_TCONST: Speed of response (typically 0.4s to 0.7s).
  • PTCH2SRV_RLL: Pitch compensation in turns (automatically adds up-elevator when banking to maintain altitude).

Integration Guide

  • Tuning: Use AUTOTUNE in ArduPlane to set these gains. It is much safer and more accurate than manual tuning for fixed-wing aircraft.

Developer Notes

  • Library: libraries/APM_Control/AP_PitchController.cpp.

PTCH2SRV_RLL

Default 1.0
Range 0.7 1.5

Roll Compensation (PTCH2SRV_RLL)

Description

PTCH2SRV_RLL is the "Turn Coordination" elevator boost.

When a plane banks, it loses vertical lift component. To stay level, you must pull back on the stick. This parameter does that automatically.

  • 1.0 (Default): Calculated compensation based on physics.
  • > 1.0: Pulls harder in turns (gains altitude).
  • < 1.0: Pulls less (loses altitude).

Tuning & Behavior

  • Default Value: 1.0.
  • Recommendation: Tune this by flying continuous circles in FBWA mode. If the nose drops, increase this value. If the nose rises, decrease it.

PTCH2SRV_RMAX_DN

deg/s
Default 0
Range 0 100

Pitch Down Max Rate (PTCH2SRV_RMAX_DN)

Description

PTCH2SRV_RMAX_DN limits how fast the nose can push down.

This is critical for preventing negative-G structural failures or engine starvation (if your fuel tank pickup doesn't like negative Gs).

PTCH2SRV_RMAX_UP

deg/s
Default 0
Range 0 100

Pitch Up Max Rate (PTCH2SRV_RMAX_UP)

Description

PTCH2SRV_RMAX_UP limits the G-force of a pull-up maneuver.

If you set this to a reasonable value (e.g. 60 $deg/s$), the autopilot will never try to pull the nose up faster than that, even if you yank the stick back or the navigation controller demands a steep climb. This protects the wings from snapping.

Tuning & Behavior

  • Default Value: 0 (Unlimited).
  • Recommendation: Set to match your airframe's structural limits or your desired flight style.

PTCH2SRV_TCONST

s
Default 0.5
Range 0.4 1.0

Pitch Time Constant (PTCH2SRV_TCONST)

Description

PTCH2SRV_TCONST defines how fast the plane responds to a pitch command.

If you command a 10-degree pitch up, this parameter determines how quickly the rate controller is asked to get there.

  • Low Value (0.4): Snappy response.
  • High Value (0.8): Smooth, relaxed response.

Tuning & Behavior

  • Default Value: 0.5 seconds.
  • Recommendation: Match this to the physical capabilities of your plane. A heavy cargo plane physically cannot pitch up as fast as a fighter jet, so it needs a larger time constant.

PTCH_RATE_D

Default 0.004
Range 0.001 0.03

Pitch Rate D Gain (PTCH_RATE_D)

Description

PTCH_RATE_D stops the nose from bouncing.

When you release the elevator stick, the plane should stop pitching instantly. If it bounces up and down before settling, you need more D.

Tuning & Behavior

  • Default Value: 0.004.
  • Recommendation: Tune carefully. Too much D causes rapid vibration and hot servos.

PTCH_RATE_D_FF

null
Default 0
Range null

FF FeedForward Gain

Note: This parameter configures instance D_FF. It functions identically to RLL_RATE_D_FF.

PTCH_RATE_FF

Default 0.345
Range 0 3.0

Pitch Rate Feed-Forward (PTCH_RATE_FF)

Description

PTCH_RATE_FF is the primary gain for pitch control.

It predicts how much elevator is needed to achieve a certain pitch rate based on the physics of the airframe.

Tuning & Behavior

  • Default Value: 0.345.
  • Recommendation: This is the most critical parameter to tune. Use Autotune or increase slowly until the pitch rate matches the stick input perfectly.

PTCH_RATE_FLTD

Hz
Default AC_PID_DFILT_HZ_DEFAULT
Range null

PID D term filter frequency in Hz

Note: This parameter configures instance FLTD. It functions identically to RLL_RATE_FLTD.

PTCH_RATE_FLTE

Hz
Default AC_PID_EFILT_HZ_DEFAULT
Range null

PID Error filter frequency in Hz

Note: This parameter configures instance FLTE. It functions identically to RLL_RATE_FLTE.

PTCH_RATE_FLTT

Hz
Default AC_PID_TFILT_HZ_DEFAULT
Range null

PID Target filter frequency in Hz

Note: This parameter configures instance FLTT. It functions identically to RLL_RATE_FLTT.

PTCH_RATE_I

Default 0.15
Range 0.01 0.6

Pitch Rate I Gain (PTCH_RATE_I)

Description

PTCH_RATE_I compensates for Center of Gravity (CG) errors.

If your plane is nose-heavy, the I-term will learn to hold a little bit of "Up Elevator" to keep the nose level without you having to hold the stick back.

Tuning & Behavior

  • Default Value: 0.15.
  • Recommendation: Usually set equal to PTCH_RATE_FF.

PTCH_RATE_IMAX

Default 0.666
Range 0 1

Pitch Rate I Max (PTCH_RATE_IMAX)

Description

PTCH_RATE_IMAX limits the authority of the I-term.

If your CG is dangerously far back or forward, the I-term will try to fix it by moving the elevator. This limit prevents it from using up all the elevator travel, ensuring you still have some control left for maneuvering.

Tuning & Behavior

  • Default Value: 0.666.

PTCH_RATE_P

Default 0.15
Range 0.08 0.35

Pitch Rate P Gain (PTCH_RATE_P)

Description

PTCH_RATE_P is the "Instant Reaction" gain for the elevator.

When you pull back on the stick, you command a pitch rate. This gain forces the elevator to move proportionally to the error between your command and the gyro's measurement.

Tuning & Behavior

  • Default Value: 0.15.
  • Too Low: Mushy, slow pitch response.
  • Too High: Rapid "Dolphin" oscillations or flutter.

PTCH_RATE_PDMX

null
Default 0
Range null

PD sum maximum

Note: This parameter configures instance PDMX. It functions identically to RLL_RATE_PDMX.

PTCH_RATE_SMAX

Default 0
Range 0 200

Pitch Slew Rate Limit (PTCH_RATE_SMAX)

Description

PTCH_RATE_SMAX limits how fast the elevator servo can move.

  • 0: Disabled (Unlimited speed).

Tuning & Behavior

  • Use Case: Enable this if you have large control surfaces that might cause structural damage if moved too quickly at high speed.

PTCH_TRIM_DEG

deg
Default 0.0f
Range -45 45

Pitch angle offset (PTCH_TRIM_DEG)

Description

This parameter trims the aircraft's pitch attitude definition of "Level Flight". If your plane flies level but the HUD shows it is pitched up (or down), you can adjust this parameter to align the autopilot's horizon with reality. It effectively rotates the AHRS solution.

The Mathematics

$$ \theta\_{\text{nav}} = \theta\_{\text{imu}} - \text{PTCH\_TRIM\_DEG} $$

The Engineer's View

Defined in ArduPlane/Parameters.cpp.

  • Usage: Alternative to performing a "Level Horizon" calibration on the bench. Useful for tuning in the field.

Tuning & Behavior

  • Default Value: 0.0 deg
  • Adjustment: If the plane loses altitude in "Level" flight modes (FBWA), increase this value (pitch up).