MAVLINKHUD

Overview

The CC parameter group configures the Custom Controller library. This feature provides a sandbox for developers and researchers to implement custom attitude control algorithms (e.g., INDI, L1 adaptive, or novel PID variants) without replacing the core AC_AttitudeControl library.

The custom controller runs in parallel with the standard controller, and its output is mixed or swapped in based on the configuration.

Key Concepts

1. Axis Masking (CC_AXIS_MASK)

You don't have to replace the entire controller. You can take over just one axis.

  • Bit 0: Roll.
  • Bit 1: Pitch.
  • Bit 2: Yaw.
  • Example: Set to 4 to use the custom controller for Yaw only, while keeping standard PID for Roll/Pitch.

2. Backend Selection (CC_TYPE)

Selects which custom backend logic to execute.

  • 0: Disabled.
  • 1: Empty (Pass-through/Template).
  • 2: PID (Example implementation).
  • 3: INDI (Incremental Nonlinear Dynamic Inversion).

3. Generic Parameters (CC_PARAMx)

To avoid hardcoding gains, the library exposes generic floating-point parameters (CC_PARAM1...CC_PARAM3) that are readable by the custom backend code.

Parameter Breakdown

  • CC_TYPE: Active backend.
  • CC_AXIS_MASK: Active axes.
  • CC_PARAM1: User-defined tuning variable 1.

Integration Guide

  • For Users: Unless you are running a specific firmware build that documents what CC_PARAM1 does, leave this disabled (CC_TYPE = 0).
  • For Developers: Use libraries/AC_CustomControl as a template. The update() method is called at the main loop rate (400Hz+).

Developer Notes

  • Library: libraries/AC_CustomControl
  • Safety: If your custom controller outputs NaN or crashes, the vehicle will likely crash. Test in SITL first.

CC_AXIS_MASK

Default 0

Custom Controller bitmask (CC_AXIS_MASK)

Description

Defines the specific axes that are handed over to the custom controller. When an axis bit is set, the standard ArduPilot attitude controller for that axis is bypassed.

Tuning & Behavior

  • Default Value: 0
  • Bitmask:
    • Bit 0: Roll
    • Bit 1: Pitch
    • Bit 2: Yaw

CC_PARAM1

Default 0.0f

Custom Controller Param 1 (CC_PARAM1)

Description

This is a generic placeholder parameter provided by the Custom Control library. It allows developers to pass tunable values to their custom C++ controller algorithms without needing to modify the main parameter table or recompile the entire parameter definitions.

The Mathematics

User-defined by the custom controller implementation.

The Engineer's View

Defined in libraries/AC_CustomControl/AC_CustomControl_Empty.cpp.

  • Usage: If you are running standard firmware, this parameter does nothing. If you have loaded a custom build with a specific AC_CustomControl backend, refer to that backend's documentation for the meaning of this value (e.g., gain, limit, or coefficient).

Tuning & Behavior

  • Default Value: 0.0
  • Note: Only useful for developers or users of custom control branches.

CC_PARAM2

Default 0.0f

Custom Controller Param 2 (CC_PARAM2)

Description

Generic parameter placeholder for Custom Control backends. See CC_PARAM1 for details.

The Mathematics

User-defined.

The Engineer's View

Defined in libraries/AC_CustomControl/AC_CustomControl_Empty.cpp.

Tuning & Behavior

  • Default Value: 0.0

CC_PARAM3

Default 0.0f

Custom Controller Param 3 (CC_PARAM3)

Description

Generic parameter placeholder for Custom Control backends. See CC_PARAM1 for details.

The Mathematics

User-defined.

The Engineer's View

Defined in libraries/AC_CustomControl/AC_CustomControl_Empty.cpp.

Tuning & Behavior

  • Default Value: 0.0

CC_TYPE

Default 0

Custom control type (CC_TYPE)

Description

Enables the custom attitude control module and selects the backend implementation (e.g., a simple template or a PID-based controller).

Tuning & Behavior

  • Default Value: 0 (None)
  • Values: 0:None, 1:Empty (Template), 2:PID
  • Requires reboot to initialize the selected controller.