MAVLink v0.9 to v1.0 Porting Guide

Version v0.9 of MAVLink is very similar to the v1.0 release, with a few minor changes and renames. The functionality of the v1.0 is greater than in v0.9, so no functionality is lost.

Relevant Changes

  • All packets are protected now individually against protocol sub-version mismatches
  • Code size has been reduces, runtime-efficience has been increased substantially
  • Byte order on the wire is now little-endian, allows most systems to directly copy / read from memory onto the wire
  • Protocol is compatible with little-endian and big-endian systems
  • All packets have been cleaned up, the number of packets has reduced
  • The system flight mode is now encoded with base_mode and custom_mode. The custom_mode is a 32 bit number left for individual autopilots to encode their own sub-modes. The recommendation is to use the 32 bits as bit field.
  • Parameters now support int32, uint32 and float values
  • Messages can now contain double precision floating point numbers

Porting Preparations

  • Download a recent v1.0 build from QGroundControl, as it's message inspector will be of big help for checking the correctness
  • Make a clean build of your current codebase, make sure this version is working as expected (MAVLink v1.0 is tested with C and Python test suites, so chances that a protocol error is causing porting issues are very low)
  • Download MAVLink v1.0

Porting Steps

System Heartbeat and Status

Execute these search and replace operations:

The previous base modes do not exist further, instead they have been replaced by a mode indicating the system arm status:

MAV_MODE_AUTO became MAV_MODE_AUTO_DISARMED and MAV_MODE_AUTO_ARMED. One example. The previous switch checked the MAV mode wether the system is in guided or auto:

After the introduction of the state flags, the same check can be done by combining the flag's position with a logical AND with the uint8_t mode:

if (((mode&MAV_MODE_FLAG_DECODE_POSITION_AUTO) || (mode&MAV_MODE_FLAG_DECODE_POSITION_GUIDED)) && positionLock)

The result is either 0 or 1, depending if the AUTO or GUIDED bits were set.

Alternatively the new _ARMED and _DISARMED enum values can be used directly:

MAV_MODE_ARMED

The system types have also been slightly renamed:

MAV_AUTOPILOT_GENERIC_MISSION_WAYPOINTS_ONLY -> MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY
MAV_AUTOPILOT_GENERIC_MISSION_NAVIGATION_ONLY -> MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY

Global and Local Position

Search and replace:

mavlink_local_position_t -> mavlink_local_position_ned_t
MAVLINK_MSG_ID_LOCAL_POSITION -> MAVLINK_MSG_ID_LOCAL_POSITION_NED
mavlink_msg_local_position -> mavlink_msg_local_position_ned

Waypoint Interface, now MISSION Interface

The waypoint interface has now changed, it was however renamed for clarity to mission interface.

Execute these search and replace operations (CASE SENSITIVE PLEASE!):

mavlink_waypoint_ack_t -> mavlink_mission_ack_t
mavlink_waypoint_request_t -> mavlink_mission_request_t
mavlink_waypoint_reached_t -> mavlink_mission_item_reached_t
mavlink_waypoint_current_t -> mavlink_mission_current_t
mavlink_waypoint_set_current_t -> mavlink_mission_set_current_t
mavlink_waypoint_count_t -> mavlink_mission_count_t
mavlink_waypoint_clear_all_t -> mavlink_mission_clear_all_t
mavlink_waypoint_t -> mavlink_mission_item_t

mavlink_msg_waypoint_ack -> mavlink_msg_mission_ack
mavlink_msg_waypoint_request -> mavlink_msg_mission_request
mavlink_msg_waypoint_reached -> mavlink_msg_mission_item_reached
mavlink_msg_waypoint_current -> mavlink_msg_mission_current
mavlink_msg_waypoint_set_current -> mavlink_msg_mission_set_current
mavlink_msg_waypoint_count -> mavlink_msg_mission_count
mavlink_msg_waypoint_clear_all -> mavlink_msg_mission_clear_all
mavlink_msg_waypoint -> mavlink_msg_mission_item

MAVLINK_MSG_ID_WAYPOINT_ACK -> MAVLINK_MSG_ID_MISSION_ACK
MAVLINK_MSG_ID_WAYPOINT_REQUEST -> MAVLINK_MSG_ID_MISSION_REQUEST
MAVLINK_MSG_ID_WAYPOINT_REACHED -> MAVLINK_MSG_ID_MISSION_ITEM_REACHED
MAVLINK_MSG_ID_WAYPOINT_CURRENT -> MAVLINK_MSG_ID_MISSION_CURRENT
MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT -> MAVLINK_MSG_ID_MISSION_SET_CURRENT
MAVLINK_MSG_ID_WAYPOINT_COUNT -> MAVLINK_MSG_ID_MISSION_COUNT
MAVLINK_MSG_ID_WAYPOINT -> MAVLINK_MSG_ID_MISSION_ITEM

Parameter Interface

MAVLINK_TYPE_FLOAT

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported