MAVLink Communication: Difference between revisions

From STorM32-BGC Wiki
Jump to navigation Jump to search
No edit summary
Line 43: Line 43:
= Gimbal Protocol V2 =
= Gimbal Protocol V2 =


The STorM32 controller supports the new [https://mavlink.io/en/services/gimbal_v2.html MAVLink Gimbal Protocol V2]. It can act as gimbal device or as gimbal manager.  
The STorM32 controller supports the new MAVLink Gimbal Protocol V2. It can act as gimbal device or as gimbal manager.  


The gimbal device capability is fully supported. The STorM32 controller detects its associated gimbal manager by listening to the GIMBAL_MANAGER_STATUS messages. Once it has discovered its gimbal manager, it starts to react to GIMBAL_DEVICE_SET_ATTITUDE messages from this gimbal manager.
The gimbal device capability is fully supported. The STorM32 controller detects its associated gimbal manager by listening to the GIMBAL_MANAGER_STATUS messages. Once it has discovered its gimbal manager, it starts to react to GIMBAL_DEVICE_SET_ATTITUDE messages from this gimbal manager.

Revision as of 05:11, 26 May 2020

The information on this page refers to firmware v2.54e and higher.

In addition to the serial commands, the STorM32 controller also understands MAVLink messages, as defined in the MAVLink standard. The STorM32 controller supports a rich set of MAVLink messages and features, the MAVLink 2 protocol, and even the new MAVLink Gimbal Protocol V2. It might well be the by far most integrated MAVLink capable gimbal controller available.

The STorM32 controller in fact integrates two MAVLink components, which are referred to as the MAVLink Gimbal and MAVLink Camera components:

  • MAVLink Gimbal: This component deals with the gimbal operation. It is the part which you know from older firmware versions, but with massively extended functionality.
  • MAVLink Camera: This component is coupled with the NT Camera and provides a complete MAVLink Camera Protocol microservice server. It allows you to control the camera through MAVLink in unprecedented useful ways.

The MAVLink Gimbal and MAVLink Camera components share some parameters, but function-wise they are independent of each other. That is, both can be used simultaneously, the MAVLink Gimbal component can be used alone without the MAVLink Camera component, and vice versa.

Concerning the new MAVLink gimbal protocol v2, the official documentation is of course a good resource. This link you may also find useful: MAVLink Gimbal Protocol V2: Intro and Overview.

Comment: In case you find it confusing what "two MAVLink components" is supposed to mean, then just connect the STorM32 controller (with both components enabled) to MissionPlanner: You will find that it will show you two components, one named GIMBAL and the other named CAMERA :).

Parameters

The MAVLink parameters are located in the [GUI:Interfaces Tool] window, which is accessible via the [GUI:Experts Only] menu.

It has the following parameters:

  • Mavlink Gimbal: Enables the MAVLink Gimbal component and sets its component ID and gimbal device ID.
  • Mavlink Gimbal Stream: Activates emission of the selected message by the Gimbal component. Also enables the gimbal manger when “manager status” is set.
  • Mavlink ComPort: Selects the serial com port which is used for the MAVLink communication. Applies to both the MAVLink Gimbal and MAVLink Camera components.
  • Mavlink System ID: Sets the system ID of the STorM32 controller (default = “0”). Applies to both the MAVLink Gimbal and MAVLink Camera components. If it is set to “0”, then the system ID is autodetected, i.e., the STorM32 waits for incoming heartbeat messages from an autopilot and then uses its system ID.
  • Mavlink Version: Sets the used MAVLink protocol version (default = “Mavlink2”). Applies to both the MAVLink Gimbal and MAVLink Camera components. Must be set to “Mavlink2” for the MAVLink Gimbal and Camera components to fully work (MAVLink 1 protocol supports only a subset of messages).
  • Mavlink Camera: Enables the MAVLink Camera component and sets its component ID.

The STorM32 system ID should match the system ID of the autopilot, or autodetection should be enabled with Mavlink System ID = “0” (which is the default).

STorM32 supports the MAVLink 1 and MAVLink 2 protocols, which can be set via the parameter Mavlink Version. Per default MAVLink 2 is enabled, and it is highly recommended to use it.

Comment: The MAVLINK field in the [GUI:Dashboard] Info Center shows MAVLINK is PRESENT when the STorM32 controller is receiving valid MAVLink messages, implying a MAVLink connection is established. This can be handy for diagnosis.

