MAVLink Communication

From STorM32-BGC Wiki
Revision as of 15:30, 7 June 2019 by OlliW (talk | contribs)
Jump to navigation Jump to search

this page is under construction, and for the moment mainly serves the author as reference

In addition to the serial commands, the STorM32 controller also understands MAVLink messages, as defined in the MAVLink standard.

The STorM32 controller in fact integrates two MAVLink components, which in the following will be referred to as MAVLink Gimbal and as MAVLink Camera.

  • The MAVLink Gimbal is the part which deals with the gimbal operation.
  • The MAVLink Camera is related to the NT Camera, and is the part which offers a camera protocol micro service.


The STorM32's system ID and component ID can be adjusted in the GUI. For the MAVLink Gimbal the defaults are

  • System ID: 1
  • Component ID: 154 (= MAV_COMP_ID_GIMBAL)

The System ID should be matched to the system ID of the autopilot. The Component ID should usually not be changed.

The system ID of the MAVLink Camera is identical to the above, but it's component ID is adjusted by the setting.


MAVLink Gimbal

The following MAVLink commands are supported:

MAVLINK_MSG_ID_HEARTBEAT (#0, 0x00)

See HEARTBEAT.

The emission of the heartbeat needs to be activated in the GUI via the Mav Configuration parameter. The heartbeat is emitted at 1 Hz, with the following values:

  • type: MAV_TYPE_GIMBAL (= 26)
  • autopilot: 'S' (= 83 = 0x53) (MAV_AUTOPILOT_STORM32)
  • base_mode: either 0 or MAV_MODE_FLAG_SAFETY_ARMED (= 0x80)
  • custom_mode: STATE value of the o323firmware
  • system_status: either MAV_STATE_BOOT (= 1) or MAV_STATE_ACTIVE (= 4)

MAVLINK_MSG_ID_PARAM_REQUEST_READ (#20, 0x14)

See PARAM_REQUEST_READ.

MAVLINK_MSG_ID_PARAM_REQUEST_LIST (#21, 0x15)

See PARAM_REQUEST_LIST.

MAVLINK_MSG_ID_PARAM_VALUE (#22, 0x16)

See PARAM_VALUE.

MAVLINK_MSG_ID_PARAM_SET (#23, 0x17)

See PARAM_SET.

MAVLINK_MSG_ID_ATTITUDE (#30, 0x1E)

See ATTITUDE.

The emission of the attitude message with 2 Hz can be activated in the GUI via the Mav Configuration parameter, or by requesting a data stream with MESSAGE_INTERVAL. The yaw angle is relative to the forward direction.

MAVLINK_MSG_ID_RC_CHANNLES (#65, 0x17)

See RC_CHANNELS.

MAVLINK_MSG_ID_REQUEST_DATA_STREAM (#66, 0x17)

See REQUEST_DATA_STREAM.

This message is sent out with req_stream_id = MAV_DATA_STREAM_RC_CHANNELS and req_message_rate = 10, when an ArduPilot autopilot (= MAV_AUTOPILOT_ARDUPILOTMEGA) is detected.

MAVLINK_MSG_ID_COMMAND_LONG (#76, 0x4C)

See COMMAND_LONG.

These commands are supported (parameter fields not mentioned are ignored):

MAV_CMD_DO_SET_PARAMETER (#180, 0xB4)
* param1 = parameter index
* param2 = parameter value
MAV_CMD_DO_SET_SERVO (#183, 0xB7)
* param2 = pwm value (only 700...2300 accepted)
MAV_CMD_DO_DIGICAM_CONFIGURE (#202, 0xCA)
Is just there so that a MAVLINK_MSG_ID_COMMAND_ACK with MAV_CMD_ACK_OK is returned
MAV_CMD_DO_DIGICAM_CONTROL (#203, 0xCB)
* param5 = shot (0 = off, 1 = IRSHUTTER)
MAV_CMD_DO_MOUNT_CONFIGURE (#204, 0xCC)
* param1 = mount_mode (0 = MAV_MOUNT_MODE_RETRACT and 1 = MAV_MOUNT_MODE_NEUTRAL recenters the camera)
MAV_CMD_DO_MOUNT_CONTROL (#205, 0xCD)
* param1 = pitch, angle in degree, unlimited
* param2 = roll, angle in degree, unlimited
* param3 = yaw, angle in degree, unlimited
* param7 = mount_mode (0 = MAV_MOUNT_MODE_RETRACT and 1 = MAV_MOUNT_MODE_NEUTRAL recenters the camera)
MAV_CMD_PREFLIGHT_STORAGE (#245, 0xF5)
* param1 = parameter storage
     0: restore parameter values from EEPROM
     1: store parameter values in EEPROM
     2: ignored, as it maybe harmful
MAV_CMD_SET_MESSAGE_INTERVAL (#511, 0x01FF)
* param1 =  MAVLink message ID; the attitude and mount status can be requested
* param2 = interval between two messages, in microseconds; set to -1 to disable
MAV_CMD_GET_ATTITUDE (#1234, 0x04D2)
STorM32 specific command. Deprecated, but still existing for compatibility reasons.
MAV_CMD_TARGET_SPECIFIC (#1235, 0x04D3)
STorM32 specific command. Container for target specific messages. 
See Comments on STorM32 specific Mavlink Messages.

MAVLINK_MSG_ID_COMMAND_ACK (#77, 0x4D)

See COMMAND_ACK.

MAVLINK_MSG_ID_AUTOPILOT_VERSION (#148, 0x4D)

See AUTOPILOT_VERSION.

MAVLINK_MSG_ID_MOUNT_STATUS (#158, 0x9E)

ArduPilot specific message. See MOUNT_STATUS.

The emission of the mount status message with 2 Hz can be activated in the GUI via the Mav Configuration parameter, or by requesting a data stream with MESSAGE_INTERVAL. The yaw angle is relative to the forward direction. The target is set to:

* target_system: 0
* target_component: 0

MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST (#183, 0x4D)

ArduPilot specific message. See AUTOPILOT_VERSION_REQUEST.

MAVLINK_MSG_ID_MESSAGE_INTERVAL (#244, 0xF4)

See MESSAGE_INTERVAL.

The attitude, the mount status, or the mount orientation can be requested.

MAVLINK_MSG_ID_STATUSTEXT (#253, 0xF4)

See STATUSTEXT.

This message is sent out after a PARAM_REQUEST_LIST has been served, and provides firmware and board type information.

MAVLINK_MSG_ID_MOUNT_ORIENTATION (#265, 0xF4)

See MOUNT_ORIENTATION.

The emission of the mount orientation message with 2 Hz can be activated in the GUI via the Mav Configuration parameter, or by requesting a data stream with MESSAGE_INTERVAL. The yaw angle is relative to the forward direction.

MAVLINK_MSG_ID_PROTOCOL_VERSION (#300, 0xF4)

See PROTOCOL_VERSION.