MAVLINKHUD

Overview

The CUST parameter group allows for defining arbitrary 3D rotations (Euler Angles) for sensor mounting.

While standard ArduPilot parameters (like AHRS_ORIENTATION or COMPASS_ORIENT) provide a list of preset rotations (e.g., Yaw90, Pitch180), these presets are typically limited to 45-degree or 90-degree increments. The CUST group enables precise alignment for sensors mounted at odd angles (e.g., a GPS mast tilted 15 degrees back).

Key Concepts

1. Enable Custom Rotation (CUST_ROT_ENABLE)

This master switch enables the custom rotation engine.

2. Defining the Rotation (CUST_ROTx_...)

You can define up to 2 unique custom rotations. Each is defined by a Roll, Pitch, and Yaw angle.

  • Rotation 1: Used when AHRS_ORIENTATION (or other orientation param) is set to 100 (Custom 1).
  • Rotation 2: Used when the parameter is set to 101 (Custom 2).

Parameter Breakdown

  • CUST_ROT1_ROLL / PITCH / YAW: Euler angles for Custom Rotation 1.
  • CUST_ROT2_ROLL / PITCH / YAW: Euler angles for Custom Rotation 2.

Integration Guide

Example: Tilted GPS

If you mount your GPS/Compass module on a mast that is tilted 30 degrees backward:

  1. Set CUST_ROT_ENABLE = 1.
  2. Set CUST_ROT1_PITCH = 30.
  3. Set CUST_ROT1_ROLL and CUST_ROT1_YAW to 0 (assuming it faces forward).
  4. Set COMPASS_ORIENT = 100 (Custom 1).
  5. Reboot and verify the heading works correctly when you tilt the vehicle.

Developer Notes

  • Library: libraries/AP_CustomRotations
  • Math: Uses standard Euler sequence (Yaw -> Pitch -> Roll) to construct a rotation matrix.

CUST_ROT1_PITCH

deg
Default 0
Range -180 180

Custom Rotation 1 - Pitch (CUST_ROT1_PITCH)

Description

Defines the pitch angle for the first custom software rotation.

  • Ordering: Euler 321 (Yaw, then Pitch, then Roll).

CUST_ROT1_ROLL

deg
Default 0
Range -180 180

Custom Rotation 1 - Roll (CUST_ROT1_ROLL)

Description

Defines the roll angle for the first custom software rotation.

  • Ordering: Euler 321 (Yaw, then Pitch, then Roll).

CUST_ROT1_YAW

deg
Default 0
Range -180 180

Custom Rotation 1 - Yaw (CUST_ROT1_YAW)

Description

Defines the yaw angle for the first custom software rotation.

  • Ordering: Euler 321 (Yaw, then Pitch, then Roll).

CUST_ROT2_PITCH

deg
Default 0
Range -180 180

Custom Rotation 2 - Pitch (CUST_ROT2_PITCH)

Description

Defines the pitch angle for the second custom software rotation.

CUST_ROT2_ROLL

deg
Default 0
Range -180 180

Custom Rotation 2 - Roll (CUST_ROT2_ROLL)

Description

Defines the roll angle for the second custom software rotation.

CUST_ROT2_YAW

deg
Default 0
Range -180 180

Custom Rotation 2 - Yaw (CUST_ROT2_YAW)

Description

Defines the yaw angle for the second custom software rotation.

CUST_ROT_ENABLE

Default 0
Range 0 1

Enable Custom rotations (CUST_ROT_ENABLE)

Description

Master switch for the custom rotations library. When enabled, it allows sensors (like compasses or IMUs) to use a specific user-defined rotation (Custom 1 or Custom 2) instead of the standard 45/90 degree increments.

Tuning & Behavior

  • Default Value: 0 (Disabled)
  • Requires reboot to take effect.