Comment: If Mavlink Gimbal or Mavlink Camera is set, then the serial port selected in Mavlink ComPort is exclusive to the MAVLink communication. That is, incoming MAVLink messages on this port are accepted and served, but serial commands are rejected, while on all other ports serial messages are accepted but MAVLink messages rejected. If they both are off, then the STorM32 controller will, in addition to the serial commands, also accept MAVLink messages on any of its serial ports, but no outgoing MAVLink messages such as heartbeats will be emitted.

Comment: The baudrate of the selected serial port is determined by the respective baudrate parameter in the [GUI:Expert] tab. Per default it is 115200 bps. It is recommended to use a baudrate of 230400 bps, if possible.

Comment: For v1.3x boards: When the UART port is selected, one cannot use a BT module and a serial MAVLink connection at the same time.

Gimbal Protocol V2

The STorM32 controller supports the new MAVLink Gimbal Protocol V2. It can act as gimbal device or as gimbal manager.

The gimbal device capability is fully supported. The STorM32 controller detects its associated gimbal manager by listening to the GIMBAL_MANAGER_STATUS messages. Once it has discovered its gimbal manager, it starts to react to GIMBAL_DEVICE_SET_ATTITUDE messages from this gimbal manager.

The STorM32 controller also provides a basic gimbal manager, where "basic" means that the "smart" functions such as tracking, ROI, and so on are not supported. The other messages and commands are fully supported. It is not 100% compliant with the current version of the specification, but has some additions to make it more capable. More details on the gimbal manager can be found in the article MAVLink Gimbal Protocol V2: Intro and Overview.

Currently, the old and new protocol messages are accepted simultaneously. That is, for instance, the STorM32 can always be controlled via the DO_MOUNT_STATUS command, even when the gimbal manager is active. This is a breach of the gimbal manager concept, as it has not exclusive control over the gimbal. This is done however for development convenience; this behavior will eventually be removed.

The gimbal manager is activated by enabling the GIMBAL_MANAGER_STATUS message stream with the Mavlink Gimbal Stream parameter:

  • Mavlink Gimbal Stream = “manager status”: Gimbal manager is active, else inactive.

The gimbal manager and gimbal device are mutually exclusive, i.e., only the gimbal manager or the gimbal device are active, but not both at the same time.

Pass-Through

It is possible to connect the STorM32 GUI to any routing component in a MAVLink system, such as an autopilot or on-board companion computer, and to communicate directly with the STorM32 gimbal via MAVLink tunnel messages.

This is extremely convenient when the STorM32 gimbal is permanently installed in a vehicle, as it allows us to configure the gimbal without having to have physical access to the STorM32's USB or UART ports. The pass-through also works with wireless telemetry links, which opens up options such as tuning the gimbal during flight, and other unheard-of possibilities for in-flight control of the gimbal.

The pass-through mode of operation is enabled by checking in the GUI the [MAVLink] checkbox, which is located next to the [Port] combobox. The GUI then effectively operates like a mini MAVLink ground control station (the system ID is determined from the attached components, its component ID is MAV_COMP_ID_TUNNEL_NODE = 242 per default).

Comment: The pass-through communication is based on standard MAVLink, and thus should work for any MAVLink compatible autopilot.

Comment: Pass-through works for both the MAVLink Gimbal and MAVLink Camera components. The GUI chooses the MAVLink Gimbal if enabled, otherwise the MAVLink Camera for communication.

Comment: GUI functions which need physical access to a USB/UART port on the STorM32 controller do not work in pass-through mode. For instance, upgrading firmwares won't work.

This preliminary demo video demonstrates the pass-through feature:

MAVLink FTP

The MAVLink Gimbal and MAVLink Camera components support the MAVLink FTP micro service, which allows us to download the component definition files and the various camera definition files stored in the STorM32 controller.

The MAVLink Gimbal component's MAVLinkFTP support is available only on STorM32 boards with F103RE chip (the typical STorM32 board has a F103RC chip).

Comment: For the MAVLink Gimbal, MAVLinkFTP is currently enabled also on STorM32 boards with F103RC chip, for testing purposes, but this may be disabled at any time later.

Supported OpCodes/Commands

These opcodes/commands are support (unsupported commands will be NACKed with error code Fail):

