MAVLink Include Files: common.xml

## MAVLink Protocol Version

The current MAVLink version is 2.3. The minor version numbers (after the dot) range from 1-255.

## MAVLink Type Enumerations

### AUTOQUAD_MAVLINK_DEFS_VERSION

Track current version of these definitions (can be used by checking value of AUTOQUAD_MAVLINK_DEFS_VERSION_ENUM_END). Append a new entry for each published change.

Value | Field Name | Description
--- | --- | ---
| AQ_MAVLINK_DEFS_VERSION_1 |

### AUTOQUAD_NAV_STATUS

Available operating modes/statuses for AutoQuad flight controller. Bitmask up to 32 bits. Low side bits for base modes, high side for additional active features/modifiers/constraints.

Value | Field Name | Description
--- | --- | ---
0 | AQ_NAV_STATUS_INIT | System is initializing
0x00000001 | AQ_NAV_STATUS_STANDBY | System is *armed* and standing by, with no throttle input and no autonomous mode
0x00000002 | AQ_NAV_STATUS_MANUAL | Flying (throttle input detected), assumed under manual control unless other mode bits are set
0x00000004 | AQ_NAV_STATUS_ALTHOLD | Altitude hold engaged
0x00000008 | AQ_NAV_STATUS_POSHOLD | Position hold engaged
0x00000010 | AQ_NAV_STATUS_GUIDED | Externally-guided (eg. GCS) navigation mode
0x00000020 | AQ_NAV_STATUS_MISSION | Autonomous mission execution mode
0x00000100 | AQ_NAV_STATUS_READY | Ready but *not armed*
0x00000200 | AQ_NAV_STATUS_CALIBRATING | Calibration mode active
0x00001000 | AQ_NAV_STATUS_NO_RC | No valid control input (eg. no radio link)
0x00002000 | AQ_NAV_STATUS_FUEL_LOW | Battery is low (stage 1 warning)
0x00004000 | AQ_NAV_STATUS_FUEL_CRITICAL | Battery is depleted (stage 2 warning)
0x01000000 | AQ_NAV_STATUS_DVH | Dynamic Velocity Hold is active (PH with proportional manual direction override)
0x02000000 | AQ_NAV_STATUS_DAO | Dynamic Altitude Override is active (AH with proportional manual adjustment)
0x04000000 | AQ_NAV_STATUS_CEILING_REACHED | Craft is at ceiling altitude
0x08000000 | AQ_NAV_STATUS_CEILING | Ceiling altitude is set
0x10000000 | AQ_NAV_STATUS_HF_DYNAMIC | Heading-Free dynamic mode active
0x20000000 | AQ_NAV_STATUS_HF_LOCKED | Heading-Free locked mode active
0x40000000 | AQ_NAV_STATUS_RTH | Automatic Return to Home is active
0x80000000 | AQ_NAV_STATUS_FAILSAFE | System is in failsafe recovery mode

### MAV_DATA_STREAM

Value | Field Name | Description
--- | --- | ---
| MAV_DATA_STREAM_PROPULSION | Motor/ESC telemetry data.

## MAVLink Commands (MAV_CMD)

### MAV_CMD_AQ_NAV_LEG_ORBIT (1 )

Orbit a waypoint.

Param | Description
--- | ---
1 | Orbit radius in meters
2 | Loiter time in decimal seconds
3 | Maximum horizontal speed in m/s
4 | Desired yaw angle at waypoint
5 | Latitude
6 | Longitude
7 | Altitude

### MAV_CMD_AQ_TELEMETRY (2 )

Start/stop AutoQuad telemetry values stream.

Param | Description
--- | ---
1 | Start or stop (1 or 0)
2 | Stream frequency in us
3 | Dataset ID (refer to aq_mavlink.h::mavlinkCustomDataSets enum in AQ flight controller code)
4 | Empty
5 | Empty
6 | Empty
7 | Empty

### MAV_CMD_AQ_REQUEST_VERSION (4 )

Request AutoQuad firmware version number.

Param | Description
--- | ---
1 | Empty
2 | Empty
3 | Empty
4 | Empty
5 | Empty
6 | Empty
7 | Empty

## MAVLink Messages

### AQ_TELEMETRY_F ( #150 )

Sends up to 20 raw float values.

Field Name | Type | Description
--- | --- | ---
Index | uint16_t | Index of message
value1 | float | value1
value2 | float | value2
value3 | float | value3
value4 | float | value4
value5 | float | value5
value6 | float | value6
value7 | float | value7
value8 | float | value8
value9 | float | value9
value10 | float | value10
value11 | float | value11
value12 | float | value12
value13 | float | value13
value14 | float | value14
value15 | float | value15
value16 | float | value16
value17 | float | value17
value18 | float | value18
value19 | float | value19
value20 | float | value20

### AQ_ESC_TELEMETRY ( #152 )

Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: // unsigned int state : 3; // unsigned int vin : 12; // x 100 // unsigned int amps : 14; // x 100 // unsigned int rpm : 15; // unsigned int duty : 8; // x (255/100) // - Data Version 2 - // unsigned int errors : 9; // Bad detects error count // - Data Version 3 - // unsigned int temp : 9; // (Deg C + 32) * 4 // unsigned int errCode : 3;

Field Name | Type | Description
--- | --- | ---
time_boot_ms | uint32_t | Timestamp of the component clock since boot time in ms.
seq | uint8_t | Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc).
num_motors | uint8_t | Total number of active ESCs/motors on the system.
num_in_seq | uint8_t | Number of active ESCs in this sequence (1 through this many array members will be populated with data)
escid | uint8_t[4] | ESC/Motor ID
status_age | uint16_t[4] | Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data.
data_version | uint8_t[4] | Version of data structure (determines contents).
data0 | uint32_t[4] | Data bits 1-32 for each ESC.
data1 | uint32_t[4] | Data bits 33-64 for each ESC.