MAVFTP_OPCODE_None
MAVFTP_OPCODE_TerminateSession
MAVFTP_OPCODE_ResetSessions
MAVFTP_OPCODE_ListDirectory
MAVFTP_OPCODE_OpenFileRO
MAVFTP_OPCODE_ReadFile
MAVFTP_OPCODE_CalcFileCRC32

MAVLink Gimbal

The MAVLink Gimbal component is enabled with the Mavlink Gimbal parameter, which also determines its component ID: “Gimbal1” corresponds to MAV_COMP_ID_GIMBAL (= 154), “Gimbal2” to MAV_COMP_ID_GIMBAL2 (= 171), “Gimbal3” to MAV_COMP_ID_GIMBAL3 (= 172), and so on:

  • Mavlink Gimbal = “Gimbal1” or higher
  • Mavlink Gimbal Stream: Activates the emission of the selected message with a frequency of 4 Hz.

The system ID can be adjusted via the Mavlink System ID parameter, which usually can be left at its default value.

The gimbal device ID, which is relevant for the "new" gimbal messages (Gimbal Protocol V2), is always set to be identical to the component ID.

Messages

The following MAVLink messages are supported:

MAVLINK_MSG_ID_HEARTBEAT (#0, 0x00)

See HEARTBEAT.

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

  • type: MAV_TYPE_GIMBAL (= 26)
  • autopilot: MAV_AUTOPILOT_INVALID (= 8)
  • base_mode: MAV_MODE_FLAG_SAFETY_ARMED (= 0x80) is set in NORMAL mode, MAV_MODE_FLAG_CUSTOM_MODE_ENABLED (= 0x01) is always set
  • custom_mode: lowest byte (0x000000FF) = STATE value; highest bit (0x80000000) = set if prearm checks have not passed
  • system_status: either MAV_STATE_BOOT (= 1), MAV_STATE_ACTIVE (= 4) or MAV_STATE_EMERGENCY (= 6)

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.

Emission of the attitude message with 4 Hz can be activated in the GUI via the Mavlink Gimbal Stream parameter, or by requesting a data stream or single-shot emission with the MAV_CMD_SET_MESSAGE_INTERVAL or MAV_CMD_REQUEST_MESSAGE commands, respectively. The yaw angle is relative to the forward direction.

MAVLINK_MSG_ID_RC_CHANNLES (#65, 0x41)

See RC_CHANNELS.

The parameter Virtual Channel Configuration needs to be set to “serial” for the values received by this message to become available for inputs as “Virtual-1” to “Virtual-16”.

MAVLINK_MSG_ID_COMMAND_INT (#75, 0x4B)

See COMMAND_INT.

Same as for MAVLINK_MSG_ID_COMMAND_LONG, see next.

MAVLINK_MSG_ID_COMMAND_LONG (#76, 0x4C)

See COMMAND_LONG.

Each command is acknowledged with a COMMAND_ACK message (with result MAV_RESULT_ACCEPTED or MAV_RESULT_DENIED for supported commands, and MAV_RESULT_UNSUPPORTED otherwise). The following 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)
* param1 = instance (must be 0, else denied)
* param2 = pwm value (only 700...2300 accepted, else denied)
MAV_CMD_DO_DIGICAM_CONFIGURE (#202, 0xCA)
* param1 = mode 
     0: CAMERA_MODE_PHOTO
     1: CAMERA_MODE_VIDEO
* param6 = command identity 
     0: command accepted by all cameras
     1-6: command accepted only if camera is CAMERA1-CAMERA6
MAV_CMD_DO_DIGICAM_CONTROL (#203, 0xCB)
* param5 = shot
     if CAMERA_MODE_PHOTO: 
         0: off
         1: SHUTTER
     if CAMERA_MODE_VIDEO
         0: VIDEOOFF
         1: VIDEOON
* param6 = command identity 
     0: command accepted by all cameras
     1-6: command accepted only if camera is CAMERA1-CAMERA6
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 (COMMENT: the sign is opposite to convention!)
* param2 = roll, angle in degree
* param3 = yaw, angle in degree (COMMENT: the sign is opposite to convention!)
* param7 = mount_mode (0 = MAV_MOUNT_MODE_RETRACT and 1 = MAV_MOUNT_MODE_NEUTRAL recenters the camera)
MAV_CMD_DO_SET_CAM_TRIGG_DIST(#206, 0xCE)
* param1 = distance (must be 0, else denied)
* param3 = trigger camera once immediately 
     0: off
     1: SHUTTER
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_PREFLIGHT_REBOOT_SHUTDOWN(#246, 0xF6)
* param4
     0: do nothing
     1: restart with full reset
     2: shut down motors
MAV_CMD_GET_MESSAGE_INTERVAL (#510, 0x01FE)
* param1 =  MAVLink message ID;
MAV_CMD_SET_MESSAGE_INTERVAL (#511, 0x01FF)
* param1 =  MAVLink message ID
* param2 = interval between two messages, in microseconds; set to -1 to disable
* param7 = request target
 
The periodic emission of one of these messages can be requested:
  * ATTITUDE (message id = 30)
  * MOUNT_STATUS (message id = 158) (target is set according to param4, default is broadcasting)
  * GIMBAL_MANAGER_STATUS (message id = 281)
  * GIMBAL_DEVICE_ATTITUDE_STATUS (message id = 285)
Stream rates of up to 100 Hz are supported. Note however that this can take a significant toll and may strain the STorM32's microcontroller capabilities. Please resort to common sense.
MAV_CMD_REQUEST_MESSAGE (#512, 0x0200)
* param1 = message ID of the requested message  
     30: send ATTITUDE message
     148: send AUTOPILOT_VERSION message
     158: send MOUNT_STATUS message (target is set according to param7, default is requester IDs)
     280: send GIMBAL_MANAGER_INFORMATION message, only if gimbal manager is active
     281: send GIMBAL_MANAGER_STATUS message, only if gimbal manager is active
     283: send GIMBAL_DEVICE_INFORMATION message
     285: send GIMBAL_DEVICE_ATTITUDE_STATUS message
     300: send PROTOCOL_VERSION message
     395: send COMPONENT_INFORMATION message
* param7 = response target
MAV_CMD_REQUEST_PROTOCOL_VERSION (#519, 0x0207)
  send PROTOCOL_VERSION message 
MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES (#520, 0x0208)
  send AUTOPILOT_VERSION message

MAVLINK_MSG_ID_COMMAND_ACK (#77, 0x4D)

See COMMAND_ACK.

MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL (#110, 0x6E)

See FILE_TRANSFER_PROTOCOL.

MAVLINK_MSG_ID_AUTOPILOT_VERSION (#148, 0x94)

See AUTOPILOT_VERSION.

MAVLINK_MSG_ID_DIGICAM_CONTROL (#155, 0x9B)

ArduPilot specific message. See DIGICAM_CONTROL.

Deprecated message, but supported for compatibility if Mavlink Gimbal Stream = “Mavlink1+v0.96”.

MAVLINK_MSG_ID_MOUNT_CONFIGURE (#156, 0x9C)

ArduPilot specific message. See MOUNT_CONFIGURE.

Deprecated message, but supported for compatibility if Mavlink Gimbal Stream = “Mavlink1+v0.96”.

MAVLINK_MSG_ID_MOUNT_CONTROL (#157, 0x9D)

ArduPilot specific message. See MOUNT_CONTROL.

Deprecated message, but supported for compatibility if Mavlink Gimbal Stream = “Mavlink1+v0.96”.

MAVLINK_MSG_ID_MOUNT_STATUS (#158, 0x9E)

ArduPilot specific message. See MOUNT_STATUS.

The emission of the mount status message with 4 Hz can be activated in the GUI via the Mavlink Gimbal Stream parameter, and by requesting a data stream or single-shot emission with the MAV_CMD_SET_MESSAGE_INTERVAL or MAV_CMD_REQUEST_MESSAGE commands, respectively. The yaw angle is relative to the forward direction.

MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST (#183, 0xB7)

ArduPilot specific message. See AUTOPILOT_VERSION_REQUEST.

MAVLINK_MSG_ID_MESSAGE_INTERVAL (#244, 0xF4)

See MESSAGE_INTERVAL.

MAVLINK_MSG_ID_STATUSTEXT (#253, 0xFD)

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_GIMBAL_MANAGER_INFORMATION (#280, 0x118)

See GIMBAL_MANAGER_INFORMATION.

Only served when the gimbal manager is active.

MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS (#281, 0x119)

See GIMBAL_MANAGER_STATUS.

Gimbal device is active: This message is digested by the STorM32 controller in order to discover the gimbal manager which it is assigned to. The first gimbal manager which sends this message with a gimbal device ID equal to the STorM32's component ID "wins" the gimbal. STorM32 recognizes only gimbal managers which have the same system ID as itself (GCSes usually have a different system ID). The STorM32 will not accept incoming GIMBAL_DEVICE_SET_ATTITUDE messages if it has not discovered its gimbal manager.

Gimbal manager is active: The message is emitted at a rate of 1 Hz, or by requesting a data stream or single-shot emission with the MAV_CMD_SET_MESSAGE_INTERVAL or MAV_CMD_REQUEST_MESSAGE commands, respectively.

MAVLINK_MSG_ID_GIMBAL_MANAGER_SET_ATTITUDE (#282, 0x11A)

See GIMBAL_MANAGER_SET_ATTITUDE.

Only served when the gimbal manager is active.

MAVLINK_MSG_ID_GIMBAL_DEVICE_INFORMATION (#283, 0x11B)

See GIMBAL_DEVICE_INFORMATION.

MAVLINK_MSG_ID_GIMBAL_DEVICE_SET_ATTITUDE (#284, 0x11C)

See GIMBAL_DEVICE_SET_ATTITUDE.

The STorM32 controller accepts this message only when the gimbal device is active and when the message is coming from the gimbal manager which it is assigned to. In order to discover its gimbal manager, it looks for GIMBAL_MANAGER_STATUS messages which carry its gimbal device ID (which is equal to its component ID). Only when it has received such a message at least once, it will accept and process GIMBAL_DEVICE_SET_ATTITUDE messages.

MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS (#285, 0x11D)

See GIMBAL_DEVICE_ATTITUDE_STATUS.

Emission of this message with 4 Hz can be activated in the GUI via the Mavlink Gimbal Stream parameter, or by requesting a data stream or single-shot emission with the MAV_CMD_SET_MESSAGE_INTERVAL or MAV_CMD_REQUEST_MESSAGE commands, respectively.

MAVLINK_MSG_ID_AUTOPILOT_STATE_FOR_GIMBAL_DEVICE (#286, 0x11E)

See AUTOPILOT_STATE_FOR_GIMBAL_DEVICE.

This message can be send to the STorM32 controller and is then used for STorM32-Link.

MAVLINK_MSG_ID_PROTOCOL_VERSION (#300, 0x12C)

See PROTOCOL_VERSION.

MAVLINK_MSG_ID_TUNNEL (#385, 0x181)

See TUNNEL.

The STorM32 controller occupies the block of payload_type values from 200 - 209 (see MAV_TUNNEL_PAYLOAD_TYPE). The payload types 200 and 201 are used for communicating with the GUI. Payload types 202 and 203 are for communicating with a flight controller, but can also be used otherwise.

MAVLINK_MSG_ID_COMPONENT_INFORMATION (#395, 0x18B)

See COMPONENT INFORMATION.

MAVLink Camera

The MAVLink Camera component is independent on the MAVLink Gimbal component, and can also be used when the MAVLink Gimbal component is disabled.

Setting the Mavlink Camera parameter enables the MAVLink Camera component, and determines its component ID: “Camera1” corresponds to MAV_COMP_ID_CAMERA (= 100), “Camera2” to MAV_COMP_ID_CAMERA2 (= 101), and so on. In addition, MAVLink 2 must be enabled; otherwise many functions of the MAVLink Camera component won't work properly:

  • Mavlink Camera = “Camera1” or higher
  • Mavlink Version = “Mavlink2”

The system ID of the MAVLink Camera component is determined by the parameter Mavlink System ID, which is also used by the MAVLink Gimbal component, and usually can be left at its default value.

The MAVLink Camera component supports the File Transfer Protocol micro service, which allows us to download the camera definition .xml files directly from the STorM32 gimbal controller.

The MAVLink Camera component is deeply related to the NT Camera. This means that it works in conjunction with the Camera Control function and associated parameters in the [GUI:Functions] tab.

Comment: For camera models which need to establish a connection to the NT Camera module for operation, such as the GoPro Hero5, the heartbeat will be emitted only when a connection is established. For these camera models the connection status is displayed in the [GUI:Dashboard].

Messages

The following MAVLink messages are supported:

MAVLINK_MSG_ID_HEARTBEAT (#0, 0x00)

See HEARTBEAT.

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

  • type: MAV_TYPE_CAMERA (= 30)
  • autopilot: MAV_AUTOPILOT_INVALID (= 8)
  • base_mode: 0
  • custom_mode: 0
  • system_status: 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_COMMAND_INT (#75, 0x4B)

See COMMAND_INT.

Same as for MAVLINK_MSG_ID_COMMAND_LONG, see next.

MAVLINK_MSG_ID_COMMAND_LONG (#76, 0x4C)

See COMMAND_LONG.

Each command is acknowledged with a COMMAND_ACK message (with result MAV_RESULT_ACCEPTED or MAV_RESULT_DENIED for supported commands, and MAV_RESULT_UNSUPPORTED otherwise). The following commands are supported (parameter fields not mentioned are ignored):

MAV_CMD_DO_DIGICAM_CONFIGURE (#202, 0xCA)
* param1 = mode 
     0: CAMERA_MODE_PHOTO
     1: CAMERA_MODE_VIDEO
* param6 = command identity 
     0: command accepted by all cameras
     1-6: command accepted only if camera is CAMERA1-CAMERA6
MAV_CMD_DO_DIGICAM_CONTROL (#203, 0xCB)
* param5 = shot
     if CAMERA_MODE_PHOTO: 
         0: off
         1: SHUTTER
     if CAMERA_MODE_VIDEO
         0: VIDEOOFF
         1: VIDEOON
* param6 = command identity 
     0: command accepted by all cameras
     1-6: command accepted only if camera is CAMERA1-CAMERA6
MAV_CMD_REQUEST_MESSAGE (#512, 0x0200)
* param1 = message ID of the requested message  
     147: send BATTERY_STATUS message
     148: send AUTOPILOT_VERSION message
     259: send CAMERA_INFORMATION message
     260: send CAMERA_SETTINGS message
     261: send STORAGE_INFORMATION message
     262: send CAMERA_CAPTURE_STATUS message
     300: send PROTOCOL_VERSION message
* param7 = response target
MAV_CMD_REQUEST_PROTOCOL_VERSION (#519, 0x0207)
  send PROTOCOL_VERSION message 
MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES (#520, 0x0208)
  send AUTOPILOT_VERSION message
MAV_CMD_REQUEST_CAMERA_INFORMATION (#521, 0x0209)
* param1 = request camera capabilities
     1: send CAMERA_INFORMATION message
MAV_CMD_REQUEST_CAMERA_SETTINGS (#522, 0x020A)
  send CAMERA_SETTINGS message
MAV_CMD_REQUEST_STORAGE_INFORMATION (#525, 0x020D)
  send STORAGE_INFORMATION message
MAV_CMD_STORAGE_FORMAT (#526, 0x020E)
  returns COMMAND_ACK with MAV_CMD_ACK_DENIED
MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS (#527, 0x020F)
  send CAMERA_CAPTURE_STATUS message
MAV_CMD_RESET_CAMERA_SETTINGS (#529, 0x0211)
* param1 = reset (must be 0, else denied)
MAV_CMD_SET_CAMERA_MODE (#530, 0x0212)
* param2 = camera mode
MAV_CMD_SET_CAMERA_ZOOM (#531, 0x0213)
* param1 = zoom type
* param2 = zoom level
MAV_CMD_SET_CAMERA_FOCUS (#532, 0x0214)
  returns COMMAND_ACK with MAV_CMD_ACK_DENIED
MAV_CMD_IMAGE_START_CAPTURE (#2000, 0x07D0)
* param2 = desired elapsed time between two consecutive pictures (in seconds)
* param3 = total number of images to capture
* param4 = capture sequence number starting
MAV_CMD_IMAGE_STOP_CAPTURE (#2001, 0x07D18)
  stops capturing images
MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE (#2002, 0x07D2)
  returns COMMAND_ACK with MAV_CMD_ACK_DENIED
MAV_CMD_VIDEO_START_CAPTURE (#2500, 0x09C4)
* param1 = video stream ID 
* param2 = frequency CAMERA_CAPTURE_STATUS messages should be sent while recording
MAV_CMD_VIDEO_STOP_CAPTURE (#2501, 0x09C5)
* param1 = video stream ID

MAVLINK_MSG_ID_COMMAND_ACK (#77, 0x4D)

See COMMAND_ACK.

MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL (#110, 0x6E)

See FILE_TRANSFER_PROTOCOL.

The opcodes TerminateSession, ResetSessions, ListDirectory, OpenFileRO, ReadFile and CalcFileCRC32 are supported.

MAVLINK_MSG_ID_BATTERY_STATUS (#147, 0x93)

See BATTERY_STATUS.

MAVLINK_MSG_ID_AUTOPILOT_VERSION (#148, 0x94)

See AUTOPILOT_VERSION.

MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST (#183, 0xB7)

ArduPilot specific message. See AUTOPILOT_VERSION_REQUEST.

MAVLINK_MSG_ID_CAMERA_INFORMATION (#259, 0x103)

See CAMERA_INFORMATION.

MAVLINK_MSG_ID_CAMERA_SETTINGS (#260, 0x104)

See CAMERA_SETTINGS.

MAVLINK_MSG_ID_STORAGE_INFORMATION (#261, 0x105)

See STORAGE_INFORMATION.

MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS (#262, 0x106)

See CAMERA_CAPTURE_STATUS.

MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED (#263, 0x107)

See CAMERA_IMAGE_CAPTURED.

MAVLINK_MSG_ID_PROTOCOL_VERSION (#300, 0x12C)

See PROTOCOL_VERSION.

MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ (#320, 0x140)

See PARAM_EXT_REQUEST_READ.

MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST (#321, 0x141)

See PARAM_EXT_REQUEST_LIST.

MAVLINK_MSG_ID_PARAM_EXT_VALUE (#322, 0x142)

See PARAM_EXT_VALUE.

MAVLINK_MSG_ID_PARAM_EXT_SET (#323, 0x143)

See PARAM_EXT_SET.

MAVLINK_MSG_ID_PARAM_EXT_ACK (#324, 0x144)

See PARAM_EXT_ACK.

MAVLINK_MSG_ID_TUNNEL (#385, 0x181)

See TUNNEL.

The STorM32 controller occupies the block of payload_type values from 200 - 209 (see MAV_TUNNEL_PAYLOAD_TYPE). The MAVLink Camera component supports the payload types 200 and 201 for communicating with the GUI.

Comments on Compatibility

The STorM32's MAVLink support is fully compatible with the MAVLink standard (much time has been actually invested into ensuring this).

However, not all flight stacks fully support the MAVLink standard.

ArduPilot

ArduPilot does not support some relevant messages of the standard MAVLink message set. This can lead to enhanced traffic, since e.g. COMMAND_ACK messages are not routed/digested correctly, and some functions of the STorM32 such as the new gimbal messages or MAVLink camera micro service or passthrough configuration or STorM32-Link won't work properly. In addition it has two bugs in this area.

Furthermore, the used "old" gimbal MAVLink messages and commands are somewhat of a mess.

A drastic example is the 3DR Solo drone. Here the issue is a combination of the infamous "reversed signs", use of non-standard/deprecated messages, improper use of target IDs, and the bugs. ArduPilot supports the COMMAND_LONG commands of the old gimbal protocol (see Gimbal protocol) and it's own MOUNT_CONFIGURE and MOUNT_CONTROL messages. However, the 3DR Solo firmware emits MOUNT_CONFIGURE/MOUNT_CONTROL messages, and this so with target (0,1), which are forwarded to the gimbal according to the MAVLink routing rules, whereas the ArduPilot mount class sends MAV_CMD_DO_MOUNT_CONTROL commands to the gimbal. This leads to a situation there the STorM32 receives both, the commands and the messages, which however carry conflicting data, also because of a bug in the ArduPilot code.

Therefore, the STorM32 behavior has been changed with firmware v2.42: The ArduPilot-specific MOUNT_CONFIGURE and MOUNT_CONTROL messages are not supported, except if explicitly enabled by setting Mavlink Version = “Mavlink1+v0.96”.

This resolves issues like those with the 3DR Solo: The messages send out by the Solo and forwarded to the STorM32 are ignored, so that the STorM32 only acts on the proper commands from the flight controller. This still doesn't make things work very well in MAVLINK_TARGETING mode however due to the bugs in the ArduPilot code. But that's the best the STorM32 can do.

PX4

TBD.