/*
MAVLink protocol implementation for node.js (auto-generated by mavgen_javascript.py)

Generated from: common.xml

Note: this file has been auto-generated. DO NOT EDIT
*/

jspack = require("./jspack.js").jspack,
    _ = require("underscore"),
    events = require("events"),
    util = require("util");

// Add a convenience method to Buffer
Buffer.prototype.toByteArray = function () {
  return Array.prototype.slice.call(this, 0)
}

mavlink = function(){};

// Implement the X25CRC function (present in the Python version through the mavutil.py package)
mavlink.x25Crc = function(buffer, crc) {

    var bytes = buffer;
    var crc = crc || 0xffff;
    _.each(bytes, function(e) {
        var tmp = e ^ (crc & 0xff);
        tmp = (tmp ^ (tmp << 4)) & 0xff;
        crc = (crc >> 8) ^ (tmp << 8) ^ (tmp << 3) ^ (tmp >> 4);
        crc = crc & 0xffff;
    });
    return crc;

}

mavlink.WIRE_PROTOCOL_VERSION = "1.0";

mavlink.MAVLINK_TYPE_CHAR     = 0
mavlink.MAVLINK_TYPE_UINT8_T  = 1
mavlink.MAVLINK_TYPE_INT8_T   = 2
mavlink.MAVLINK_TYPE_UINT16_T = 3
mavlink.MAVLINK_TYPE_INT16_T  = 4
mavlink.MAVLINK_TYPE_UINT32_T = 5
mavlink.MAVLINK_TYPE_INT32_T  = 6
mavlink.MAVLINK_TYPE_UINT64_T = 7
mavlink.MAVLINK_TYPE_INT64_T  = 8
mavlink.MAVLINK_TYPE_FLOAT    = 9
mavlink.MAVLINK_TYPE_DOUBLE   = 10

// Mavlink headers incorporate sequence, source system (platform) and source component. 
mavlink.header = function(msgId, mlen, seq, srcSystem, srcComponent) {

    this.mlen = ( typeof mlen === 'undefined' ) ? 0 : mlen;
    this.seq = ( typeof seq === 'undefined' ) ? 0 : seq;
    this.srcSystem = ( typeof srcSystem === 'undefined' ) ? 0 : srcSystem;
    this.srcComponent = ( typeof srcComponent === 'undefined' ) ? 0 : srcComponent;
    this.msgId = msgId

}

mavlink.header.prototype.pack = function() {
    return jspack.Pack('BBBBBB', [254, this.mlen, this.seq, this.srcSystem, this.srcComponent, this.msgId]);
}

// Base class declaration: mavlink.message will be the parent class for each
// concrete implementation in mavlink.messages.
mavlink.message = function() {};

// Convenience setter to facilitate turning the unpacked array of data into member properties
mavlink.message.prototype.set = function(args) {
    _.each(this.fieldnames, function(e, i) {
        this[e] = args[i];
    }, this);
};

// This pack function builds the header and produces a complete MAVLink message,
// including header and message CRC.
mavlink.message.prototype.pack = function(mav, crc_extra, payload) {

    this.payload = payload;
    this.header = new mavlink.header(this.id, payload.length, mav.seq, mav.srcSystem, mav.srcComponent);    
    this.msgbuf = this.header.pack().concat(payload);
    var crc = mavlink.x25Crc(this.msgbuf.slice(1));

    // For now, assume always using crc_extra = True.  TODO: check/fix this.
    crc = mavlink.x25Crc([crc_extra], crc);
    this.msgbuf = this.msgbuf.concat(jspack.Pack('<H', [crc] ) );
    return this.msgbuf;

}


// enums

// MAV_AUTOPILOT
mavlink.MAV_AUTOPILOT_GENERIC = 0 // Generic autopilot, full support for everything
mavlink.MAV_AUTOPILOT_PIXHAWK = 1 // PIXHAWK autopilot, http://pixhawk.ethz.ch
mavlink.MAV_AUTOPILOT_SLUGS = 2 // SLUGS autopilot, http://slugsuav.soe.ucsc.edu
mavlink.MAV_AUTOPILOT_ARDUPILOTMEGA = 3 // ArduPilotMega / ArduCopter, http://diydrones.com
mavlink.MAV_AUTOPILOT_OPENPILOT = 4 // OpenPilot, http://openpilot.org
mavlink.MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5 // Generic autopilot only supporting simple waypoints
mavlink.MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6 // Generic autopilot supporting waypoints and other simple navigation
                        // commands
mavlink.MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7 // Generic autopilot supporting the full mission command set
mavlink.MAV_AUTOPILOT_INVALID = 8 // No valid autopilot, e.g. a GCS or other MAVLink component
mavlink.MAV_AUTOPILOT_PPZ = 9 // PPZ UAV - http://nongnu.org/paparazzi
mavlink.MAV_AUTOPILOT_UDB = 10 // UAV Dev Board
mavlink.MAV_AUTOPILOT_FP = 11 // FlexiPilot
mavlink.MAV_AUTOPILOT_PX4 = 12 // PX4 Autopilot - http://pixhawk.ethz.ch/px4/
mavlink.MAV_AUTOPILOT_SMACCMPILOT = 13 // SMACCMPilot - http://smaccmpilot.org
mavlink.MAV_AUTOPILOT_AUTOQUAD = 14 // AutoQuad -- http://autoquad.org
mavlink.MAV_AUTOPILOT_ARMAZILA = 15 // Armazila -- http://armazila.com
mavlink.MAV_AUTOPILOT_AEROB = 16 // Aerob -- http://aerob.ru
mavlink.MAV_AUTOPILOT_ASLUAV = 17 // ASLUAV autopilot -- http://www.asl.ethz.ch
mavlink.MAV_AUTOPILOT_ENUM_END = 18 // 

// MAV_TYPE
mavlink.MAV_TYPE_GENERIC = 0 // Generic micro air vehicle.
mavlink.MAV_TYPE_FIXED_WING = 1 // Fixed wing aircraft.
mavlink.MAV_TYPE_QUADROTOR = 2 // Quadrotor
mavlink.MAV_TYPE_COAXIAL = 3 // Coaxial helicopter
mavlink.MAV_TYPE_HELICOPTER = 4 // Normal helicopter with tail rotor.
mavlink.MAV_TYPE_ANTENNA_TRACKER = 5 // Ground installation
mavlink.MAV_TYPE_GCS = 6 // Operator control unit / ground control station
mavlink.MAV_TYPE_AIRSHIP = 7 // Airship, controlled
mavlink.MAV_TYPE_FREE_BALLOON = 8 // Free balloon, uncontrolled
mavlink.MAV_TYPE_ROCKET = 9 // Rocket
mavlink.MAV_TYPE_GROUND_ROVER = 10 // Ground rover
mavlink.MAV_TYPE_SURFACE_BOAT = 11 // Surface vessel, boat, ship
mavlink.MAV_TYPE_SUBMARINE = 12 // Submarine
mavlink.MAV_TYPE_HEXAROTOR = 13 // Hexarotor
mavlink.MAV_TYPE_OCTOROTOR = 14 // Octorotor
mavlink.MAV_TYPE_TRICOPTER = 15 // Octorotor
mavlink.MAV_TYPE_FLAPPING_WING = 16 // Flapping wing
mavlink.MAV_TYPE_KITE = 17 // Flapping wing
mavlink.MAV_TYPE_ONBOARD_CONTROLLER = 18 // Onboard companion controller
mavlink.MAV_TYPE_VTOL_DUOROTOR = 19 // Two-rotor VTOL using control surfaces in vertical operation in
                        // addition. Tailsitter.
mavlink.MAV_TYPE_VTOL_QUADROTOR = 20 // Quad-rotor VTOL using a V-shaped quad config in vertical operation.
                        // Tailsitter.
mavlink.MAV_TYPE_VTOL_RESERVED1 = 21 // VTOL reserved 1
mavlink.MAV_TYPE_VTOL_RESERVED2 = 22 // VTOL reserved 2
mavlink.MAV_TYPE_VTOL_RESERVED3 = 23 // VTOL reserved 3
mavlink.MAV_TYPE_VTOL_RESERVED4 = 24 // VTOL reserved 4
mavlink.MAV_TYPE_VTOL_RESERVED5 = 25 // VTOL reserved 5
mavlink.MAV_TYPE_GIMBAL = 26 // Onboard gimbal
mavlink.MAV_TYPE_ENUM_END = 27 // 

// MAV_MODE_FLAG
mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1 // 0b00000001 Reserved for future use.
mavlink.MAV_MODE_FLAG_TEST_ENABLED = 2 // 0b00000010 system has a test mode enabled. This flag is intended for
                        // temporary system tests and should not be
                        // used for stable implementations.
mavlink.MAV_MODE_FLAG_AUTO_ENABLED = 4 // 0b00000100 autonomous mode enabled, system finds its own goal
                        // positions. Guided flag can be set or not,
                        // depends on the actual implementation.
mavlink.MAV_MODE_FLAG_GUIDED_ENABLED = 8 // 0b00001000 guided mode enabled, system flies MISSIONs / mission items.
mavlink.MAV_MODE_FLAG_STABILIZE_ENABLED = 16 // 0b00010000 system stabilizes electronically its attitude (and
                        // optionally position). It needs however
                        // further control inputs to move around.
mavlink.MAV_MODE_FLAG_HIL_ENABLED = 32 // 0b00100000 hardware in the loop simulation. All motors / actuators are
                        // blocked, but internal software is full
                        // operational.
mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64 // 0b01000000 remote control input is enabled.
mavlink.MAV_MODE_FLAG_SAFETY_ARMED = 128 // 0b10000000 MAV safety set to armed. Motors are enabled / running / can
                        // start. Ready to fly.
mavlink.MAV_MODE_FLAG_ENUM_END = 129 // 

// MAV_MODE_FLAG_DECODE_POSITION
mavlink.MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1 // Eighth bit: 00000001
mavlink.MAV_MODE_FLAG_DECODE_POSITION_TEST = 2 // Seventh bit: 00000010
mavlink.MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4 // Sixt bit:   00000100
mavlink.MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8 // Fifth bit:  00001000
mavlink.MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16 // Fourth bit: 00010000
mavlink.MAV_MODE_FLAG_DECODE_POSITION_HIL = 32 // Third bit:  00100000
mavlink.MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64 // Second bit: 01000000
mavlink.MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128 // First bit:  10000000
mavlink.MAV_MODE_FLAG_DECODE_POSITION_ENUM_END = 129 // 

// MAV_GOTO
mavlink.MAV_GOTO_DO_HOLD = 0 // Hold at the current position.
mavlink.MAV_GOTO_DO_CONTINUE = 1 // Continue with the next item in mission execution.
mavlink.MAV_GOTO_HOLD_AT_CURRENT_POSITION = 2 // Hold at the current position of the system
mavlink.MAV_GOTO_HOLD_AT_SPECIFIED_POSITION = 3 // Hold at the position specified in the parameters of the DO_HOLD action
mavlink.MAV_GOTO_ENUM_END = 4 // 

// MAV_MODE
mavlink.MAV_MODE_PREFLIGHT = 0 // System is not ready to fly, booting, calibrating, etc. No flag is set.
mavlink.MAV_MODE_MANUAL_DISARMED = 64 // System is allowed to be active, under manual (RC) control, no
                        // stabilization
mavlink.MAV_MODE_TEST_DISARMED = 66 // UNDEFINED mode. This solely depends on the autopilot - use with
                        // caution, intended for developers only.
mavlink.MAV_MODE_STABILIZE_DISARMED = 80 // System is allowed to be active, under assisted RC control.
mavlink.MAV_MODE_GUIDED_DISARMED = 88 // System is allowed to be active, under autonomous control, manual
                        // setpoint
mavlink.MAV_MODE_AUTO_DISARMED = 92 // System is allowed to be active, under autonomous control and
                        // navigation (the trajectory is decided
                        // onboard and not pre-programmed by MISSIONs)
mavlink.MAV_MODE_MANUAL_ARMED = 192 // System is allowed to be active, under manual (RC) control, no
                        // stabilization
mavlink.MAV_MODE_TEST_ARMED = 194 // UNDEFINED mode. This solely depends on the autopilot - use with
                        // caution, intended for developers only.
mavlink.MAV_MODE_STABILIZE_ARMED = 208 // System is allowed to be active, under assisted RC control.
mavlink.MAV_MODE_GUIDED_ARMED = 216 // System is allowed to be active, under autonomous control, manual
                        // setpoint
mavlink.MAV_MODE_AUTO_ARMED = 220 // System is allowed to be active, under autonomous control and
                        // navigation (the trajectory is decided
                        // onboard and not pre-programmed by MISSIONs)
mavlink.MAV_MODE_ENUM_END = 221 // 

// MAV_STATE
mavlink.MAV_STATE_UNINIT = 0 // Uninitialized system, state is unknown.
mavlink.MAV_STATE_BOOT = 1 // System is booting up.
mavlink.MAV_STATE_CALIBRATING = 2 // System is calibrating and not flight-ready.
mavlink.MAV_STATE_STANDBY = 3 // System is grounded and on standby. It can be launched any time.
mavlink.MAV_STATE_ACTIVE = 4 // System is active and might be already airborne. Motors are engaged.
mavlink.MAV_STATE_CRITICAL = 5 // System is in a non-normal flight mode. It can however still navigate.
mavlink.MAV_STATE_EMERGENCY = 6 // System is in a non-normal flight mode. It lost control over parts or
                        // over the whole airframe. It is in mayday
                        // and going down.
mavlink.MAV_STATE_POWEROFF = 7 // System just initialized its power-down sequence, will shut down now.
mavlink.MAV_STATE_ENUM_END = 8 // 

// MAV_COMPONENT
mavlink.MAV_COMP_ID_ALL = 0 // 
mavlink.MAV_COMP_ID_CAMERA = 100 // 
mavlink.MAV_COMP_ID_SERVO1 = 140 // 
mavlink.MAV_COMP_ID_SERVO2 = 141 // 
mavlink.MAV_COMP_ID_SERVO3 = 142 // 
mavlink.MAV_COMP_ID_SERVO4 = 143 // 
mavlink.MAV_COMP_ID_SERVO5 = 144 // 
mavlink.MAV_COMP_ID_SERVO6 = 145 // 
mavlink.MAV_COMP_ID_SERVO7 = 146 // 
mavlink.MAV_COMP_ID_SERVO8 = 147 // 
mavlink.MAV_COMP_ID_SERVO9 = 148 // 
mavlink.MAV_COMP_ID_SERVO10 = 149 // 
mavlink.MAV_COMP_ID_SERVO11 = 150 // 
mavlink.MAV_COMP_ID_SERVO12 = 151 // 
mavlink.MAV_COMP_ID_SERVO13 = 152 // 
mavlink.MAV_COMP_ID_SERVO14 = 153 // 
mavlink.MAV_COMP_ID_GIMBAL = 154 // 
mavlink.MAV_COMP_ID_MAPPER = 180 // 
mavlink.MAV_COMP_ID_MISSIONPLANNER = 190 // 
mavlink.MAV_COMP_ID_PATHPLANNER = 195 // 
mavlink.MAV_COMP_ID_IMU = 200 // 
mavlink.MAV_COMP_ID_IMU_2 = 201 // 
mavlink.MAV_COMP_ID_IMU_3 = 202 // 
mavlink.MAV_COMP_ID_GPS = 220 // 
mavlink.MAV_COMP_ID_UDP_BRIDGE = 240 // 
mavlink.MAV_COMP_ID_UART_BRIDGE = 241 // 
mavlink.MAV_COMP_ID_SYSTEM_CONTROL = 250 // 
mavlink.MAV_COMPONENT_ENUM_END = 251 // 

// MAV_SYS_STATUS_SENSOR
mavlink.MAV_SYS_STATUS_SENSOR_3D_GYRO = 1 // 0x01 3D gyro
mavlink.MAV_SYS_STATUS_SENSOR_3D_ACCEL = 2 // 0x02 3D accelerometer
mavlink.MAV_SYS_STATUS_SENSOR_3D_MAG = 4 // 0x04 3D magnetometer
mavlink.MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE = 8 // 0x08 absolute pressure
mavlink.MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE = 16 // 0x10 differential pressure
mavlink.MAV_SYS_STATUS_SENSOR_GPS = 32 // 0x20 GPS
mavlink.MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW = 64 // 0x40 optical flow
mavlink.MAV_SYS_STATUS_SENSOR_VISION_POSITION = 128 // 0x80 computer vision position
mavlink.MAV_SYS_STATUS_SENSOR_LASER_POSITION = 256 // 0x100 laser based position
mavlink.MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH = 512 // 0x200 external ground truth (Vicon or Leica)
mavlink.MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL = 1024 // 0x400 3D angular rate control
mavlink.MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION = 2048 // 0x800 attitude stabilization
mavlink.MAV_SYS_STATUS_SENSOR_YAW_POSITION = 4096 // 0x1000 yaw position
mavlink.MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL = 8192 // 0x2000 z/altitude control
mavlink.MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL = 16384 // 0x4000 x/y position control
mavlink.MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS = 32768 // 0x8000 motor outputs / control
mavlink.MAV_SYS_STATUS_SENSOR_RC_RECEIVER = 65536 // 0x10000 rc receiver
mavlink.MAV_SYS_STATUS_SENSOR_3D_GYRO2 = 131072 // 0x20000 2nd 3D gyro
mavlink.MAV_SYS_STATUS_SENSOR_3D_ACCEL2 = 262144 // 0x40000 2nd 3D accelerometer
mavlink.MAV_SYS_STATUS_SENSOR_3D_MAG2 = 524288 // 0x80000 2nd 3D magnetometer
mavlink.MAV_SYS_STATUS_GEOFENCE = 1048576 // 0x100000 geofence
mavlink.MAV_SYS_STATUS_AHRS = 2097152 // 0x200000 AHRS subsystem health
mavlink.MAV_SYS_STATUS_TERRAIN = 4194304 // 0x400000 Terrain subsystem health
mavlink.MAV_SYS_STATUS_SENSOR_ENUM_END = 4194305 // 

// MAV_FRAME
mavlink.MAV_FRAME_GLOBAL = 0 // Global coordinate frame, WGS84 coordinate system. First value / x:
                        // latitude, second value / y: longitude,
                        // third value / z: positive altitude over
                        // mean sea level (MSL)
mavlink.MAV_FRAME_LOCAL_NED = 1 // Local coordinate frame, Z-up (x: north, y: east, z: down).
mavlink.MAV_FRAME_MISSION = 2 // NOT a coordinate frame, indicates a mission command.
mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT = 3 // Global coordinate frame, WGS84 coordinate system, relative altitude
                        // over ground with respect to the home
                        // position. First value / x: latitude, second
                        // value / y: longitude, third value / z:
                        // positive altitude with 0 being at the
                        // altitude of the home location.
mavlink.MAV_FRAME_LOCAL_ENU = 4 // Local coordinate frame, Z-down (x: east, y: north, z: up)
mavlink.MAV_FRAME_GLOBAL_INT = 5 // Global coordinate frame, WGS84 coordinate system. First value / x:
                        // latitude in degrees*1.0e-7, second value /
                        // y: longitude in degrees*1.0e-7, third value
                        // / z: positive altitude over mean sea level
                        // (MSL)
mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6 // Global coordinate frame, WGS84 coordinate system, relative altitude
                        // over ground with respect to the home
                        // position. First value / x: latitude in
                        // degrees*10e-7, second value / y: longitude
                        // in degrees*10e-7, third value / z: positive
                        // altitude with 0 being at the altitude of
                        // the home location.
mavlink.MAV_FRAME_LOCAL_OFFSET_NED = 7 // Offset to the current local frame. Anything expressed in this frame
                        // should be added to the current local frame
                        // position.
mavlink.MAV_FRAME_BODY_NED = 8 // Setpoint in body NED frame. This makes sense if all position control
                        // is externalized - e.g. useful to command 2
                        // m/s^2 acceleration to the right.
mavlink.MAV_FRAME_BODY_OFFSET_NED = 9 // Offset in body NED frame. This makes sense if adding setpoints to the
                        // current flight path, to avoid an obstacle -
                        // e.g. useful to command 2 m/s^2 acceleration
                        // to the east.
mavlink.MAV_FRAME_GLOBAL_TERRAIN_ALT = 10 // Global coordinate frame with above terrain level altitude. WGS84
                        // coordinate system, relative altitude over
                        // terrain with respect to the waypoint
                        // coordinate. First value / x: latitude in
                        // degrees, second value / y: longitude in
                        // degrees, third value / z: positive altitude
                        // in meters with 0 being at ground level in
                        // terrain model.
mavlink.MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 // Global coordinate frame with above terrain level altitude. WGS84
                        // coordinate system, relative altitude over
                        // terrain with respect to the waypoint
                        // coordinate. First value / x: latitude in
                        // degrees*10e-7, second value / y: longitude
                        // in degrees*10e-7, third value / z: positive
                        // altitude in meters with 0 being at ground
                        // level in terrain model.
mavlink.MAV_FRAME_ENUM_END = 12 // 

// MAVLINK_DATA_STREAM_TYPE
mavlink.MAVLINK_DATA_STREAM_IMG_JPEG = 1 // 
mavlink.MAVLINK_DATA_STREAM_IMG_BMP = 2 // 
mavlink.MAVLINK_DATA_STREAM_IMG_RAW8U = 3 // 
mavlink.MAVLINK_DATA_STREAM_IMG_RAW32U = 4 // 
mavlink.MAVLINK_DATA_STREAM_IMG_PGM = 5 // 
mavlink.MAVLINK_DATA_STREAM_IMG_PNG = 6 // 
mavlink.MAVLINK_DATA_STREAM_TYPE_ENUM_END = 7 // 

// FENCE_ACTION
mavlink.FENCE_ACTION_NONE = 0 // Disable fenced mode
mavlink.FENCE_ACTION_GUIDED = 1 // Switched to guided mode to return point (fence point 0)
mavlink.FENCE_ACTION_REPORT = 2 // Report fence breach, but don't take action
mavlink.FENCE_ACTION_GUIDED_THR_PASS = 3 // Switched to guided mode to return point (fence point 0) with manual
                        // throttle control
mavlink.FENCE_ACTION_ENUM_END = 4 // 

// FENCE_BREACH
mavlink.FENCE_BREACH_NONE = 0 // No last fence breach
mavlink.FENCE_BREACH_MINALT = 1 // Breached minimum altitude
mavlink.FENCE_BREACH_MAXALT = 2 // Breached maximum altitude
mavlink.FENCE_BREACH_BOUNDARY = 3 // Breached fence boundary
mavlink.FENCE_BREACH_ENUM_END = 4 // 

// MAV_MOUNT_MODE
mavlink.MAV_MOUNT_MODE_RETRACT = 0 // Load and keep safe position (Roll,Pitch,Yaw) from permant memory and
                        // stop stabilization
mavlink.MAV_MOUNT_MODE_NEUTRAL = 1 // Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory.
mavlink.MAV_MOUNT_MODE_MAVLINK_TARGETING = 2 // Load neutral position and start MAVLink Roll,Pitch,Yaw control with
                        // stabilization
mavlink.MAV_MOUNT_MODE_RC_TARGETING = 3 // Load neutral position and start RC Roll,Pitch,Yaw control with
                        // stabilization
mavlink.MAV_MOUNT_MODE_GPS_POINT = 4 // Load neutral position and start to point to Lat,Lon,Alt
mavlink.MAV_MOUNT_MODE_ENUM_END = 5 // 

// MAV_CMD
mavlink.MAV_CMD_NAV_WAYPOINT = 16 // Navigate to MISSION.
mavlink.MAV_CMD_NAV_LOITER_UNLIM = 17 // Loiter around this MISSION an unlimited amount of time
mavlink.MAV_CMD_NAV_LOITER_TURNS = 18 // Loiter around this MISSION for X turns
mavlink.MAV_CMD_NAV_LOITER_TIME = 19 // Loiter around this MISSION for X seconds
mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH = 20 // Return to launch location
mavlink.MAV_CMD_NAV_LAND = 21 // Land at location
mavlink.MAV_CMD_NAV_TAKEOFF = 22 // Takeoff from ground / hand
mavlink.MAV_CMD_NAV_LAND_LOCAL = 23 // Land at local position (local frame only)
mavlink.MAV_CMD_NAV_TAKEOFF_LOCAL = 24 // Takeoff from local position (local frame only)
mavlink.MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT = 30 // Continue on the current course and climb/descend to specified
                        // altitude.  When the altitude is reached
                        // continue to the next command (i.e., don't
                        // proceed to the next command until the
                        // desired altitude is reached.
mavlink.MAV_CMD_NAV_LOITER_TO_ALT = 31 // Begin loiter at the specified Latitude and Longitude.  If Lat=Lon=0,
                        // then loiter at the current position.  Don't
                        // consider the navigation command complete
                        // (don't leave loiter) until the altitude has
                        // been reached.  Additionally, if the Heading
                        // Required parameter is non-zero the
                        // aircraft will not leave the loiter until
                        // heading toward the next waypoint.
mavlink.MAV_CMD_NAV_ROI = 80 // Sets the region of interest (ROI) for a sensor set or the vehicle
                        // itself. This can then be used by the
                        // vehicles control system to control the
                        // vehicle attitude and the attitude of
                        // various sensors such as cameras.
mavlink.MAV_CMD_NAV_PATHPLANNING = 81 // Control autonomous path planning on the MAV.
mavlink.MAV_CMD_NAV_SPLINE_WAYPOINT = 82 // Navigate to MISSION using a spline path.
mavlink.MAV_CMD_NAV_GUIDED_ENABLE = 92 // hand control over to an external controller
mavlink.MAV_CMD_NAV_LAST = 95 // NOP - This command is only used to mark the upper limit of the
                        // NAV/ACTION commands in the enumeration
mavlink.MAV_CMD_CONDITION_DELAY = 112 // Delay mission state machine.
mavlink.MAV_CMD_CONDITION_CHANGE_ALT = 113 // Ascend/descend at rate.  Delay mission state machine until desired
                        // altitude reached.
mavlink.MAV_CMD_CONDITION_DISTANCE = 114 // Delay mission state machine until within desired distance of next NAV
                        // point.
mavlink.MAV_CMD_CONDITION_YAW = 115 // Reach a certain target angle.
mavlink.MAV_CMD_CONDITION_LAST = 159 // NOP - This command is only used to mark the upper limit of the
                        // CONDITION commands in the enumeration
mavlink.MAV_CMD_DO_SET_MODE = 176 // Set system mode.
mavlink.MAV_CMD_DO_JUMP = 177 // Jump to the desired command in the mission list.  Repeat this action
                        // only the specified number of times
mavlink.MAV_CMD_DO_CHANGE_SPEED = 178 // Change speed and/or throttle set points.
mavlink.MAV_CMD_DO_SET_HOME = 179 // Changes the home location either to the current location or a
                        // specified location.
mavlink.MAV_CMD_DO_SET_PARAMETER = 180 // Set a system parameter.  Caution!  Use of this command requires
                        // knowledge of the numeric enumeration value
                        // of the parameter.
mavlink.MAV_CMD_DO_SET_RELAY = 181 // Set a relay to a condition.
mavlink.MAV_CMD_DO_REPEAT_RELAY = 182 // Cycle a relay on and off for a desired number of cyles with a desired
                        // period.
mavlink.MAV_CMD_DO_SET_SERVO = 183 // Set a servo to a desired PWM value.
mavlink.MAV_CMD_DO_REPEAT_SERVO = 184 // Cycle a between its nominal setting and a desired PWM for a desired
                        // number of cycles with a desired period.
mavlink.MAV_CMD_DO_FLIGHTTERMINATION = 185 // Terminate flight immediately
mavlink.MAV_CMD_DO_LAND_START = 189 // Mission command to perform a landing. This is used as a marker in a
                        // mission to tell the autopilot where a
                        // sequence of mission items that represents a
                        // landing starts. It may also be sent via a
                        // COMMAND_LONG to trigger a landing, in which
                        // case the nearest (geographically) landing
                        // sequence in the mission will be used. The
                        // Latitude/Longitude is optional, and may be
                        // set to 0/0 if not needed. If specified then
                        // it will be used to help find the closest
                        // landing sequence.
mavlink.MAV_CMD_DO_RALLY_LAND = 190 // Mission command to perform a landing from a rally point.
mavlink.MAV_CMD_DO_GO_AROUND = 191 // Mission command to safely abort an autonmous landing.
mavlink.MAV_CMD_DO_CONTROL_VIDEO = 200 // Control onboard camera system.
mavlink.MAV_CMD_DO_SET_ROI = 201 // Sets the region of interest (ROI) for a sensor set or the vehicle
                        // itself. This can then be used by the
                        // vehicles control system to control the
                        // vehicle attitude and the attitude of
                        // various sensors such as cameras.
mavlink.MAV_CMD_DO_DIGICAM_CONFIGURE = 202 // Mission command to configure an on-board camera controller system.
mavlink.MAV_CMD_DO_DIGICAM_CONTROL = 203 // Mission command to control an on-board camera controller system.
mavlink.MAV_CMD_DO_MOUNT_CONFIGURE = 204 // Mission command to configure a camera or antenna mount
mavlink.MAV_CMD_DO_MOUNT_CONTROL = 205 // Mission command to control a camera or antenna mount
mavlink.MAV_CMD_DO_SET_CAM_TRIGG_DIST = 206 // Mission command to set CAM_TRIGG_DIST for this flight
mavlink.MAV_CMD_DO_FENCE_ENABLE = 207 // Mission command to enable the geofence
mavlink.MAV_CMD_DO_PARACHUTE = 208 // Mission command to trigger a parachute
mavlink.MAV_CMD_DO_INVERTED_FLIGHT = 210 // Change to/from inverted flight
mavlink.MAV_CMD_DO_MOUNT_CONTROL_QUAT = 220 // Mission command to control a camera or antenna mount, using a
                        // quaternion as reference.
mavlink.MAV_CMD_DO_GUIDED_MASTER = 221 // set id of master controller
mavlink.MAV_CMD_DO_GUIDED_LIMITS = 222 // set limits for external control
mavlink.MAV_CMD_DO_LAST = 240 // NOP - This command is only used to mark the upper limit of the DO
                        // commands in the enumeration
mavlink.MAV_CMD_PREFLIGHT_CALIBRATION = 241 // Trigger calibration. This command will be only accepted if in pre-
                        // flight mode.
mavlink.MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS = 242 // Set sensor offsets. This command will be only accepted if in pre-
                        // flight mode.
mavlink.MAV_CMD_PREFLIGHT_STORAGE = 245 // Request storage of different parameter values and logs. This command
                        // will be only accepted if in pre-flight
                        // mode.
mavlink.MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN = 246 // Request the reboot or shutdown of system components.
mavlink.MAV_CMD_OVERRIDE_GOTO = 252 // Hold / continue the current action
mavlink.MAV_CMD_MISSION_START = 300 // start running a mission
mavlink.MAV_CMD_COMPONENT_ARM_DISARM = 400 // Arms / Disarms a component
mavlink.MAV_CMD_START_RX_PAIR = 500 // Starts receiver pairing
mavlink.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES = 520 // Request autopilot capabilities
mavlink.MAV_CMD_IMAGE_START_CAPTURE = 2000 // Start image capture sequence
mavlink.MAV_CMD_IMAGE_STOP_CAPTURE = 2001 // Stop image capture sequence
mavlink.MAV_CMD_DO_TRIGGER_CONTROL = 2003 // Enable or disable on-board camera triggering system.
mavlink.MAV_CMD_VIDEO_START_CAPTURE = 2500 // Starts video capture
mavlink.MAV_CMD_VIDEO_STOP_CAPTURE = 2501 // Stop the current video capture
mavlink.MAV_CMD_PANORAMA_CREATE = 2800 // Create a panorama at the current position
mavlink.MAV_CMD_PAYLOAD_PREPARE_DEPLOY = 30001 // Deploy payload on a Lat / Lon / Alt position. This includes the
                        // navigation to reach the required release
                        // position and velocity.
mavlink.MAV_CMD_PAYLOAD_CONTROL_DEPLOY = 30002 // Control the payload deployment.
mavlink.MAV_CMD_ENUM_END = 30003 // 

// MAV_DATA_STREAM
mavlink.MAV_DATA_STREAM_ALL = 0 // Enable all data streams
mavlink.MAV_DATA_STREAM_RAW_SENSORS = 1 // Enable IMU_RAW, GPS_RAW, GPS_STATUS packets.
mavlink.MAV_DATA_STREAM_EXTENDED_STATUS = 2 // Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS
mavlink.MAV_DATA_STREAM_RC_CHANNELS = 3 // Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW
mavlink.MAV_DATA_STREAM_RAW_CONTROLLER = 4 // Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT,
                        // NAV_CONTROLLER_OUTPUT.
mavlink.MAV_DATA_STREAM_POSITION = 6 // Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages.
mavlink.MAV_DATA_STREAM_EXTRA1 = 10 // Dependent on the autopilot
mavlink.MAV_DATA_STREAM_EXTRA2 = 11 // Dependent on the autopilot
mavlink.MAV_DATA_STREAM_EXTRA3 = 12 // Dependent on the autopilot
mavlink.MAV_DATA_STREAM_ENUM_END = 13 // 

// MAV_ROI
mavlink.MAV_ROI_NONE = 0 // No region of interest.
mavlink.MAV_ROI_WPNEXT = 1 // Point toward next MISSION.
mavlink.MAV_ROI_WPINDEX = 2 // Point toward given MISSION.
mavlink.MAV_ROI_LOCATION = 3 // Point toward fixed location.
mavlink.MAV_ROI_TARGET = 4 // Point toward of given id.
mavlink.MAV_ROI_ENUM_END = 5 // 

// MAV_CMD_ACK
mavlink.MAV_CMD_ACK_OK = 1 // Command / mission item is ok.
mavlink.MAV_CMD_ACK_ERR_FAIL = 2 // Generic error message if none of the other reasons fails or if no
                        // detailed error reporting is implemented.
mavlink.MAV_CMD_ACK_ERR_ACCESS_DENIED = 3 // The system is refusing to accept this command from this source /
                        // communication partner.
mavlink.MAV_CMD_ACK_ERR_NOT_SUPPORTED = 4 // Command or mission item is not supported, other commands would be
                        // accepted.
mavlink.MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED = 5 // The coordinate frame of this command / mission item is not supported.
mavlink.MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE = 6 // The coordinate frame of this command is ok, but he coordinate values
                        // exceed the safety limits of this system.
                        // This is a generic error, please use the
                        // more specific error messages below if
                        // possible.
mavlink.MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE = 7 // The X or latitude value is out of range.
mavlink.MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE = 8 // The Y or longitude value is out of range.
mavlink.MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE = 9 // The Z or altitude value is out of range.
mavlink.MAV_CMD_ACK_ENUM_END = 10 // 

// MAV_PARAM_TYPE
mavlink.MAV_PARAM_TYPE_UINT8 = 1 // 8-bit unsigned integer
mavlink.MAV_PARAM_TYPE_INT8 = 2 // 8-bit signed integer
mavlink.MAV_PARAM_TYPE_UINT16 = 3 // 16-bit unsigned integer
mavlink.MAV_PARAM_TYPE_INT16 = 4 // 16-bit signed integer
mavlink.MAV_PARAM_TYPE_UINT32 = 5 // 32-bit unsigned integer
mavlink.MAV_PARAM_TYPE_INT32 = 6 // 32-bit signed integer
mavlink.MAV_PARAM_TYPE_UINT64 = 7 // 64-bit unsigned integer
mavlink.MAV_PARAM_TYPE_INT64 = 8 // 64-bit signed integer
mavlink.MAV_PARAM_TYPE_REAL32 = 9 // 32-bit floating-point
mavlink.MAV_PARAM_TYPE_REAL64 = 10 // 64-bit floating-point
mavlink.MAV_PARAM_TYPE_ENUM_END = 11 // 

// MAV_RESULT
mavlink.MAV_RESULT_ACCEPTED = 0 // Command ACCEPTED and EXECUTED
mavlink.MAV_RESULT_TEMPORARILY_REJECTED = 1 // Command TEMPORARY REJECTED/DENIED
mavlink.MAV_RESULT_DENIED = 2 // Command PERMANENTLY DENIED
mavlink.MAV_RESULT_UNSUPPORTED = 3 // Command UNKNOWN/UNSUPPORTED
mavlink.MAV_RESULT_FAILED = 4 // Command executed, but failed
mavlink.MAV_RESULT_ENUM_END = 5 // 

// MAV_MISSION_RESULT
mavlink.MAV_MISSION_ACCEPTED = 0 // mission accepted OK
mavlink.MAV_MISSION_ERROR = 1 // generic error / not accepting mission commands at all right now
mavlink.MAV_MISSION_UNSUPPORTED_FRAME = 2 // coordinate frame is not supported
mavlink.MAV_MISSION_UNSUPPORTED = 3 // command is not supported
mavlink.MAV_MISSION_NO_SPACE = 4 // mission item exceeds storage space
mavlink.MAV_MISSION_INVALID = 5 // one of the parameters has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM1 = 6 // param1 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM2 = 7 // param2 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM3 = 8 // param3 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM4 = 9 // param4 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM5_X = 10 // x/param5 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM6_Y = 11 // y/param6 has an invalid value
mavlink.MAV_MISSION_INVALID_PARAM7 = 12 // param7 has an invalid value
mavlink.MAV_MISSION_INVALID_SEQUENCE = 13 // received waypoint out of sequence
mavlink.MAV_MISSION_DENIED = 14 // not accepting any mission commands from this communication partner
mavlink.MAV_MISSION_RESULT_ENUM_END = 15 // 

// MAV_SEVERITY
mavlink.MAV_SEVERITY_EMERGENCY = 0 // System is unusable. This is a "panic" condition.
mavlink.MAV_SEVERITY_ALERT = 1 // Action should be taken immediately. Indicates error in non-critical
                        // systems.
mavlink.MAV_SEVERITY_CRITICAL = 2 // Action must be taken immediately. Indicates failure in a primary
                        // system.
mavlink.MAV_SEVERITY_ERROR = 3 // Indicates an error in secondary/redundant systems.
mavlink.MAV_SEVERITY_WARNING = 4 // Indicates about a possible future error if this is not resolved within
                        // a given timeframe. Example would be a low
                        // battery warning.
mavlink.MAV_SEVERITY_NOTICE = 5 // An unusual event has occured, though not an error condition. This
                        // should be investigated for the root cause.
mavlink.MAV_SEVERITY_INFO = 6 // Normal operational messages. Useful for logging. No action is required
                        // for these messages.
mavlink.MAV_SEVERITY_DEBUG = 7 // Useful non-operational messages that can assist in debugging. These
                        // should not occur during normal operation.
mavlink.MAV_SEVERITY_ENUM_END = 8 // 

// MAV_POWER_STATUS
mavlink.MAV_POWER_STATUS_BRICK_VALID = 1 // main brick power supply valid
mavlink.MAV_POWER_STATUS_SERVO_VALID = 2 // main servo power supply valid for FMU
mavlink.MAV_POWER_STATUS_USB_CONNECTED = 4 // USB power is connected
mavlink.MAV_POWER_STATUS_PERIPH_OVERCURRENT = 8 // peripheral supply is in over-current state
mavlink.MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT = 16 // hi-power peripheral supply is in over-current state
mavlink.MAV_POWER_STATUS_CHANGED = 32 // Power status has changed since boot
mavlink.MAV_POWER_STATUS_ENUM_END = 33 // 

// SERIAL_CONTROL_DEV
mavlink.SERIAL_CONTROL_DEV_TELEM1 = 0 // First telemetry port
mavlink.SERIAL_CONTROL_DEV_TELEM2 = 1 // Second telemetry port
mavlink.SERIAL_CONTROL_DEV_GPS1 = 2 // First GPS port
mavlink.SERIAL_CONTROL_DEV_GPS2 = 3 // Second GPS port
mavlink.SERIAL_CONTROL_DEV_SHELL = 10 // system shell
mavlink.SERIAL_CONTROL_DEV_ENUM_END = 11 // 

// SERIAL_CONTROL_FLAG
mavlink.SERIAL_CONTROL_FLAG_REPLY = 1 // Set if this is a reply
mavlink.SERIAL_CONTROL_FLAG_RESPOND = 2 // Set if the sender wants the receiver to send a response as another
                        // SERIAL_CONTROL message
mavlink.SERIAL_CONTROL_FLAG_EXCLUSIVE = 4 // Set if access to the serial port should be removed from whatever
                        // driver is currently using it, giving
                        // exclusive access to the SERIAL_CONTROL
                        // protocol. The port can be handed back by
                        // sending a request without this flag set
mavlink.SERIAL_CONTROL_FLAG_BLOCKING = 8 // Block on writes to the serial port
mavlink.SERIAL_CONTROL_FLAG_MULTI = 16 // Send multiple replies until port is drained
mavlink.SERIAL_CONTROL_FLAG_ENUM_END = 17 // 

// MAV_DISTANCE_SENSOR
mavlink.MAV_DISTANCE_SENSOR_LASER = 0 // Laser rangefinder, e.g. LightWare SF02/F or PulsedLight units
mavlink.MAV_DISTANCE_SENSOR_ULTRASOUND = 1 // Ultrasound rangefinder, e.g. MaxBotix units
mavlink.MAV_DISTANCE_SENSOR_INFRARED = 2 // Infrared rangefinder, e.g. Sharp units
mavlink.MAV_DISTANCE_SENSOR_ENUM_END = 3 // 

// MAV_SENSOR_ORIENTATION
mavlink.MAV_SENSOR_ROTATION_NONE = 0 // Roll: 0, Pitch: 0, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_YAW_45 = 1 // Roll: 0, Pitch: 0, Yaw: 45
mavlink.MAV_SENSOR_ROTATION_YAW_90 = 2 // Roll: 0, Pitch: 0, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_YAW_135 = 3 // Roll: 0, Pitch: 0, Yaw: 135
mavlink.MAV_SENSOR_ROTATION_YAW_180 = 4 // Roll: 0, Pitch: 0, Yaw: 180
mavlink.MAV_SENSOR_ROTATION_YAW_225 = 5 // Roll: 0, Pitch: 0, Yaw: 225
mavlink.MAV_SENSOR_ROTATION_YAW_270 = 6 // Roll: 0, Pitch: 0, Yaw: 270
mavlink.MAV_SENSOR_ROTATION_YAW_315 = 7 // Roll: 0, Pitch: 0, Yaw: 315
mavlink.MAV_SENSOR_ROTATION_ROLL_180 = 8 // Roll: 180, Pitch: 0, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_45 = 9 // Roll: 180, Pitch: 0, Yaw: 45
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_90 = 10 // Roll: 180, Pitch: 0, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_135 = 11 // Roll: 180, Pitch: 0, Yaw: 135
mavlink.MAV_SENSOR_ROTATION_PITCH_180 = 12 // Roll: 0, Pitch: 180, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_225 = 13 // Roll: 180, Pitch: 0, Yaw: 225
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_270 = 14 // Roll: 180, Pitch: 0, Yaw: 270
mavlink.MAV_SENSOR_ROTATION_ROLL_180_YAW_315 = 15 // Roll: 180, Pitch: 0, Yaw: 315
mavlink.MAV_SENSOR_ROTATION_ROLL_90 = 16 // Roll: 90, Pitch: 0, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_90_YAW_45 = 17 // Roll: 90, Pitch: 0, Yaw: 45
mavlink.MAV_SENSOR_ROTATION_ROLL_90_YAW_90 = 18 // Roll: 90, Pitch: 0, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_ROLL_90_YAW_135 = 19 // Roll: 90, Pitch: 0, Yaw: 135
mavlink.MAV_SENSOR_ROTATION_ROLL_270 = 20 // Roll: 270, Pitch: 0, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_270_YAW_45 = 21 // Roll: 270, Pitch: 0, Yaw: 45
mavlink.MAV_SENSOR_ROTATION_ROLL_270_YAW_90 = 22 // Roll: 270, Pitch: 0, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_ROLL_270_YAW_135 = 23 // Roll: 270, Pitch: 0, Yaw: 135
mavlink.MAV_SENSOR_ROTATION_PITCH_90 = 24 // Roll: 0, Pitch: 90, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_PITCH_270 = 25 // Roll: 0, Pitch: 270, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_PITCH_180_YAW_90 = 26 // Roll: 0, Pitch: 180, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_PITCH_180_YAW_270 = 27 // Roll: 0, Pitch: 180, Yaw: 270
mavlink.MAV_SENSOR_ROTATION_ROLL_90_PITCH_90 = 28 // Roll: 90, Pitch: 90, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_180_PITCH_90 = 29 // Roll: 180, Pitch: 90, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_270_PITCH_90 = 30 // Roll: 270, Pitch: 90, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_90_PITCH_180 = 31 // Roll: 90, Pitch: 180, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_270_PITCH_180 = 32 // Roll: 270, Pitch: 180, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_90_PITCH_270 = 33 // Roll: 90, Pitch: 270, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_180_PITCH_270 = 34 // Roll: 180, Pitch: 270, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_270_PITCH_270 = 35 // Roll: 270, Pitch: 270, Yaw: 0
mavlink.MAV_SENSOR_ROTATION_ROLL_90_PITCH_180_YAW_90 = 36 // Roll: 90, Pitch: 180, Yaw: 90
mavlink.MAV_SENSOR_ROTATION_ROLL_90_YAW_270 = 37 // Roll: 90, Pitch: 0, Yaw: 270
mavlink.MAV_SENSOR_ROTATION_ROLL_315_PITCH_315_YAW_315 = 38 // Roll: 315, Pitch: 315, Yaw: 315
mavlink.MAV_SENSOR_ORIENTATION_ENUM_END = 39 // 

// MAV_PROTOCOL_CAPABILITY
mavlink.MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT = 1 // Autopilot supports MISSION float message type.
mavlink.MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT = 2 // Autopilot supports the new param float message type.
mavlink.MAV_PROTOCOL_CAPABILITY_MISSION_INT = 4 // Autopilot supports MISSION_INT scaled integer message type.
mavlink.MAV_PROTOCOL_CAPABILITY_COMMAND_INT = 8 // Autopilot supports COMMAND_INT scaled integer message type.
mavlink.MAV_PROTOCOL_CAPABILITY_PARAM_UNION = 16 // Autopilot supports the new param union message type.
mavlink.MAV_PROTOCOL_CAPABILITY_FTP = 32 // Autopilot supports the new param union message type.
mavlink.MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET = 64 // Autopilot supports commanding attitude offboard.
mavlink.MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED = 128 // Autopilot supports commanding position and velocity targets in local
                        // NED frame.
mavlink.MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT = 256 // Autopilot supports commanding position and velocity targets in global
                        // scaled integers.
mavlink.MAV_PROTOCOL_CAPABILITY_TERRAIN = 512 // Autopilot supports terrain protocol / data handling.
mavlink.MAV_PROTOCOL_CAPABILITY_SET_ACTUATOR_TARGET = 1024 // Autopilot supports direct actuator control.
mavlink.MAV_PROTOCOL_CAPABILITY_ENUM_END = 1025 // 

// MAV_ESTIMATOR_TYPE
mavlink.MAV_ESTIMATOR_TYPE_NAIVE = 1 // This is a naive estimator without any real covariance feedback.
mavlink.MAV_ESTIMATOR_TYPE_VISION = 2 // Computer vision based estimate. Might be up to scale.
mavlink.MAV_ESTIMATOR_TYPE_VIO = 3 // Visual-inertial estimate.
mavlink.MAV_ESTIMATOR_TYPE_GPS = 4 // Plain GPS estimate.
mavlink.MAV_ESTIMATOR_TYPE_GPS_INS = 5 // Estimator integrating GPS and inertial sensing.
mavlink.MAV_ESTIMATOR_TYPE_ENUM_END = 6 // 

// MAV_BATTERY_TYPE
mavlink.MAV_BATTERY_TYPE_UNKNOWN = 0 // Not specified.
mavlink.MAV_BATTERY_TYPE_LIPO = 1 // Lithium polymere battery
mavlink.MAV_BATTERY_TYPE_LIFE = 2 // Lithium ferrite battery
mavlink.MAV_BATTERY_TYPE_LION = 3 // Lithium-ION battery
mavlink.MAV_BATTERY_TYPE_NIMH = 4 // Nickel metal hydride battery
mavlink.MAV_BATTERY_TYPE_ENUM_END = 5 // 

// MAV_BATTERY_FUNCTION
mavlink.MAV_BATTERY_FUNCTION_UNKNOWN = 0 // Lithium polymere battery
mavlink.MAV_BATTERY_FUNCTION_ALL = 1 // Battery supports all flight systems
mavlink.MAV_BATTERY_FUNCTION_PROPULSION = 2 // Battery for the propulsion system
mavlink.MAV_BATTERY_FUNCTION_AVIONICS = 3 // Avionics battery
mavlink.MAV_BATTERY_TYPE_PAYLOAD = 4 // Payload battery
mavlink.MAV_BATTERY_FUNCTION_ENUM_END = 5 // 

// message IDs
mavlink.MAVLINK_MSG_ID_BAD_DATA = -1
mavlink.MAVLINK_MSG_ID_HEARTBEAT = 0
mavlink.MAVLINK_MSG_ID_SYS_STATUS = 1
mavlink.MAVLINK_MSG_ID_SYSTEM_TIME = 2
mavlink.MAVLINK_MSG_ID_PING = 4
mavlink.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL = 5
mavlink.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK = 6
mavlink.MAVLINK_MSG_ID_AUTH_KEY = 7
mavlink.MAVLINK_MSG_ID_SET_MODE = 11
mavlink.MAVLINK_MSG_ID_PARAM_REQUEST_READ = 20
mavlink.MAVLINK_MSG_ID_PARAM_REQUEST_LIST = 21
mavlink.MAVLINK_MSG_ID_PARAM_VALUE = 22
mavlink.MAVLINK_MSG_ID_PARAM_SET = 23
mavlink.MAVLINK_MSG_ID_GPS_RAW_INT = 24
mavlink.MAVLINK_MSG_ID_GPS_STATUS = 25
mavlink.MAVLINK_MSG_ID_SCALED_IMU = 26
mavlink.MAVLINK_MSG_ID_RAW_IMU = 27
mavlink.MAVLINK_MSG_ID_RAW_PRESSURE = 28
mavlink.MAVLINK_MSG_ID_SCALED_PRESSURE = 29
mavlink.MAVLINK_MSG_ID_ATTITUDE = 30
mavlink.MAVLINK_MSG_ID_ATTITUDE_QUATERNION = 31
mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED = 32
mavlink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT = 33
mavlink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED = 34
mavlink.MAVLINK_MSG_ID_RC_CHANNELS_RAW = 35
mavlink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW = 36
mavlink.MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST = 37
mavlink.MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST = 38
mavlink.MAVLINK_MSG_ID_MISSION_ITEM = 39
mavlink.MAVLINK_MSG_ID_MISSION_REQUEST = 40
mavlink.MAVLINK_MSG_ID_MISSION_SET_CURRENT = 41
mavlink.MAVLINK_MSG_ID_MISSION_CURRENT = 42
mavlink.MAVLINK_MSG_ID_MISSION_REQUEST_LIST = 43
mavlink.MAVLINK_MSG_ID_MISSION_COUNT = 44
mavlink.MAVLINK_MSG_ID_MISSION_CLEAR_ALL = 45
mavlink.MAVLINK_MSG_ID_MISSION_ITEM_REACHED = 46
mavlink.MAVLINK_MSG_ID_MISSION_ACK = 47
mavlink.MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN = 48
mavlink.MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN = 49
mavlink.MAVLINK_MSG_ID_PARAM_MAP_RC = 50
mavlink.MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 54
mavlink.MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 55
mavlink.MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV = 61
mavlink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT = 62
mavlink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV = 63
mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV = 64
mavlink.MAVLINK_MSG_ID_RC_CHANNELS = 65
mavlink.MAVLINK_MSG_ID_REQUEST_DATA_STREAM = 66
mavlink.MAVLINK_MSG_ID_DATA_STREAM = 67
mavlink.MAVLINK_MSG_ID_MANUAL_CONTROL = 69
mavlink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE = 70
mavlink.MAVLINK_MSG_ID_MISSION_ITEM_INT = 73
mavlink.MAVLINK_MSG_ID_VFR_HUD = 74
mavlink.MAVLINK_MSG_ID_COMMAND_INT = 75
mavlink.MAVLINK_MSG_ID_COMMAND_LONG = 76
mavlink.MAVLINK_MSG_ID_COMMAND_ACK = 77
mavlink.MAVLINK_MSG_ID_MANUAL_SETPOINT = 81
mavlink.MAVLINK_MSG_ID_SET_ATTITUDE_TARGET = 82
mavlink.MAVLINK_MSG_ID_ATTITUDE_TARGET = 83
mavlink.MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED = 84
mavlink.MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED = 85
mavlink.MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT = 86
mavlink.MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT = 87
mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET = 89
mavlink.MAVLINK_MSG_ID_HIL_STATE = 90
mavlink.MAVLINK_MSG_ID_HIL_CONTROLS = 91
mavlink.MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW = 92
mavlink.MAVLINK_MSG_ID_OPTICAL_FLOW = 100
mavlink.MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE = 101
mavlink.MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE = 102
mavlink.MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE = 103
mavlink.MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE = 104
mavlink.MAVLINK_MSG_ID_HIGHRES_IMU = 105
mavlink.MAVLINK_MSG_ID_OPTICAL_FLOW_RAD = 106
mavlink.MAVLINK_MSG_ID_HIL_SENSOR = 107
mavlink.MAVLINK_MSG_ID_SIM_STATE = 108
mavlink.MAVLINK_MSG_ID_RADIO_STATUS = 109
mavlink.MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL = 110
mavlink.MAVLINK_MSG_ID_TIMESYNC = 111
mavlink.MAVLINK_MSG_ID_CAMERA_TRIGGER = 112
mavlink.MAVLINK_MSG_ID_HIL_GPS = 113
mavlink.MAVLINK_MSG_ID_HIL_OPTICAL_FLOW = 114
mavlink.MAVLINK_MSG_ID_HIL_STATE_QUATERNION = 115
mavlink.MAVLINK_MSG_ID_SCALED_IMU2 = 116
mavlink.MAVLINK_MSG_ID_LOG_REQUEST_LIST = 117
mavlink.MAVLINK_MSG_ID_LOG_ENTRY = 118
mavlink.MAVLINK_MSG_ID_LOG_REQUEST_DATA = 119
mavlink.MAVLINK_MSG_ID_LOG_DATA = 120
mavlink.MAVLINK_MSG_ID_LOG_ERASE = 121
mavlink.MAVLINK_MSG_ID_LOG_REQUEST_END = 122
mavlink.MAVLINK_MSG_ID_GPS_INJECT_DATA = 123
mavlink.MAVLINK_MSG_ID_GPS2_RAW = 124
mavlink.MAVLINK_MSG_ID_POWER_STATUS = 125
mavlink.MAVLINK_MSG_ID_SERIAL_CONTROL = 126
mavlink.MAVLINK_MSG_ID_GPS_RTK = 127
mavlink.MAVLINK_MSG_ID_GPS2_RTK = 128
mavlink.MAVLINK_MSG_ID_SCALED_IMU3 = 129
mavlink.MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE = 130
mavlink.MAVLINK_MSG_ID_ENCAPSULATED_DATA = 131
mavlink.MAVLINK_MSG_ID_DISTANCE_SENSOR = 132
mavlink.MAVLINK_MSG_ID_TERRAIN_REQUEST = 133
mavlink.MAVLINK_MSG_ID_TERRAIN_DATA = 134
mavlink.MAVLINK_MSG_ID_TERRAIN_CHECK = 135
mavlink.MAVLINK_MSG_ID_TERRAIN_REPORT = 136
mavlink.MAVLINK_MSG_ID_SCALED_PRESSURE2 = 137
mavlink.MAVLINK_MSG_ID_ATT_POS_MOCAP = 138
mavlink.MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET = 139
mavlink.MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET = 140
mavlink.MAVLINK_MSG_ID_BATTERY_STATUS = 147
mavlink.MAVLINK_MSG_ID_AUTOPILOT_VERSION = 148
mavlink.MAVLINK_MSG_ID_LANDING_TARGET = 149
mavlink.MAVLINK_MSG_ID_VIBRATION = 241
mavlink.MAVLINK_MSG_ID_V2_EXTENSION = 248
mavlink.MAVLINK_MSG_ID_MEMORY_VECT = 249
mavlink.MAVLINK_MSG_ID_DEBUG_VECT = 250
mavlink.MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 251
mavlink.MAVLINK_MSG_ID_NAMED_VALUE_INT = 252
mavlink.MAVLINK_MSG_ID_STATUSTEXT = 253
mavlink.MAVLINK_MSG_ID_DEBUG = 254

mavlink.messages = {};

/* 
The heartbeat message shows that a system is present and responding.
The type of the MAV and Autopilot hardware allow the receiving system
to treat further messages from this system appropriate (e.g. by laying
out the user interface based on the autopilot).

                type                      : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t)
                autopilot                 : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t)
                base_mode                 : System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h (uint8_t)
                custom_mode               : A bitfield for use for autopilot-specific flags. (uint32_t)
                system_status             : System status flag, see MAV_STATE ENUM (uint8_t)
                mavlink_version           : MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version (uint8_t)

*/
mavlink.messages.heartbeat = function(type, autopilot, base_mode, custom_mode, system_status, mavlink_version) {

    this.format = '<IBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_HEARTBEAT;
    this.order_map = [1, 2, 3, 0, 4, 5];
    this.crc_extra = 50;
    this.name = 'HEARTBEAT';

    this.fieldnames = ['type', 'autopilot', 'base_mode', 'custom_mode', 'system_status', 'mavlink_version'];


    this.set(arguments);

}
        
mavlink.messages.heartbeat.prototype = new mavlink.message;

mavlink.messages.heartbeat.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.custom_mode, this.type, this.autopilot, this.base_mode, this.system_status, this.mavlink_version]));
}

/* 
The general system state. If the system is following the MAVLink
standard, the system state is mainly defined by three orthogonal
states/modes: The system mode, which is either LOCKED (motors shut
down and locked), MANUAL (system under RC control), GUIDED (system
with autonomous position control, position setpoint controlled
manually) or AUTO (system guided by path/waypoint planner). The
NAV_MODE defined the current flight state: LIFTOFF (often an open-loop
maneuver), LANDING, WAYPOINTS or VECTOR. This represents the internal
navigation state machine. The system status shows wether the system is
currently active or not and if an emergency occured. During the
CRITICAL and EMERGENCY states the MAV is still considered to be
active, but should start emergency procedures autonomously. After a
failure occured it should first move from active to critical to allow
manual intervention and then move to emergency after a certain
timeout.

                onboard_control_sensors_present        : Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
                onboard_control_sensors_enabled        : Bitmask showing which onboard controllers and sensors are enabled:  Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
                onboard_control_sensors_health        : Bitmask showing which onboard controllers and sensors are operational or have an error:  Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR (uint32_t)
                load                      : Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 (uint16_t)
                voltage_battery           : Battery voltage, in millivolts (1 = 1 millivolt) (uint16_t)
                current_battery           : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
                battery_remaining         : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery (int8_t)
                drop_rate_comm            : Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
                errors_comm               : Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) (uint16_t)
                errors_count1             : Autopilot-specific errors (uint16_t)
                errors_count2             : Autopilot-specific errors (uint16_t)
                errors_count3             : Autopilot-specific errors (uint16_t)
                errors_count4             : Autopilot-specific errors (uint16_t)

*/
mavlink.messages.sys_status = function(onboard_control_sensors_present, onboard_control_sensors_enabled, onboard_control_sensors_health, load, voltage_battery, current_battery, battery_remaining, drop_rate_comm, errors_comm, errors_count1, errors_count2, errors_count3, errors_count4) {

    this.format = '<IIIHHhHHHHHHb';
    this.id = mavlink.MAVLINK_MSG_ID_SYS_STATUS;
    this.order_map = [0, 1, 2, 3, 4, 5, 12, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 124;
    this.name = 'SYS_STATUS';

    this.fieldnames = ['onboard_control_sensors_present', 'onboard_control_sensors_enabled', 'onboard_control_sensors_health', 'load', 'voltage_battery', 'current_battery', 'battery_remaining', 'drop_rate_comm', 'errors_comm', 'errors_count1', 'errors_count2', 'errors_count3', 'errors_count4'];


    this.set(arguments);

}
        
mavlink.messages.sys_status.prototype = new mavlink.message;

mavlink.messages.sys_status.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.onboard_control_sensors_present, this.onboard_control_sensors_enabled, this.onboard_control_sensors_health, this.load, this.voltage_battery, this.current_battery, this.drop_rate_comm, this.errors_comm, this.errors_count1, this.errors_count2, this.errors_count3, this.errors_count4, this.battery_remaining]));
}

/* 
The system time is the time of the master clock, typically the
computer clock of the main onboard computer.

                time_unix_usec            : Timestamp of the master clock in microseconds since UNIX epoch. (uint64_t)
                time_boot_ms              : Timestamp of the component clock since boot time in milliseconds. (uint32_t)

*/
mavlink.messages.system_time = function(time_unix_usec, time_boot_ms) {

    this.format = '<QI';
    this.id = mavlink.MAVLINK_MSG_ID_SYSTEM_TIME;
    this.order_map = [0, 1];
    this.crc_extra = 137;
    this.name = 'SYSTEM_TIME';

    this.fieldnames = ['time_unix_usec', 'time_boot_ms'];


    this.set(arguments);

}
        
mavlink.messages.system_time.prototype = new mavlink.message;

mavlink.messages.system_time.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_unix_usec, this.time_boot_ms]));
}

/* 
A ping message either requesting or responding to a ping. This allows
to measure the system latencies, including serial port, radio modem
and UDP connections.

                time_usec                 : Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009) (uint64_t)
                seq                       : PING sequence (uint32_t)
                target_system             : 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)
                target_component          : 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system (uint8_t)

*/
mavlink.messages.ping = function(time_usec, seq, target_system, target_component) {

    this.format = '<QIBB';
    this.id = mavlink.MAVLINK_MSG_ID_PING;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 237;
    this.name = 'PING';

    this.fieldnames = ['time_usec', 'seq', 'target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.ping.prototype = new mavlink.message;

mavlink.messages.ping.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.seq, this.target_system, this.target_component]));
}

/* 
Request to control this MAV

                target_system             : System the GCS requests control for (uint8_t)
                control_request           : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
                version                   : 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. (uint8_t)
                passkey                   : Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" (char)

*/
mavlink.messages.change_operator_control = function(target_system, control_request, version, passkey) {

    this.format = '<BBB25s';
    this.id = mavlink.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 217;
    this.name = 'CHANGE_OPERATOR_CONTROL';

    this.fieldnames = ['target_system', 'control_request', 'version', 'passkey'];


    this.set(arguments);

}
        
mavlink.messages.change_operator_control.prototype = new mavlink.message;

mavlink.messages.change_operator_control.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.control_request, this.version, this.passkey]));
}

/* 
Accept / deny control of this MAV

                gcs_system_id             : ID of the GCS this message (uint8_t)
                control_request           : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
                ack                       : 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control (uint8_t)

*/
mavlink.messages.change_operator_control_ack = function(gcs_system_id, control_request, ack) {

    this.format = '<BBB';
    this.id = mavlink.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
    this.order_map = [0, 1, 2];
    this.crc_extra = 104;
    this.name = 'CHANGE_OPERATOR_CONTROL_ACK';

    this.fieldnames = ['gcs_system_id', 'control_request', 'ack'];


    this.set(arguments);

}
        
mavlink.messages.change_operator_control_ack.prototype = new mavlink.message;

mavlink.messages.change_operator_control_ack.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.gcs_system_id, this.control_request, this.ack]));
}

/* 
Emit an encrypted signature / key identifying this system. PLEASE
NOTE: This protocol has been kept simple, so transmitting the key
requires an encrypted channel for true safety.

                key                       : key (char)

*/
mavlink.messages.auth_key = function(key) {

    this.format = '<32s';
    this.id = mavlink.MAVLINK_MSG_ID_AUTH_KEY;
    this.order_map = [0];
    this.crc_extra = 119;
    this.name = 'AUTH_KEY';

    this.fieldnames = ['key'];


    this.set(arguments);

}
        
mavlink.messages.auth_key.prototype = new mavlink.message;

mavlink.messages.auth_key.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.key]));
}

/* 
Set the system mode, as defined by enum MAV_MODE. There is no target
component id as the mode is by definition for the overall aircraft,
not only for one component.

                target_system             : The system setting the mode (uint8_t)
                base_mode                 : The new base mode (uint8_t)
                custom_mode               : The new autopilot-specific mode. This field can be ignored by an autopilot. (uint32_t)

*/
mavlink.messages.set_mode = function(target_system, base_mode, custom_mode) {

    this.format = '<IBB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_MODE;
    this.order_map = [1, 2, 0];
    this.crc_extra = 89;
    this.name = 'SET_MODE';

    this.fieldnames = ['target_system', 'base_mode', 'custom_mode'];


    this.set(arguments);

}
        
mavlink.messages.set_mode.prototype = new mavlink.message;

mavlink.messages.set_mode.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.custom_mode, this.target_system, this.base_mode]));
}

/* 
Request to read the onboard parameter with the param_id string id.
Onboard parameters are stored as key[const char*] -> value[float].
This allows to send a parameter to any other component (such as the
GCS) without the need of previous knowledge of possible parameter
names. Thus the same GCS can store different parameters for different
autopilots. See also http://qgroundcontrol.org/parameter_interface for
a full documentation of QGroundControl and IMU code.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                param_id                  : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
                param_index               : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) (int16_t)

*/
mavlink.messages.param_request_read = function(target_system, target_component, param_id, param_index) {

    this.format = '<hBB16s';
    this.id = mavlink.MAVLINK_MSG_ID_PARAM_REQUEST_READ;
    this.order_map = [1, 2, 3, 0];
    this.crc_extra = 214;
    this.name = 'PARAM_REQUEST_READ';

    this.fieldnames = ['target_system', 'target_component', 'param_id', 'param_index'];


    this.set(arguments);

}
        
mavlink.messages.param_request_read.prototype = new mavlink.message;

mavlink.messages.param_request_read.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param_index, this.target_system, this.target_component, this.param_id]));
}

/* 
Request all parameters of this component. After his request, all
parameters are emitted.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)

*/
mavlink.messages.param_request_list = function(target_system, target_component) {

    this.format = '<BB';
    this.id = mavlink.MAVLINK_MSG_ID_PARAM_REQUEST_LIST;
    this.order_map = [0, 1];
    this.crc_extra = 159;
    this.name = 'PARAM_REQUEST_LIST';

    this.fieldnames = ['target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.param_request_list.prototype = new mavlink.message;

mavlink.messages.param_request_list.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component]));
}

/* 
Emit the value of a onboard parameter. The inclusion of param_count
and param_index in the message allows the recipient to keep track of
received parameters and allows him to re-request missing parameters
after a loss or timeout.

                param_id                  : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
                param_value               : Onboard parameter value (float)
                param_type                : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)
                param_count               : Total number of onboard parameters (uint16_t)
                param_index               : Index of this onboard parameter (uint16_t)

*/
mavlink.messages.param_value = function(param_id, param_value, param_type, param_count, param_index) {

    this.format = '<fHH16sB';
    this.id = mavlink.MAVLINK_MSG_ID_PARAM_VALUE;
    this.order_map = [3, 0, 4, 1, 2];
    this.crc_extra = 220;
    this.name = 'PARAM_VALUE';

    this.fieldnames = ['param_id', 'param_value', 'param_type', 'param_count', 'param_index'];


    this.set(arguments);

}
        
mavlink.messages.param_value.prototype = new mavlink.message;

mavlink.messages.param_value.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param_value, this.param_count, this.param_index, this.param_id, this.param_type]));
}

/* 
Set a parameter value TEMPORARILY to RAM. It will be reset to default
on system reboot. Send the ACTION MAV_ACTION_STORAGE_WRITE to
PERMANENTLY write the RAM contents to EEPROM. IMPORTANT: The receiving
component should acknowledge the new parameter value by sending a
param_value message to all communication partners. This will also
ensure that multiple GCS all have an up-to-date list of all
parameters. If the sending GCS did not receive a PARAM_VALUE message
within its timeout time, it should re-send the PARAM_SET message.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                param_id                  : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
                param_value               : Onboard parameter value (float)
                param_type                : Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. (uint8_t)

*/
mavlink.messages.param_set = function(target_system, target_component, param_id, param_value, param_type) {

    this.format = '<fBB16sB';
    this.id = mavlink.MAVLINK_MSG_ID_PARAM_SET;
    this.order_map = [1, 2, 3, 0, 4];
    this.crc_extra = 168;
    this.name = 'PARAM_SET';

    this.fieldnames = ['target_system', 'target_component', 'param_id', 'param_value', 'param_type'];


    this.set(arguments);

}
        
mavlink.messages.param_set.prototype = new mavlink.message;

mavlink.messages.param_set.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param_value, this.target_system, this.target_component, this.param_id, this.param_type]));
}

/* 
The global position, as returned by the Global Positioning System
(GPS). This is                 NOT the global position estimate of the
system, but rather a RAW sensor value. See message GLOBAL_POSITION for
the global position estimate. Coordinate frame is right-handed, Z-axis
up (GPS frame).

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                fix_type                  : 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. (uint8_t)
                lat                       : Latitude (WGS84), in degrees * 1E7 (int32_t)
                lon                       : Longitude (WGS84), in degrees * 1E7 (int32_t)
                alt                       : Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. (int32_t)
                eph                       : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
                epv                       : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
                vel                       : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
                cog                       : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
                satellites_visible        : Number of satellites visible. If unknown, set to 255 (uint8_t)

*/
mavlink.messages.gps_raw_int = function(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible) {

    this.format = '<QiiiHHHHBB';
    this.id = mavlink.MAVLINK_MSG_ID_GPS_RAW_INT;
    this.order_map = [0, 8, 1, 2, 3, 4, 5, 6, 7, 9];
    this.crc_extra = 24;
    this.name = 'GPS_RAW_INT';

    this.fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'cog', 'satellites_visible'];


    this.set(arguments);

}
        
mavlink.messages.gps_raw_int.prototype = new mavlink.message;

mavlink.messages.gps_raw_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.lat, this.lon, this.alt, this.eph, this.epv, this.vel, this.cog, this.fix_type, this.satellites_visible]));
}

/* 
The positioning status, as reported by GPS. This message is intended
to display status information about each satellite visible to the
receiver. See message GLOBAL_POSITION for the global position
estimate. This message can contain information for up to 20
satellites.

                satellites_visible        : Number of satellites visible (uint8_t)
                satellite_prn             : Global satellite ID (uint8_t)
                satellite_used            : 0: Satellite not used, 1: used for localization (uint8_t)
                satellite_elevation        : Elevation (0: right on top of receiver, 90: on the horizon) of satellite (uint8_t)
                satellite_azimuth         : Direction of satellite, 0: 0 deg, 255: 360 deg. (uint8_t)
                satellite_snr             : Signal to noise ratio of satellite (uint8_t)

*/
mavlink.messages.gps_status = function(satellites_visible, satellite_prn, satellite_used, satellite_elevation, satellite_azimuth, satellite_snr) {

    this.format = '<B20s20s20s20s20s';
    this.id = mavlink.MAVLINK_MSG_ID_GPS_STATUS;
    this.order_map = [0, 1, 2, 3, 4, 5];
    this.crc_extra = 23;
    this.name = 'GPS_STATUS';

    this.fieldnames = ['satellites_visible', 'satellite_prn', 'satellite_used', 'satellite_elevation', 'satellite_azimuth', 'satellite_snr'];


    this.set(arguments);

}
        
mavlink.messages.gps_status.prototype = new mavlink.message;

mavlink.messages.gps_status.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.satellites_visible, this.satellite_prn, this.satellite_used, this.satellite_elevation, this.satellite_azimuth, this.satellite_snr]));
}

/* 
The RAW IMU readings for the usual 9DOF sensor setup. This message
should contain the scaled values to the described units

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                xacc                      : X acceleration (mg) (int16_t)
                yacc                      : Y acceleration (mg) (int16_t)
                zacc                      : Z acceleration (mg) (int16_t)
                xgyro                     : Angular speed around X axis (millirad /sec) (int16_t)
                ygyro                     : Angular speed around Y axis (millirad /sec) (int16_t)
                zgyro                     : Angular speed around Z axis (millirad /sec) (int16_t)
                xmag                      : X Magnetic field (milli tesla) (int16_t)
                ymag                      : Y Magnetic field (milli tesla) (int16_t)
                zmag                      : Z Magnetic field (milli tesla) (int16_t)

*/
mavlink.messages.scaled_imu = function(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag) {

    this.format = '<Ihhhhhhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_SCALED_IMU;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    this.crc_extra = 170;
    this.name = 'SCALED_IMU';

    this.fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag'];


    this.set(arguments);

}
        
mavlink.messages.scaled_imu.prototype = new mavlink.message;

mavlink.messages.scaled_imu.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag]));
}

/* 
The RAW IMU readings for the usual 9DOF sensor setup. This message
should always contain the true raw values without any scaling to allow
data capture and system debugging.

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                xacc                      : X acceleration (raw) (int16_t)
                yacc                      : Y acceleration (raw) (int16_t)
                zacc                      : Z acceleration (raw) (int16_t)
                xgyro                     : Angular speed around X axis (raw) (int16_t)
                ygyro                     : Angular speed around Y axis (raw) (int16_t)
                zgyro                     : Angular speed around Z axis (raw) (int16_t)
                xmag                      : X Magnetic field (raw) (int16_t)
                ymag                      : Y Magnetic field (raw) (int16_t)
                zmag                      : Z Magnetic field (raw) (int16_t)

*/
mavlink.messages.raw_imu = function(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag) {

    this.format = '<Qhhhhhhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_RAW_IMU;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    this.crc_extra = 144;
    this.name = 'RAW_IMU';

    this.fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag'];


    this.set(arguments);

}
        
mavlink.messages.raw_imu.prototype = new mavlink.message;

mavlink.messages.raw_imu.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag]));
}

/* 
The RAW pressure readings for the typical setup of one absolute
pressure and one differential pressure sensor. The sensor values
should be the raw, UNSCALED ADC values.

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                press_abs                 : Absolute pressure (raw) (int16_t)
                press_diff1               : Differential pressure 1 (raw) (int16_t)
                press_diff2               : Differential pressure 2 (raw) (int16_t)
                temperature               : Raw Temperature measurement (raw) (int16_t)

*/
mavlink.messages.raw_pressure = function(time_usec, press_abs, press_diff1, press_diff2, temperature) {

    this.format = '<Qhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_RAW_PRESSURE;
    this.order_map = [0, 1, 2, 3, 4];
    this.crc_extra = 67;
    this.name = 'RAW_PRESSURE';

    this.fieldnames = ['time_usec', 'press_abs', 'press_diff1', 'press_diff2', 'temperature'];


    this.set(arguments);

}
        
mavlink.messages.raw_pressure.prototype = new mavlink.message;

mavlink.messages.raw_pressure.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.press_abs, this.press_diff1, this.press_diff2, this.temperature]));
}

/* 
The pressure readings for the typical setup of one absolute and
differential pressure sensor. The units are as specified in each
field.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                press_abs                 : Absolute pressure (hectopascal) (float)
                press_diff                : Differential pressure 1 (hectopascal) (float)
                temperature               : Temperature measurement (0.01 degrees celsius) (int16_t)

*/
mavlink.messages.scaled_pressure = function(time_boot_ms, press_abs, press_diff, temperature) {

    this.format = '<Iffh';
    this.id = mavlink.MAVLINK_MSG_ID_SCALED_PRESSURE;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 115;
    this.name = 'SCALED_PRESSURE';

    this.fieldnames = ['time_boot_ms', 'press_abs', 'press_diff', 'temperature'];


    this.set(arguments);

}
        
mavlink.messages.scaled_pressure.prototype = new mavlink.message;

mavlink.messages.scaled_pressure.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.press_abs, this.press_diff, this.temperature]));
}

/* 
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right).

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                roll                      : Roll angle (rad, -pi..+pi) (float)
                pitch                     : Pitch angle (rad, -pi..+pi) (float)
                yaw                       : Yaw angle (rad, -pi..+pi) (float)
                rollspeed                 : Roll angular speed (rad/s) (float)
                pitchspeed                : Pitch angular speed (rad/s) (float)
                yawspeed                  : Yaw angular speed (rad/s) (float)

*/
mavlink.messages.attitude = function(time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed) {

    this.format = '<Iffffff';
    this.id = mavlink.MAVLINK_MSG_ID_ATTITUDE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 39;
    this.name = 'ATTITUDE';

    this.fieldnames = ['time_boot_ms', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed'];


    this.set(arguments);

}
        
mavlink.messages.attitude.prototype = new mavlink.message;

mavlink.messages.attitude.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.roll, this.pitch, this.yaw, this.rollspeed, this.pitchspeed, this.yawspeed]));
}

/* 
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is w, x, y, z and
a zero rotation would be expressed as (1 0 0 0).

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                q1                        : Quaternion component 1, w (1 in null-rotation) (float)
                q2                        : Quaternion component 2, x (0 in null-rotation) (float)
                q3                        : Quaternion component 3, y (0 in null-rotation) (float)
                q4                        : Quaternion component 4, z (0 in null-rotation) (float)
                rollspeed                 : Roll angular speed (rad/s) (float)
                pitchspeed                : Pitch angular speed (rad/s) (float)
                yawspeed                  : Yaw angular speed (rad/s) (float)

*/
mavlink.messages.attitude_quaternion = function(time_boot_ms, q1, q2, q3, q4, rollspeed, pitchspeed, yawspeed) {

    this.format = '<Ifffffff';
    this.id = mavlink.MAVLINK_MSG_ID_ATTITUDE_QUATERNION;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7];
    this.crc_extra = 246;
    this.name = 'ATTITUDE_QUATERNION';

    this.fieldnames = ['time_boot_ms', 'q1', 'q2', 'q3', 'q4', 'rollspeed', 'pitchspeed', 'yawspeed'];


    this.set(arguments);

}
        
mavlink.messages.attitude_quaternion.prototype = new mavlink.message;

mavlink.messages.attitude_quaternion.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.q1, this.q2, this.q3, this.q4, this.rollspeed, this.pitchspeed, this.yawspeed]));
}

/* 
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed, Z-axis down
(aeronautical frame, NED / north-east-down convention)

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                x                         : X Position (float)
                y                         : Y Position (float)
                z                         : Z Position (float)
                vx                        : X Speed (float)
                vy                        : Y Speed (float)
                vz                        : Z Speed (float)

*/
mavlink.messages.local_position_ned = function(time_boot_ms, x, y, z, vx, vy, vz) {

    this.format = '<Iffffff';
    this.id = mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 185;
    this.name = 'LOCAL_POSITION_NED';

    this.fieldnames = ['time_boot_ms', 'x', 'y', 'z', 'vx', 'vy', 'vz'];


    this.set(arguments);

}
        
mavlink.messages.local_position_ned.prototype = new mavlink.message;

mavlink.messages.local_position_ned.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.x, this.y, this.z, this.vx, this.vy, this.vz]));
}

/* 
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It                is
designed as scaled integer message since the resolution of float is
not sufficient.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                lat                       : Latitude, expressed as * 1E7 (int32_t)
                lon                       : Longitude, expressed as * 1E7 (int32_t)
                alt                       : Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well) (int32_t)
                relative_alt              : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
                vx                        : Ground X Speed (Latitude), expressed as m/s * 100 (int16_t)
                vy                        : Ground Y Speed (Longitude), expressed as m/s * 100 (int16_t)
                vz                        : Ground Z Speed (Altitude), expressed as m/s * 100 (int16_t)
                hdg                       : Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)

*/
mavlink.messages.global_position_int = function(time_boot_ms, lat, lon, alt, relative_alt, vx, vy, vz, hdg) {

    this.format = '<IiiiihhhH';
    this.id = mavlink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8];
    this.crc_extra = 104;
    this.name = 'GLOBAL_POSITION_INT';

    this.fieldnames = ['time_boot_ms', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'hdg'];


    this.set(arguments);

}
        
mavlink.messages.global_position_int.prototype = new mavlink.message;

mavlink.messages.global_position_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.lat, this.lon, this.alt, this.relative_alt, this.vx, this.vy, this.vz, this.hdg]));
}

/* 
The scaled values of the RC channels received. (-100%) -10000, (0%) 0,
(100%) 10000. Channels that are inactive should be set to UINT16_MAX.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                port                      : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
                chan1_scaled              : RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan2_scaled              : RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan3_scaled              : RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan4_scaled              : RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan5_scaled              : RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan6_scaled              : RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan7_scaled              : RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                chan8_scaled              : RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. (int16_t)
                rssi                      : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)

*/
mavlink.messages.rc_channels_scaled = function(time_boot_ms, port, chan1_scaled, chan2_scaled, chan3_scaled, chan4_scaled, chan5_scaled, chan6_scaled, chan7_scaled, chan8_scaled, rssi) {

    this.format = '<IhhhhhhhhBB';
    this.id = mavlink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED;
    this.order_map = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10];
    this.crc_extra = 237;
    this.name = 'RC_CHANNELS_SCALED';

    this.fieldnames = ['time_boot_ms', 'port', 'chan1_scaled', 'chan2_scaled', 'chan3_scaled', 'chan4_scaled', 'chan5_scaled', 'chan6_scaled', 'chan7_scaled', 'chan8_scaled', 'rssi'];


    this.set(arguments);

}
        
mavlink.messages.rc_channels_scaled.prototype = new mavlink.message;

mavlink.messages.rc_channels_scaled.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.chan1_scaled, this.chan2_scaled, this.chan3_scaled, this.chan4_scaled, this.chan5_scaled, this.chan6_scaled, this.chan7_scaled, this.chan8_scaled, this.port, this.rssi]));
}

/* 
The RAW values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000 microseconds:
100%. Individual receivers/transmitters might violate this
specification.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                port                      : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. (uint8_t)
                chan1_raw                 : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan2_raw                 : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan3_raw                 : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan4_raw                 : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan5_raw                 : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan6_raw                 : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan7_raw                 : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan8_raw                 : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                rssi                      : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)

*/
mavlink.messages.rc_channels_raw = function(time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi) {

    this.format = '<IHHHHHHHHBB';
    this.id = mavlink.MAVLINK_MSG_ID_RC_CHANNELS_RAW;
    this.order_map = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10];
    this.crc_extra = 244;
    this.name = 'RC_CHANNELS_RAW';

    this.fieldnames = ['time_boot_ms', 'port', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'rssi'];


    this.set(arguments);

}
        
mavlink.messages.rc_channels_raw.prototype = new mavlink.message;

mavlink.messages.rc_channels_raw.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.chan1_raw, this.chan2_raw, this.chan3_raw, this.chan4_raw, this.chan5_raw, this.chan6_raw, this.chan7_raw, this.chan8_raw, this.port, this.rssi]));
}

/* 
The RAW values of the servo outputs (for RC input from the remote, use
the RC_CHANNELS messages). The standard PPM modulation is as follows:
1000 microseconds: 0%, 2000 microseconds: 100%.

                time_usec                 : Timestamp (microseconds since system boot) (uint32_t)
                port                      : Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. (uint8_t)
                servo1_raw                : Servo output 1 value, in microseconds (uint16_t)
                servo2_raw                : Servo output 2 value, in microseconds (uint16_t)
                servo3_raw                : Servo output 3 value, in microseconds (uint16_t)
                servo4_raw                : Servo output 4 value, in microseconds (uint16_t)
                servo5_raw                : Servo output 5 value, in microseconds (uint16_t)
                servo6_raw                : Servo output 6 value, in microseconds (uint16_t)
                servo7_raw                : Servo output 7 value, in microseconds (uint16_t)
                servo8_raw                : Servo output 8 value, in microseconds (uint16_t)

*/
mavlink.messages.servo_output_raw = function(time_usec, port, servo1_raw, servo2_raw, servo3_raw, servo4_raw, servo5_raw, servo6_raw, servo7_raw, servo8_raw) {

    this.format = '<IHHHHHHHHB';
    this.id = mavlink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW;
    this.order_map = [0, 9, 1, 2, 3, 4, 5, 6, 7, 8];
    this.crc_extra = 222;
    this.name = 'SERVO_OUTPUT_RAW';

    this.fieldnames = ['time_usec', 'port', 'servo1_raw', 'servo2_raw', 'servo3_raw', 'servo4_raw', 'servo5_raw', 'servo6_raw', 'servo7_raw', 'servo8_raw'];


    this.set(arguments);

}
        
mavlink.messages.servo_output_raw.prototype = new mavlink.message;

mavlink.messages.servo_output_raw.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.servo1_raw, this.servo2_raw, this.servo3_raw, this.servo4_raw, this.servo5_raw, this.servo6_raw, this.servo7_raw, this.servo8_raw, this.port]));
}

/* 
Request a partial list of mission items from the system/component.
http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end
index are the same, just send one waypoint.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                start_index               : Start index, 0 by default (int16_t)
                end_index                 : End index, -1 by default (-1: send list to end). Else a valid index of the list (int16_t)

*/
mavlink.messages.mission_request_partial_list = function(target_system, target_component, start_index, end_index) {

    this.format = '<hhBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST;
    this.order_map = [2, 3, 0, 1];
    this.crc_extra = 212;
    this.name = 'MISSION_REQUEST_PARTIAL_LIST';

    this.fieldnames = ['target_system', 'target_component', 'start_index', 'end_index'];


    this.set(arguments);

}
        
mavlink.messages.mission_request_partial_list.prototype = new mavlink.message;

mavlink.messages.mission_request_partial_list.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.start_index, this.end_index, this.target_system, this.target_component]));
}

/* 
This message is sent to the MAV to write a partial list. If start
index == end index, only one item will be transmitted / updated. If
the start index is NOT 0 and above the current list size, this request
should be REJECTED!

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                start_index               : Start index, 0 by default and smaller / equal to the largest index of the current onboard list. (int16_t)
                end_index                 : End index, equal or greater than start index. (int16_t)

*/
mavlink.messages.mission_write_partial_list = function(target_system, target_component, start_index, end_index) {

    this.format = '<hhBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST;
    this.order_map = [2, 3, 0, 1];
    this.crc_extra = 9;
    this.name = 'MISSION_WRITE_PARTIAL_LIST';

    this.fieldnames = ['target_system', 'target_component', 'start_index', 'end_index'];


    this.set(arguments);

}
        
mavlink.messages.mission_write_partial_list.prototype = new mavlink.message;

mavlink.messages.mission_write_partial_list.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.start_index, this.end_index, this.target_system, this.target_component]));
}

/* 
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission item on the
system. The mission item can be either in x, y, z meters (type: LOCAL)
or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed
(NED), global frame is Z-up, right handed (ENU). See also
http://qgroundcontrol.org/mavlink/waypoint_protocol.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                seq                       : Sequence (uint16_t)
                frame                     : The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h (uint8_t)
                command                   : The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs (uint16_t)
                current                   : false:0, true:1 (uint8_t)
                autocontinue              : autocontinue to next wp (uint8_t)
                param1                    : PARAM1, see MAV_CMD enum (float)
                param2                    : PARAM2, see MAV_CMD enum (float)
                param3                    : PARAM3, see MAV_CMD enum (float)
                param4                    : PARAM4, see MAV_CMD enum (float)
                x                         : PARAM5 / local: x position, global: latitude (float)
                y                         : PARAM6 / y position: global: longitude (float)
                z                         : PARAM7 / z position: global: altitude (relative or absolute, depending on frame. (float)

*/
mavlink.messages.mission_item = function(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z) {

    this.format = '<fffffffHHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_ITEM;
    this.order_map = [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 254;
    this.name = 'MISSION_ITEM';

    this.fieldnames = ['target_system', 'target_component', 'seq', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.mission_item.prototype = new mavlink.message;

mavlink.messages.mission_item.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param1, this.param2, this.param3, this.param4, this.x, this.y, this.z, this.seq, this.command, this.target_system, this.target_component, this.frame, this.current, this.autocontinue]));
}

/* 
Request the information of the mission item with the sequence number
seq. The response of the system to this message should be a
MISSION_ITEM message.
http://qgroundcontrol.org/mavlink/waypoint_protocol

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                seq                       : Sequence (uint16_t)

*/
mavlink.messages.mission_request = function(target_system, target_component, seq) {

    this.format = '<HBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_REQUEST;
    this.order_map = [1, 2, 0];
    this.crc_extra = 230;
    this.name = 'MISSION_REQUEST';

    this.fieldnames = ['target_system', 'target_component', 'seq'];


    this.set(arguments);

}
        
mavlink.messages.mission_request.prototype = new mavlink.message;

mavlink.messages.mission_request.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seq, this.target_system, this.target_component]));
}

/* 
Set the mission item with sequence number seq as current item. This
means that the MAV will continue to this mission item on the shortest
path (not following the mission items in-between).

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                seq                       : Sequence (uint16_t)

*/
mavlink.messages.mission_set_current = function(target_system, target_component, seq) {

    this.format = '<HBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_SET_CURRENT;
    this.order_map = [1, 2, 0];
    this.crc_extra = 28;
    this.name = 'MISSION_SET_CURRENT';

    this.fieldnames = ['target_system', 'target_component', 'seq'];


    this.set(arguments);

}
        
mavlink.messages.mission_set_current.prototype = new mavlink.message;

mavlink.messages.mission_set_current.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seq, this.target_system, this.target_component]));
}

/* 
Message that announces the sequence number of the current active
mission item. The MAV will fly towards this mission item.

                seq                       : Sequence (uint16_t)

*/
mavlink.messages.mission_current = function(seq) {

    this.format = '<H';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_CURRENT;
    this.order_map = [0];
    this.crc_extra = 28;
    this.name = 'MISSION_CURRENT';

    this.fieldnames = ['seq'];


    this.set(arguments);

}
        
mavlink.messages.mission_current.prototype = new mavlink.message;

mavlink.messages.mission_current.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seq]));
}

/* 
Request the overall list of mission items from the system/component.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)

*/
mavlink.messages.mission_request_list = function(target_system, target_component) {

    this.format = '<BB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_REQUEST_LIST;
    this.order_map = [0, 1];
    this.crc_extra = 132;
    this.name = 'MISSION_REQUEST_LIST';

    this.fieldnames = ['target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.mission_request_list.prototype = new mavlink.message;

mavlink.messages.mission_request_list.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component]));
}

/* 
This message is emitted as response to MISSION_REQUEST_LIST by the MAV
and to initiate a write transaction. The GCS can then request the
individual mission item based on the knowledge of the total number of
MISSIONs.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                count                     : Number of mission items in the sequence (uint16_t)

*/
mavlink.messages.mission_count = function(target_system, target_component, count) {

    this.format = '<HBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_COUNT;
    this.order_map = [1, 2, 0];
    this.crc_extra = 221;
    this.name = 'MISSION_COUNT';

    this.fieldnames = ['target_system', 'target_component', 'count'];


    this.set(arguments);

}
        
mavlink.messages.mission_count.prototype = new mavlink.message;

mavlink.messages.mission_count.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.count, this.target_system, this.target_component]));
}

/* 
Delete all mission items at once.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)

*/
mavlink.messages.mission_clear_all = function(target_system, target_component) {

    this.format = '<BB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_CLEAR_ALL;
    this.order_map = [0, 1];
    this.crc_extra = 232;
    this.name = 'MISSION_CLEAR_ALL';

    this.fieldnames = ['target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.mission_clear_all.prototype = new mavlink.message;

mavlink.messages.mission_clear_all.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component]));
}

/* 
A certain mission item has been reached. The system will either hold
this position (or circle on the orbit) or (if the autocontinue on the
WP was set) continue to the next MISSION.

                seq                       : Sequence (uint16_t)

*/
mavlink.messages.mission_item_reached = function(seq) {

    this.format = '<H';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
    this.order_map = [0];
    this.crc_extra = 11;
    this.name = 'MISSION_ITEM_REACHED';

    this.fieldnames = ['seq'];


    this.set(arguments);

}
        
mavlink.messages.mission_item_reached.prototype = new mavlink.message;

mavlink.messages.mission_item_reached.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seq]));
}

/* 
Ack message during MISSION handling. The type field states if this
message is a positive ack (type=0) or if an error happened (type=non-
zero).

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                type                      : See MAV_MISSION_RESULT enum (uint8_t)

*/
mavlink.messages.mission_ack = function(target_system, target_component, type) {

    this.format = '<BBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_ACK;
    this.order_map = [0, 1, 2];
    this.crc_extra = 153;
    this.name = 'MISSION_ACK';

    this.fieldnames = ['target_system', 'target_component', 'type'];


    this.set(arguments);

}
        
mavlink.messages.mission_ack.prototype = new mavlink.message;

mavlink.messages.mission_ack.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component, this.type]));
}

/* 
As local waypoints exist, the global MISSION reference allows to
transform between the local coordinate frame and the global (GPS)
coordinate frame. This can be necessary when e.g. in- and outdoor
settings are connected and the MAV should move from in- to outdoor.

                target_system             : System ID (uint8_t)
                latitude                  : Latitude (WGS84), in degrees * 1E7 (int32_t)
                longitude                 : Longitude (WGS84, in degrees * 1E7 (int32_t)
                altitude                  : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)

*/
mavlink.messages.set_gps_global_origin = function(target_system, latitude, longitude, altitude) {

    this.format = '<iiiB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
    this.order_map = [3, 0, 1, 2];
    this.crc_extra = 41;
    this.name = 'SET_GPS_GLOBAL_ORIGIN';

    this.fieldnames = ['target_system', 'latitude', 'longitude', 'altitude'];


    this.set(arguments);

}
        
mavlink.messages.set_gps_global_origin.prototype = new mavlink.message;

mavlink.messages.set_gps_global_origin.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.latitude, this.longitude, this.altitude, this.target_system]));
}

/* 
Once the MAV sets a new GPS-Local correspondence, this message
announces the origin (0,0,0) position

                latitude                  : Latitude (WGS84), in degrees * 1E7 (int32_t)
                longitude                 : Longitude (WGS84), in degrees * 1E7 (int32_t)
                altitude                  : Altitude (AMSL), in meters * 1000 (positive for up) (int32_t)

*/
mavlink.messages.gps_global_origin = function(latitude, longitude, altitude) {

    this.format = '<iii';
    this.id = mavlink.MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN;
    this.order_map = [0, 1, 2];
    this.crc_extra = 39;
    this.name = 'GPS_GLOBAL_ORIGIN';

    this.fieldnames = ['latitude', 'longitude', 'altitude'];


    this.set(arguments);

}
        
mavlink.messages.gps_global_origin.prototype = new mavlink.message;

mavlink.messages.gps_global_origin.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.latitude, this.longitude, this.altitude]));
}

/* 
Bind a RC channel to a parameter. The parameter should change accoding
to the RC channel value.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                param_id                  : Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string (char)
                param_index               : Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. (int16_t)
                parameter_rc_channel_index        : Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC. (uint8_t)
                param_value0              : Initial parameter value (float)
                scale                     : Scale, maps the RC range [-1, 1] to a parameter value (float)
                param_value_min           : Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) (float)
                param_value_max           : Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) (float)

*/
mavlink.messages.param_map_rc = function(target_system, target_component, param_id, param_index, parameter_rc_channel_index, param_value0, scale, param_value_min, param_value_max) {

    this.format = '<ffffhBB16sB';
    this.id = mavlink.MAVLINK_MSG_ID_PARAM_MAP_RC;
    this.order_map = [5, 6, 7, 4, 8, 0, 1, 2, 3];
    this.crc_extra = 78;
    this.name = 'PARAM_MAP_RC';

    this.fieldnames = ['target_system', 'target_component', 'param_id', 'param_index', 'parameter_rc_channel_index', 'param_value0', 'scale', 'param_value_min', 'param_value_max'];


    this.set(arguments);

}
        
mavlink.messages.param_map_rc.prototype = new mavlink.message;

mavlink.messages.param_map_rc.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param_value0, this.scale, this.param_value_min, this.param_value_max, this.param_index, this.target_system, this.target_component, this.param_id, this.parameter_rc_channel_index]));
}

/* 
Set a safety zone (volume), which is defined by two corners of a cube.
This message can be used to tell the MAV which setpoints/MISSIONs to
accept and which to reject. Safety areas are often enforced by
national or competition regulations.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                frame                     : Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
                p1x                       : x position 1 / Latitude 1 (float)
                p1y                       : y position 1 / Longitude 1 (float)
                p1z                       : z position 1 / Altitude 1 (float)
                p2x                       : x position 2 / Latitude 2 (float)
                p2y                       : y position 2 / Longitude 2 (float)
                p2z                       : z position 2 / Altitude 2 (float)

*/
mavlink.messages.safety_set_allowed_area = function(target_system, target_component, frame, p1x, p1y, p1z, p2x, p2y, p2z) {

    this.format = '<ffffffBBB';
    this.id = mavlink.MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
    this.order_map = [6, 7, 8, 0, 1, 2, 3, 4, 5];
    this.crc_extra = 15;
    this.name = 'SAFETY_SET_ALLOWED_AREA';

    this.fieldnames = ['target_system', 'target_component', 'frame', 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z'];


    this.set(arguments);

}
        
mavlink.messages.safety_set_allowed_area.prototype = new mavlink.message;

mavlink.messages.safety_set_allowed_area.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.p1x, this.p1y, this.p1z, this.p2x, this.p2y, this.p2z, this.target_system, this.target_component, this.frame]));
}

/* 
Read out the safety zone the MAV currently assumes.

                frame                     : Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. (uint8_t)
                p1x                       : x position 1 / Latitude 1 (float)
                p1y                       : y position 1 / Longitude 1 (float)
                p1z                       : z position 1 / Altitude 1 (float)
                p2x                       : x position 2 / Latitude 2 (float)
                p2y                       : y position 2 / Longitude 2 (float)
                p2z                       : z position 2 / Altitude 2 (float)

*/
mavlink.messages.safety_allowed_area = function(frame, p1x, p1y, p1z, p2x, p2y, p2z) {

    this.format = '<ffffffB';
    this.id = mavlink.MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA;
    this.order_map = [6, 0, 1, 2, 3, 4, 5];
    this.crc_extra = 3;
    this.name = 'SAFETY_ALLOWED_AREA';

    this.fieldnames = ['frame', 'p1x', 'p1y', 'p1z', 'p2x', 'p2y', 'p2z'];


    this.set(arguments);

}
        
mavlink.messages.safety_allowed_area.prototype = new mavlink.message;

mavlink.messages.safety_allowed_area.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.p1x, this.p1y, this.p1z, this.p2x, this.p2y, this.p2z, this.frame]));
}

/* 
The attitude in the aeronautical frame (right-handed, Z-down, X-front,
Y-right), expressed as quaternion. Quaternion order is w, x, y, z and
a zero rotation would be expressed as (1 0 0 0).

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                q                         : Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) (float)
                rollspeed                 : Roll angular speed (rad/s) (float)
                pitchspeed                : Pitch angular speed (rad/s) (float)
                yawspeed                  : Yaw angular speed (rad/s) (float)
                covariance                : Attitude covariance (float)

*/
mavlink.messages.attitude_quaternion_cov = function(time_boot_ms, q, rollspeed, pitchspeed, yawspeed, covariance) {

    this.format = '<I4ffff9f';
    this.id = mavlink.MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV;
    this.order_map = [0, 1, 2, 3, 4, 5];
    this.crc_extra = 153;
    this.name = 'ATTITUDE_QUATERNION_COV';

    this.fieldnames = ['time_boot_ms', 'q', 'rollspeed', 'pitchspeed', 'yawspeed', 'covariance'];


    this.set(arguments);

}
        
mavlink.messages.attitude_quaternion_cov.prototype = new mavlink.message;

mavlink.messages.attitude_quaternion_cov.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.q, this.rollspeed, this.pitchspeed, this.yawspeed, this.covariance]));
}

/* 
Outputs of the APM navigation controller. The primary use of this
message is to check the response and signs of the controller before
actual flight and to assist with tuning controller parameters.

                nav_roll                  : Current desired roll in degrees (float)
                nav_pitch                 : Current desired pitch in degrees (float)
                nav_bearing               : Current desired heading in degrees (int16_t)
                target_bearing            : Bearing to current MISSION/target in degrees (int16_t)
                wp_dist                   : Distance to active MISSION in meters (uint16_t)
                alt_error                 : Current altitude error in meters (float)
                aspd_error                : Current airspeed error in meters/second (float)
                xtrack_error              : Current crosstrack error on x-y plane in meters (float)

*/
mavlink.messages.nav_controller_output = function(nav_roll, nav_pitch, nav_bearing, target_bearing, wp_dist, alt_error, aspd_error, xtrack_error) {

    this.format = '<fffffhhH';
    this.id = mavlink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
    this.order_map = [0, 1, 5, 6, 7, 2, 3, 4];
    this.crc_extra = 183;
    this.name = 'NAV_CONTROLLER_OUTPUT';

    this.fieldnames = ['nav_roll', 'nav_pitch', 'nav_bearing', 'target_bearing', 'wp_dist', 'alt_error', 'aspd_error', 'xtrack_error'];


    this.set(arguments);

}
        
mavlink.messages.nav_controller_output.prototype = new mavlink.message;

mavlink.messages.nav_controller_output.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.nav_roll, this.nav_pitch, this.alt_error, this.aspd_error, this.xtrack_error, this.nav_bearing, this.target_bearing, this.wp_dist]));
}

/* 
The filtered global position (e.g. fused GPS and accelerometers). The
position is in GPS-frame (right-handed, Z-up). It  is designed as
scaled integer message since the resolution of float is not
sufficient. NOTE: This message is intended for onboard networks /
companion computers and higher-bandwidth links and optimized for
accuracy and completeness. Please use the GLOBAL_POSITION_INT message
for a minimal subset.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                time_utc                  : Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver. (uint64_t)
                estimator_type            : Class id of the estimator this estimate originated from. (uint8_t)
                lat                       : Latitude, expressed as degrees * 1E7 (int32_t)
                lon                       : Longitude, expressed as degrees * 1E7 (int32_t)
                alt                       : Altitude in meters, expressed as * 1000 (millimeters), above MSL (int32_t)
                relative_alt              : Altitude above ground in meters, expressed as * 1000 (millimeters) (int32_t)
                vx                        : Ground X Speed (Latitude), expressed as m/s (float)
                vy                        : Ground Y Speed (Longitude), expressed as m/s (float)
                vz                        : Ground Z Speed (Altitude), expressed as m/s (float)
                covariance                : Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) (float)

*/
mavlink.messages.global_position_int_cov = function(time_boot_ms, time_utc, estimator_type, lat, lon, alt, relative_alt, vx, vy, vz, covariance) {

    this.format = '<QIiiiifff36fB';
    this.id = mavlink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV;
    this.order_map = [1, 0, 10, 2, 3, 4, 5, 6, 7, 8, 9];
    this.crc_extra = 51;
    this.name = 'GLOBAL_POSITION_INT_COV';

    this.fieldnames = ['time_boot_ms', 'time_utc', 'estimator_type', 'lat', 'lon', 'alt', 'relative_alt', 'vx', 'vy', 'vz', 'covariance'];


    this.set(arguments);

}
        
mavlink.messages.global_position_int_cov.prototype = new mavlink.message;

mavlink.messages.global_position_int_cov.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_utc, this.time_boot_ms, this.lat, this.lon, this.alt, this.relative_alt, this.vx, this.vy, this.vz, this.covariance, this.estimator_type]));
}

/* 
The filtered local position (e.g. fused computer vision and
accelerometers). Coordinate frame is right-handed, Z-axis down
(aeronautical frame, NED / north-east-down convention)

                time_boot_ms              : Timestamp (milliseconds since system boot). 0 for system without monotonic timestamp (uint32_t)
                time_utc                  : Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. Commonly filled by the precision time source of a GPS receiver. (uint64_t)
                estimator_type            : Class id of the estimator this estimate originated from. (uint8_t)
                x                         : X Position (float)
                y                         : Y Position (float)
                z                         : Z Position (float)
                vx                        : X Speed (m/s) (float)
                vy                        : Y Speed (m/s) (float)
                vz                        : Z Speed (m/s) (float)
                ax                        : X Acceleration (m/s^2) (float)
                ay                        : Y Acceleration (m/s^2) (float)
                az                        : Z Acceleration (m/s^2) (float)
                covariance                : Covariance matrix upper right triangular (first nine entries are the first ROW, next eight entries are the second row, etc.) (float)

*/
mavlink.messages.local_position_ned_cov = function(time_boot_ms, time_utc, estimator_type, x, y, z, vx, vy, vz, ax, ay, az, covariance) {

    this.format = '<QIfffffffff45fB';
    this.id = mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV;
    this.order_map = [1, 0, 12, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 59;
    this.name = 'LOCAL_POSITION_NED_COV';

    this.fieldnames = ['time_boot_ms', 'time_utc', 'estimator_type', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'ax', 'ay', 'az', 'covariance'];


    this.set(arguments);

}
        
mavlink.messages.local_position_ned_cov.prototype = new mavlink.message;

mavlink.messages.local_position_ned_cov.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_utc, this.time_boot_ms, this.x, this.y, this.z, this.vx, this.vy, this.vz, this.ax, this.ay, this.az, this.covariance, this.estimator_type]));
}

/* 
The PPM values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000 microseconds:
100%. Individual receivers/transmitters might violate this
specification.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                chancount                 : Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. (uint8_t)
                chan1_raw                 : RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan2_raw                 : RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan3_raw                 : RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan4_raw                 : RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan5_raw                 : RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan6_raw                 : RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan7_raw                 : RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan8_raw                 : RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan9_raw                 : RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan10_raw                : RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan11_raw                : RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan12_raw                : RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan13_raw                : RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan14_raw                : RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan15_raw                : RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan16_raw                : RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan17_raw                : RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                chan18_raw                : RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused. (uint16_t)
                rssi                      : Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. (uint8_t)

*/
mavlink.messages.rc_channels = function(time_boot_ms, chancount, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, chan13_raw, chan14_raw, chan15_raw, chan16_raw, chan17_raw, chan18_raw, rssi) {

    this.format = '<IHHHHHHHHHHHHHHHHHHBB';
    this.id = mavlink.MAVLINK_MSG_ID_RC_CHANNELS;
    this.order_map = [0, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20];
    this.crc_extra = 118;
    this.name = 'RC_CHANNELS';

    this.fieldnames = ['time_boot_ms', 'chancount', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'chan13_raw', 'chan14_raw', 'chan15_raw', 'chan16_raw', 'chan17_raw', 'chan18_raw', 'rssi'];


    this.set(arguments);

}
        
mavlink.messages.rc_channels.prototype = new mavlink.message;

mavlink.messages.rc_channels.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.chan1_raw, this.chan2_raw, this.chan3_raw, this.chan4_raw, this.chan5_raw, this.chan6_raw, this.chan7_raw, this.chan8_raw, this.chan9_raw, this.chan10_raw, this.chan11_raw, this.chan12_raw, this.chan13_raw, this.chan14_raw, this.chan15_raw, this.chan16_raw, this.chan17_raw, this.chan18_raw, this.chancount, this.rssi]));
}

/* 


                target_system             : The target requested to send the message stream. (uint8_t)
                target_component          : The target requested to send the message stream. (uint8_t)
                req_stream_id             : The ID of the requested data stream (uint8_t)
                req_message_rate          : The requested interval between two messages of this type (uint16_t)
                start_stop                : 1 to start sending, 0 to stop sending. (uint8_t)

*/
mavlink.messages.request_data_stream = function(target_system, target_component, req_stream_id, req_message_rate, start_stop) {

    this.format = '<HBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_REQUEST_DATA_STREAM;
    this.order_map = [1, 2, 3, 0, 4];
    this.crc_extra = 148;
    this.name = 'REQUEST_DATA_STREAM';

    this.fieldnames = ['target_system', 'target_component', 'req_stream_id', 'req_message_rate', 'start_stop'];


    this.set(arguments);

}
        
mavlink.messages.request_data_stream.prototype = new mavlink.message;

mavlink.messages.request_data_stream.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.req_message_rate, this.target_system, this.target_component, this.req_stream_id, this.start_stop]));
}

/* 


                stream_id                 : The ID of the requested data stream (uint8_t)
                message_rate              : The requested interval between two messages of this type (uint16_t)
                on_off                    : 1 stream is enabled, 0 stream is stopped. (uint8_t)

*/
mavlink.messages.data_stream = function(stream_id, message_rate, on_off) {

    this.format = '<HBB';
    this.id = mavlink.MAVLINK_MSG_ID_DATA_STREAM;
    this.order_map = [1, 0, 2];
    this.crc_extra = 21;
    this.name = 'DATA_STREAM';

    this.fieldnames = ['stream_id', 'message_rate', 'on_off'];


    this.set(arguments);

}
        
mavlink.messages.data_stream.prototype = new mavlink.message;

mavlink.messages.data_stream.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.message_rate, this.stream_id, this.on_off]));
}

/* 
This message provides an API for manually controlling the vehicle
using standard joystick axes nomenclature, along with a joystick-like
input device. Unused axes can be disabled an buttons are also transmit
as boolean values of their

                target                    : The system to be controlled. (uint8_t)
                x                         : X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. (int16_t)
                y                         : Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. (int16_t)
                z                         : Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. (int16_t)
                r                         : R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. (int16_t)
                buttons                   : A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. (uint16_t)

*/
mavlink.messages.manual_control = function(target, x, y, z, r, buttons) {

    this.format = '<hhhhHB';
    this.id = mavlink.MAVLINK_MSG_ID_MANUAL_CONTROL;
    this.order_map = [5, 0, 1, 2, 3, 4];
    this.crc_extra = 243;
    this.name = 'MANUAL_CONTROL';

    this.fieldnames = ['target', 'x', 'y', 'z', 'r', 'buttons'];


    this.set(arguments);

}
        
mavlink.messages.manual_control.prototype = new mavlink.message;

mavlink.messages.manual_control.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.x, this.y, this.z, this.r, this.buttons, this.target]));
}

/* 
The RAW values of the RC channels sent to the MAV to override info
received from the RC radio. A value of UINT16_MAX means no change to
that channel. A value of 0 means control of that channel should be
released back to the RC radio. The standard PPM modulation is as
follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual
receivers/transmitters might violate this specification.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                chan1_raw                 : RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan2_raw                 : RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan3_raw                 : RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan4_raw                 : RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan5_raw                 : RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan6_raw                 : RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan7_raw                 : RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)
                chan8_raw                 : RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. (uint16_t)

*/
mavlink.messages.rc_channels_override = function(target_system, target_component, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw) {

    this.format = '<HHHHHHHHBB';
    this.id = mavlink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE;
    this.order_map = [8, 9, 0, 1, 2, 3, 4, 5, 6, 7];
    this.crc_extra = 124;
    this.name = 'RC_CHANNELS_OVERRIDE';

    this.fieldnames = ['target_system', 'target_component', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw'];


    this.set(arguments);

}
        
mavlink.messages.rc_channels_override.prototype = new mavlink.message;

mavlink.messages.rc_channels_override.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.chan1_raw, this.chan2_raw, this.chan3_raw, this.chan4_raw, this.chan5_raw, this.chan6_raw, this.chan7_raw, this.chan8_raw, this.target_system, this.target_component]));
}

/* 
Message encoding a mission item. This message is emitted to announce
the presence of a mission item and to set a mission item on the
system. The mission item can be either in x, y, z meters (type: LOCAL)
or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed
(NED), global frame is Z-up, right handed (ENU). See
alsohttp://qgroundcontrol.org/mavlink/waypoint_protocol.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                seq                       : Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). (uint16_t)
                frame                     : The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h (uint8_t)
                command                   : The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs (uint16_t)
                current                   : false:0, true:1 (uint8_t)
                autocontinue              : autocontinue to next wp (uint8_t)
                param1                    : PARAM1, see MAV_CMD enum (float)
                param2                    : PARAM2, see MAV_CMD enum (float)
                param3                    : PARAM3, see MAV_CMD enum (float)
                param4                    : PARAM4, see MAV_CMD enum (float)
                x                         : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
                y                         : PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 (int32_t)
                z                         : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)

*/
mavlink.messages.mission_item_int = function(target_system, target_component, seq, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z) {

    this.format = '<ffffiifHHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_MISSION_ITEM_INT;
    this.order_map = [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 38;
    this.name = 'MISSION_ITEM_INT';

    this.fieldnames = ['target_system', 'target_component', 'seq', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.mission_item_int.prototype = new mavlink.message;

mavlink.messages.mission_item_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param1, this.param2, this.param3, this.param4, this.x, this.y, this.z, this.seq, this.command, this.target_system, this.target_component, this.frame, this.current, this.autocontinue]));
}

/* 
Metrics typically displayed on a HUD for fixed wing aircraft

                airspeed                  : Current airspeed in m/s (float)
                groundspeed               : Current ground speed in m/s (float)
                heading                   : Current heading in degrees, in compass units (0..360, 0=north) (int16_t)
                throttle                  : Current throttle setting in integer percent, 0 to 100 (uint16_t)
                alt                       : Current altitude (MSL), in meters (float)
                climb                     : Current climb rate in meters/second (float)

*/
mavlink.messages.vfr_hud = function(airspeed, groundspeed, heading, throttle, alt, climb) {

    this.format = '<ffffhH';
    this.id = mavlink.MAVLINK_MSG_ID_VFR_HUD;
    this.order_map = [0, 1, 4, 5, 2, 3];
    this.crc_extra = 20;
    this.name = 'VFR_HUD';

    this.fieldnames = ['airspeed', 'groundspeed', 'heading', 'throttle', 'alt', 'climb'];


    this.set(arguments);

}
        
mavlink.messages.vfr_hud.prototype = new mavlink.message;

mavlink.messages.vfr_hud.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.airspeed, this.groundspeed, this.alt, this.climb, this.heading, this.throttle]));
}

/* 
Message encoding a command with parameters as scaled integers. Scaling
depends on the actual command value.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                frame                     : The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h (uint8_t)
                command                   : The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs (uint16_t)
                current                   : false:0, true:1 (uint8_t)
                autocontinue              : autocontinue to next wp (uint8_t)
                param1                    : PARAM1, see MAV_CMD enum (float)
                param2                    : PARAM2, see MAV_CMD enum (float)
                param3                    : PARAM3, see MAV_CMD enum (float)
                param4                    : PARAM4, see MAV_CMD enum (float)
                x                         : PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 (int32_t)
                y                         : PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 (int32_t)
                z                         : PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. (float)

*/
mavlink.messages.command_int = function(target_system, target_component, frame, command, current, autocontinue, param1, param2, param3, param4, x, y, z) {

    this.format = '<ffffiifHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_COMMAND_INT;
    this.order_map = [8, 9, 10, 7, 11, 12, 0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 158;
    this.name = 'COMMAND_INT';

    this.fieldnames = ['target_system', 'target_component', 'frame', 'command', 'current', 'autocontinue', 'param1', 'param2', 'param3', 'param4', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.command_int.prototype = new mavlink.message;

mavlink.messages.command_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param1, this.param2, this.param3, this.param4, this.x, this.y, this.z, this.command, this.target_system, this.target_component, this.frame, this.current, this.autocontinue]));
}

/* 
Send a command with up to seven parameters to the MAV

                target_system             : System which should execute the command (uint8_t)
                target_component          : Component which should execute the command, 0 for all components (uint8_t)
                command                   : Command ID, as defined by MAV_CMD enum. (uint16_t)
                confirmation              : 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) (uint8_t)
                param1                    : Parameter 1, as defined by MAV_CMD enum. (float)
                param2                    : Parameter 2, as defined by MAV_CMD enum. (float)
                param3                    : Parameter 3, as defined by MAV_CMD enum. (float)
                param4                    : Parameter 4, as defined by MAV_CMD enum. (float)
                param5                    : Parameter 5, as defined by MAV_CMD enum. (float)
                param6                    : Parameter 6, as defined by MAV_CMD enum. (float)
                param7                    : Parameter 7, as defined by MAV_CMD enum. (float)

*/
mavlink.messages.command_long = function(target_system, target_component, command, confirmation, param1, param2, param3, param4, param5, param6, param7) {

    this.format = '<fffffffHBBB';
    this.id = mavlink.MAVLINK_MSG_ID_COMMAND_LONG;
    this.order_map = [8, 9, 7, 10, 0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 152;
    this.name = 'COMMAND_LONG';

    this.fieldnames = ['target_system', 'target_component', 'command', 'confirmation', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7'];


    this.set(arguments);

}
        
mavlink.messages.command_long.prototype = new mavlink.message;

mavlink.messages.command_long.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.param1, this.param2, this.param3, this.param4, this.param5, this.param6, this.param7, this.command, this.target_system, this.target_component, this.confirmation]));
}

/* 
Report status of a command. Includes feedback wether the command was
executed.

                command                   : Command ID, as defined by MAV_CMD enum. (uint16_t)
                result                    : See MAV_RESULT enum (uint8_t)

*/
mavlink.messages.command_ack = function(command, result) {

    this.format = '<HB';
    this.id = mavlink.MAVLINK_MSG_ID_COMMAND_ACK;
    this.order_map = [0, 1];
    this.crc_extra = 143;
    this.name = 'COMMAND_ACK';

    this.fieldnames = ['command', 'result'];


    this.set(arguments);

}
        
mavlink.messages.command_ack.prototype = new mavlink.message;

mavlink.messages.command_ack.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.command, this.result]));
}

/* 
Setpoint in roll, pitch, yaw and thrust from the operator

                time_boot_ms              : Timestamp in milliseconds since system boot (uint32_t)
                roll                      : Desired roll rate in radians per second (float)
                pitch                     : Desired pitch rate in radians per second (float)
                yaw                       : Desired yaw rate in radians per second (float)
                thrust                    : Collective thrust, normalized to 0 .. 1 (float)
                mode_switch               : Flight mode switch position, 0.. 255 (uint8_t)
                manual_override_switch        : Override mode switch position, 0.. 255 (uint8_t)

*/
mavlink.messages.manual_setpoint = function(time_boot_ms, roll, pitch, yaw, thrust, mode_switch, manual_override_switch) {

    this.format = '<IffffBB';
    this.id = mavlink.MAVLINK_MSG_ID_MANUAL_SETPOINT;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 106;
    this.name = 'MANUAL_SETPOINT';

    this.fieldnames = ['time_boot_ms', 'roll', 'pitch', 'yaw', 'thrust', 'mode_switch', 'manual_override_switch'];


    this.set(arguments);

}
        
mavlink.messages.manual_setpoint.prototype = new mavlink.message;

mavlink.messages.manual_setpoint.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.roll, this.pitch, this.yaw, this.thrust, this.mode_switch, this.manual_override_switch]));
}

/* 
Set the vehicle attitude and body angular rates.

                time_boot_ms              : Timestamp in milliseconds since system boot (uint32_t)
                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                type_mask                 : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude (uint8_t)
                q                         : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
                body_roll_rate            : Body roll rate in radians per second (float)
                body_pitch_rate           : Body roll rate in radians per second (float)
                body_yaw_rate             : Body roll rate in radians per second (float)
                thrust                    : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)

*/
mavlink.messages.set_attitude_target = function(time_boot_ms, target_system, target_component, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust) {

    this.format = '<I4fffffBBB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_ATTITUDE_TARGET;
    this.order_map = [0, 6, 7, 8, 1, 2, 3, 4, 5];
    this.crc_extra = 49;
    this.name = 'SET_ATTITUDE_TARGET';

    this.fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'type_mask', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust'];


    this.set(arguments);

}
        
mavlink.messages.set_attitude_target.prototype = new mavlink.message;

mavlink.messages.set_attitude_target.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.q, this.body_roll_rate, this.body_pitch_rate, this.body_yaw_rate, this.thrust, this.target_system, this.target_component, this.type_mask]));
}

/* 
Set the vehicle attitude and body angular rates.

                time_boot_ms              : Timestamp in milliseconds since system boot (uint32_t)
                type_mask                 : Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude (uint8_t)
                q                         : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
                body_roll_rate            : Body roll rate in radians per second (float)
                body_pitch_rate           : Body roll rate in radians per second (float)
                body_yaw_rate             : Body roll rate in radians per second (float)
                thrust                    : Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) (float)

*/
mavlink.messages.attitude_target = function(time_boot_ms, type_mask, q, body_roll_rate, body_pitch_rate, body_yaw_rate, thrust) {

    this.format = '<I4fffffB';
    this.id = mavlink.MAVLINK_MSG_ID_ATTITUDE_TARGET;
    this.order_map = [0, 6, 1, 2, 3, 4, 5];
    this.crc_extra = 22;
    this.name = 'ATTITUDE_TARGET';

    this.fieldnames = ['time_boot_ms', 'type_mask', 'q', 'body_roll_rate', 'body_pitch_rate', 'body_yaw_rate', 'thrust'];


    this.set(arguments);

}
        
mavlink.messages.attitude_target.prototype = new mavlink.message;

mavlink.messages.attitude_target.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.q, this.body_roll_rate, this.body_pitch_rate, this.body_yaw_rate, this.thrust, this.type_mask]));
}

/* 
Set vehicle position, velocity and acceleration setpoint in local
frame.

                time_boot_ms              : Timestamp in milliseconds since system boot (uint32_t)
                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                coordinate_frame          : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
                type_mask                 : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
                x                         : X Position in NED frame in meters (float)
                y                         : Y Position in NED frame in meters (float)
                z                         : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
                vx                        : X velocity in NED frame in meter / s (float)
                vy                        : Y velocity in NED frame in meter / s (float)
                vz                        : Z velocity in NED frame in meter / s (float)
                afx                       : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afy                       : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afz                       : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                yaw                       : yaw setpoint in rad (float)
                yaw_rate                  : yaw rate setpoint in rad/s (float)

*/
mavlink.messages.set_position_target_local_ned = function(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate) {

    this.format = '<IfffffffffffHBBB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED;
    this.order_map = [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 143;
    this.name = 'SET_POSITION_TARGET_LOCAL_NED';

    this.fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'coordinate_frame', 'type_mask', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate'];


    this.set(arguments);

}
        
mavlink.messages.set_position_target_local_ned.prototype = new mavlink.message;

mavlink.messages.set_position_target_local_ned.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.x, this.y, this.z, this.vx, this.vy, this.vz, this.afx, this.afy, this.afz, this.yaw, this.yaw_rate, this.type_mask, this.target_system, this.target_component, this.coordinate_frame]));
}

/* 
Set vehicle position, velocity and acceleration setpoint in local
frame.

                time_boot_ms              : Timestamp in milliseconds since system boot (uint32_t)
                coordinate_frame          : Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 (uint8_t)
                type_mask                 : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
                x                         : X Position in NED frame in meters (float)
                y                         : Y Position in NED frame in meters (float)
                z                         : Z Position in NED frame in meters (note, altitude is negative in NED) (float)
                vx                        : X velocity in NED frame in meter / s (float)
                vy                        : Y velocity in NED frame in meter / s (float)
                vz                        : Z velocity in NED frame in meter / s (float)
                afx                       : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afy                       : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afz                       : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                yaw                       : yaw setpoint in rad (float)
                yaw_rate                  : yaw rate setpoint in rad/s (float)

*/
mavlink.messages.position_target_local_ned = function(time_boot_ms, coordinate_frame, type_mask, x, y, z, vx, vy, vz, afx, afy, afz, yaw, yaw_rate) {

    this.format = '<IfffffffffffHB';
    this.id = mavlink.MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
    this.order_map = [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 140;
    this.name = 'POSITION_TARGET_LOCAL_NED';

    this.fieldnames = ['time_boot_ms', 'coordinate_frame', 'type_mask', 'x', 'y', 'z', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate'];


    this.set(arguments);

}
        
mavlink.messages.position_target_local_ned.prototype = new mavlink.message;

mavlink.messages.position_target_local_ned.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.x, this.y, this.z, this.vx, this.vy, this.vz, this.afx, this.afy, this.afz, this.yaw, this.yaw_rate, this.type_mask, this.coordinate_frame]));
}

/* 
Set vehicle position, velocity and acceleration setpoint in the WGS84
coordinate system.

                time_boot_ms              : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                coordinate_frame          : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
                type_mask                 : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
                lat_int                   : X Position in WGS84 frame in 1e7 * meters (int32_t)
                lon_int                   : Y Position in WGS84 frame in 1e7 * meters (int32_t)
                alt                       : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
                vx                        : X velocity in NED frame in meter / s (float)
                vy                        : Y velocity in NED frame in meter / s (float)
                vz                        : Z velocity in NED frame in meter / s (float)
                afx                       : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afy                       : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afz                       : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                yaw                       : yaw setpoint in rad (float)
                yaw_rate                  : yaw rate setpoint in rad/s (float)

*/
mavlink.messages.set_position_target_global_int = function(time_boot_ms, target_system, target_component, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate) {

    this.format = '<IiifffffffffHBBB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT;
    this.order_map = [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 5;
    this.name = 'SET_POSITION_TARGET_GLOBAL_INT';

    this.fieldnames = ['time_boot_ms', 'target_system', 'target_component', 'coordinate_frame', 'type_mask', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate'];


    this.set(arguments);

}
        
mavlink.messages.set_position_target_global_int.prototype = new mavlink.message;

mavlink.messages.set_position_target_global_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.lat_int, this.lon_int, this.alt, this.vx, this.vy, this.vz, this.afx, this.afy, this.afz, this.yaw, this.yaw_rate, this.type_mask, this.target_system, this.target_component, this.coordinate_frame]));
}

/* 
Set vehicle position, velocity and acceleration setpoint in the WGS84
coordinate system.

                time_boot_ms              : Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. (uint32_t)
                coordinate_frame          : Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 (uint8_t)
                type_mask                 : Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate (uint16_t)
                lat_int                   : X Position in WGS84 frame in 1e7 * meters (int32_t)
                lon_int                   : Y Position in WGS84 frame in 1e7 * meters (int32_t)
                alt                       : Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT (float)
                vx                        : X velocity in NED frame in meter / s (float)
                vy                        : Y velocity in NED frame in meter / s (float)
                vz                        : Z velocity in NED frame in meter / s (float)
                afx                       : X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afy                       : Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                afz                       : Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N (float)
                yaw                       : yaw setpoint in rad (float)
                yaw_rate                  : yaw rate setpoint in rad/s (float)

*/
mavlink.messages.position_target_global_int = function(time_boot_ms, coordinate_frame, type_mask, lat_int, lon_int, alt, vx, vy, vz, afx, afy, afz, yaw, yaw_rate) {

    this.format = '<IiifffffffffHB';
    this.id = mavlink.MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT;
    this.order_map = [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    this.crc_extra = 150;
    this.name = 'POSITION_TARGET_GLOBAL_INT';

    this.fieldnames = ['time_boot_ms', 'coordinate_frame', 'type_mask', 'lat_int', 'lon_int', 'alt', 'vx', 'vy', 'vz', 'afx', 'afy', 'afz', 'yaw', 'yaw_rate'];


    this.set(arguments);

}
        
mavlink.messages.position_target_global_int.prototype = new mavlink.message;

mavlink.messages.position_target_global_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.lat_int, this.lon_int, this.alt, this.vx, this.vy, this.vz, this.afx, this.afy, this.afz, this.yaw, this.yaw_rate, this.type_mask, this.coordinate_frame]));
}

/* 
The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages
of MAV X and the global coordinate frame in NED coordinates.
Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED
/ north-east-down convention)

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                x                         : X Position (float)
                y                         : Y Position (float)
                z                         : Z Position (float)
                roll                      : Roll (float)
                pitch                     : Pitch (float)
                yaw                       : Yaw (float)

*/
mavlink.messages.local_position_ned_system_global_offset = function(time_boot_ms, x, y, z, roll, pitch, yaw) {

    this.format = '<Iffffff';
    this.id = mavlink.MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 231;
    this.name = 'LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET';

    this.fieldnames = ['time_boot_ms', 'x', 'y', 'z', 'roll', 'pitch', 'yaw'];


    this.set(arguments);

}
        
mavlink.messages.local_position_ned_system_global_offset.prototype = new mavlink.message;

mavlink.messages.local_position_ned_system_global_offset.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.x, this.y, this.z, this.roll, this.pitch, this.yaw]));
}

/* 
DEPRECATED PACKET! Suffers from missing airspeed fields and
singularities due to Euler angles. Please use HIL_STATE_QUATERNION
instead. Sent from simulation to autopilot. This packet is useful for
high throughput applications such as hardware in the loop simulations.

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                roll                      : Roll angle (rad) (float)
                pitch                     : Pitch angle (rad) (float)
                yaw                       : Yaw angle (rad) (float)
                rollspeed                 : Body frame roll / phi angular speed (rad/s) (float)
                pitchspeed                : Body frame pitch / theta angular speed (rad/s) (float)
                yawspeed                  : Body frame yaw / psi angular speed (rad/s) (float)
                lat                       : Latitude, expressed as * 1E7 (int32_t)
                lon                       : Longitude, expressed as * 1E7 (int32_t)
                alt                       : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
                vx                        : Ground X Speed (Latitude), expressed as m/s * 100 (int16_t)
                vy                        : Ground Y Speed (Longitude), expressed as m/s * 100 (int16_t)
                vz                        : Ground Z Speed (Altitude), expressed as m/s * 100 (int16_t)
                xacc                      : X acceleration (mg) (int16_t)
                yacc                      : Y acceleration (mg) (int16_t)
                zacc                      : Z acceleration (mg) (int16_t)

*/
mavlink.messages.hil_state = function(time_usec, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc) {

    this.format = '<Qffffffiiihhhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_STATE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    this.crc_extra = 183;
    this.name = 'HIL_STATE';

    this.fieldnames = ['time_usec', 'roll', 'pitch', 'yaw', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'xacc', 'yacc', 'zacc'];


    this.set(arguments);

}
        
mavlink.messages.hil_state.prototype = new mavlink.message;

mavlink.messages.hil_state.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.roll, this.pitch, this.yaw, this.rollspeed, this.pitchspeed, this.yawspeed, this.lat, this.lon, this.alt, this.vx, this.vy, this.vz, this.xacc, this.yacc, this.zacc]));
}

/* 
Sent from autopilot to simulation. Hardware in the loop control
outputs

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                roll_ailerons             : Control output -1 .. 1 (float)
                pitch_elevator            : Control output -1 .. 1 (float)
                yaw_rudder                : Control output -1 .. 1 (float)
                throttle                  : Throttle 0 .. 1 (float)
                aux1                      : Aux 1, -1 .. 1 (float)
                aux2                      : Aux 2, -1 .. 1 (float)
                aux3                      : Aux 3, -1 .. 1 (float)
                aux4                      : Aux 4, -1 .. 1 (float)
                mode                      : System mode (MAV_MODE) (uint8_t)
                nav_mode                  : Navigation mode (MAV_NAV_MODE) (uint8_t)

*/
mavlink.messages.hil_controls = function(time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode) {

    this.format = '<QffffffffBB';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_CONTROLS;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    this.crc_extra = 63;
    this.name = 'HIL_CONTROLS';

    this.fieldnames = ['time_usec', 'roll_ailerons', 'pitch_elevator', 'yaw_rudder', 'throttle', 'aux1', 'aux2', 'aux3', 'aux4', 'mode', 'nav_mode'];


    this.set(arguments);

}
        
mavlink.messages.hil_controls.prototype = new mavlink.message;

mavlink.messages.hil_controls.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.roll_ailerons, this.pitch_elevator, this.yaw_rudder, this.throttle, this.aux1, this.aux2, this.aux3, this.aux4, this.mode, this.nav_mode]));
}

/* 
Sent from simulation to autopilot. The RAW values of the RC channels
received. The standard PPM modulation is as follows: 1000
microseconds: 0%, 2000 microseconds: 100%. Individual
receivers/transmitters might violate this specification.

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                chan1_raw                 : RC channel 1 value, in microseconds (uint16_t)
                chan2_raw                 : RC channel 2 value, in microseconds (uint16_t)
                chan3_raw                 : RC channel 3 value, in microseconds (uint16_t)
                chan4_raw                 : RC channel 4 value, in microseconds (uint16_t)
                chan5_raw                 : RC channel 5 value, in microseconds (uint16_t)
                chan6_raw                 : RC channel 6 value, in microseconds (uint16_t)
                chan7_raw                 : RC channel 7 value, in microseconds (uint16_t)
                chan8_raw                 : RC channel 8 value, in microseconds (uint16_t)
                chan9_raw                 : RC channel 9 value, in microseconds (uint16_t)
                chan10_raw                : RC channel 10 value, in microseconds (uint16_t)
                chan11_raw                : RC channel 11 value, in microseconds (uint16_t)
                chan12_raw                : RC channel 12 value, in microseconds (uint16_t)
                rssi                      : Receive signal strength indicator, 0: 0%, 255: 100% (uint8_t)

*/
mavlink.messages.hil_rc_inputs_raw = function(time_usec, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, chan9_raw, chan10_raw, chan11_raw, chan12_raw, rssi) {

    this.format = '<QHHHHHHHHHHHHB';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
    this.crc_extra = 54;
    this.name = 'HIL_RC_INPUTS_RAW';

    this.fieldnames = ['time_usec', 'chan1_raw', 'chan2_raw', 'chan3_raw', 'chan4_raw', 'chan5_raw', 'chan6_raw', 'chan7_raw', 'chan8_raw', 'chan9_raw', 'chan10_raw', 'chan11_raw', 'chan12_raw', 'rssi'];


    this.set(arguments);

}
        
mavlink.messages.hil_rc_inputs_raw.prototype = new mavlink.message;

mavlink.messages.hil_rc_inputs_raw.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.chan1_raw, this.chan2_raw, this.chan3_raw, this.chan4_raw, this.chan5_raw, this.chan6_raw, this.chan7_raw, this.chan8_raw, this.chan9_raw, this.chan10_raw, this.chan11_raw, this.chan12_raw, this.rssi]));
}

/* 
Optical flow from a flow sensor (e.g. optical mouse sensor)

                time_usec                 : Timestamp (UNIX) (uint64_t)
                sensor_id                 : Sensor ID (uint8_t)
                flow_x                    : Flow in pixels * 10 in x-sensor direction (dezi-pixels) (int16_t)
                flow_y                    : Flow in pixels * 10 in y-sensor direction (dezi-pixels) (int16_t)
                flow_comp_m_x             : Flow in meters in x-sensor direction, angular-speed compensated (float)
                flow_comp_m_y             : Flow in meters in y-sensor direction, angular-speed compensated (float)
                quality                   : Optical flow quality / confidence. 0: bad, 255: maximum quality (uint8_t)
                ground_distance           : Ground distance in meters. Positive value: distance known. Negative value: Unknown distance (float)

*/
mavlink.messages.optical_flow = function(time_usec, sensor_id, flow_x, flow_y, flow_comp_m_x, flow_comp_m_y, quality, ground_distance) {

    this.format = '<QfffhhBB';
    this.id = mavlink.MAVLINK_MSG_ID_OPTICAL_FLOW;
    this.order_map = [0, 6, 4, 5, 1, 2, 7, 3];
    this.crc_extra = 175;
    this.name = 'OPTICAL_FLOW';

    this.fieldnames = ['time_usec', 'sensor_id', 'flow_x', 'flow_y', 'flow_comp_m_x', 'flow_comp_m_y', 'quality', 'ground_distance'];


    this.set(arguments);

}
        
mavlink.messages.optical_flow.prototype = new mavlink.message;

mavlink.messages.optical_flow.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.flow_comp_m_x, this.flow_comp_m_y, this.ground_distance, this.flow_x, this.flow_y, this.sensor_id, this.quality]));
}

/* 


                usec                      : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                x                         : Global X position (float)
                y                         : Global Y position (float)
                z                         : Global Z position (float)
                roll                      : Roll angle in rad (float)
                pitch                     : Pitch angle in rad (float)
                yaw                       : Yaw angle in rad (float)

*/
mavlink.messages.global_vision_position_estimate = function(usec, x, y, z, roll, pitch, yaw) {

    this.format = '<Qffffff';
    this.id = mavlink.MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 102;
    this.name = 'GLOBAL_VISION_POSITION_ESTIMATE';

    this.fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw'];


    this.set(arguments);

}
        
mavlink.messages.global_vision_position_estimate.prototype = new mavlink.message;

mavlink.messages.global_vision_position_estimate.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.usec, this.x, this.y, this.z, this.roll, this.pitch, this.yaw]));
}

/* 


                usec                      : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                x                         : Global X position (float)
                y                         : Global Y position (float)
                z                         : Global Z position (float)
                roll                      : Roll angle in rad (float)
                pitch                     : Pitch angle in rad (float)
                yaw                       : Yaw angle in rad (float)

*/
mavlink.messages.vision_position_estimate = function(usec, x, y, z, roll, pitch, yaw) {

    this.format = '<Qffffff';
    this.id = mavlink.MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 158;
    this.name = 'VISION_POSITION_ESTIMATE';

    this.fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw'];


    this.set(arguments);

}
        
mavlink.messages.vision_position_estimate.prototype = new mavlink.message;

mavlink.messages.vision_position_estimate.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.usec, this.x, this.y, this.z, this.roll, this.pitch, this.yaw]));
}

/* 


                usec                      : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                x                         : Global X speed (float)
                y                         : Global Y speed (float)
                z                         : Global Z speed (float)

*/
mavlink.messages.vision_speed_estimate = function(usec, x, y, z) {

    this.format = '<Qfff';
    this.id = mavlink.MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 208;
    this.name = 'VISION_SPEED_ESTIMATE';

    this.fieldnames = ['usec', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.vision_speed_estimate.prototype = new mavlink.message;

mavlink.messages.vision_speed_estimate.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.usec, this.x, this.y, this.z]));
}

/* 


                usec                      : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                x                         : Global X position (float)
                y                         : Global Y position (float)
                z                         : Global Z position (float)
                roll                      : Roll angle in rad (float)
                pitch                     : Pitch angle in rad (float)
                yaw                       : Yaw angle in rad (float)

*/
mavlink.messages.vicon_position_estimate = function(usec, x, y, z, roll, pitch, yaw) {

    this.format = '<Qffffff';
    this.id = mavlink.MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 56;
    this.name = 'VICON_POSITION_ESTIMATE';

    this.fieldnames = ['usec', 'x', 'y', 'z', 'roll', 'pitch', 'yaw'];


    this.set(arguments);

}
        
mavlink.messages.vicon_position_estimate.prototype = new mavlink.message;

mavlink.messages.vicon_position_estimate.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.usec, this.x, this.y, this.z, this.roll, this.pitch, this.yaw]));
}

/* 
The IMU readings in SI units in NED body frame

                time_usec                 : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                xacc                      : X acceleration (m/s^2) (float)
                yacc                      : Y acceleration (m/s^2) (float)
                zacc                      : Z acceleration (m/s^2) (float)
                xgyro                     : Angular speed around X axis (rad / sec) (float)
                ygyro                     : Angular speed around Y axis (rad / sec) (float)
                zgyro                     : Angular speed around Z axis (rad / sec) (float)
                xmag                      : X Magnetic field (Gauss) (float)
                ymag                      : Y Magnetic field (Gauss) (float)
                zmag                      : Z Magnetic field (Gauss) (float)
                abs_pressure              : Absolute pressure in millibar (float)
                diff_pressure             : Differential pressure in millibar (float)
                pressure_alt              : Altitude calculated from pressure (float)
                temperature               : Temperature in degrees celsius (float)
                fields_updated            : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature (uint16_t)

*/
mavlink.messages.highres_imu = function(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated) {

    this.format = '<QfffffffffffffH';
    this.id = mavlink.MAVLINK_MSG_ID_HIGHRES_IMU;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
    this.crc_extra = 93;
    this.name = 'HIGHRES_IMU';

    this.fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated'];


    this.set(arguments);

}
        
mavlink.messages.highres_imu.prototype = new mavlink.message;

mavlink.messages.highres_imu.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag, this.abs_pressure, this.diff_pressure, this.pressure_alt, this.temperature, this.fields_updated]));
}

/* 
Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse
sensor)

                time_usec                 : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                sensor_id                 : Sensor ID (uint8_t)
                integration_time_us        : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
                integrated_x              : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
                integrated_y              : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
                integrated_xgyro          : RH rotation around X axis (rad) (float)
                integrated_ygyro          : RH rotation around Y axis (rad) (float)
                integrated_zgyro          : RH rotation around Z axis (rad) (float)
                temperature               : Temperature * 100 in centi-degrees Celsius (int16_t)
                quality                   : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
                time_delta_distance_us        : Time in microseconds since the distance was sampled. (uint32_t)
                distance                  : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)

*/
mavlink.messages.optical_flow_rad = function(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance) {

    this.format = '<QIfffffIfhBB';
    this.id = mavlink.MAVLINK_MSG_ID_OPTICAL_FLOW_RAD;
    this.order_map = [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8];
    this.crc_extra = 138;
    this.name = 'OPTICAL_FLOW_RAD';

    this.fieldnames = ['time_usec', 'sensor_id', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'temperature', 'quality', 'time_delta_distance_us', 'distance'];


    this.set(arguments);

}
        
mavlink.messages.optical_flow_rad.prototype = new mavlink.message;

mavlink.messages.optical_flow_rad.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.integration_time_us, this.integrated_x, this.integrated_y, this.integrated_xgyro, this.integrated_ygyro, this.integrated_zgyro, this.time_delta_distance_us, this.distance, this.temperature, this.sensor_id, this.quality]));
}

/* 
The IMU readings in SI units in NED body frame

                time_usec                 : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                xacc                      : X acceleration (m/s^2) (float)
                yacc                      : Y acceleration (m/s^2) (float)
                zacc                      : Z acceleration (m/s^2) (float)
                xgyro                     : Angular speed around X axis in body frame (rad / sec) (float)
                ygyro                     : Angular speed around Y axis in body frame (rad / sec) (float)
                zgyro                     : Angular speed around Z axis in body frame (rad / sec) (float)
                xmag                      : X Magnetic field (Gauss) (float)
                ymag                      : Y Magnetic field (Gauss) (float)
                zmag                      : Z Magnetic field (Gauss) (float)
                abs_pressure              : Absolute pressure in millibar (float)
                diff_pressure             : Differential pressure (airspeed) in millibar (float)
                pressure_alt              : Altitude calculated from pressure (float)
                temperature               : Temperature in degrees celsius (float)
                fields_updated            : Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature (uint32_t)

*/
mavlink.messages.hil_sensor = function(time_usec, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_updated) {

    this.format = '<QfffffffffffffI';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_SENSOR;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
    this.crc_extra = 108;
    this.name = 'HIL_SENSOR';

    this.fieldnames = ['time_usec', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag', 'abs_pressure', 'diff_pressure', 'pressure_alt', 'temperature', 'fields_updated'];


    this.set(arguments);

}
        
mavlink.messages.hil_sensor.prototype = new mavlink.message;

mavlink.messages.hil_sensor.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag, this.abs_pressure, this.diff_pressure, this.pressure_alt, this.temperature, this.fields_updated]));
}

/* 
Status of simulation environment, if used

                q1                        : True attitude quaternion component 1, w (1 in null-rotation) (float)
                q2                        : True attitude quaternion component 2, x (0 in null-rotation) (float)
                q3                        : True attitude quaternion component 3, y (0 in null-rotation) (float)
                q4                        : True attitude quaternion component 4, z (0 in null-rotation) (float)
                roll                      : Attitude roll expressed as Euler angles, not recommended except for human-readable outputs (float)
                pitch                     : Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs (float)
                yaw                       : Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs (float)
                xacc                      : X acceleration m/s/s (float)
                yacc                      : Y acceleration m/s/s (float)
                zacc                      : Z acceleration m/s/s (float)
                xgyro                     : Angular speed around X axis rad/s (float)
                ygyro                     : Angular speed around Y axis rad/s (float)
                zgyro                     : Angular speed around Z axis rad/s (float)
                lat                       : Latitude in degrees (float)
                lon                       : Longitude in degrees (float)
                alt                       : Altitude in meters (float)
                std_dev_horz              : Horizontal position standard deviation (float)
                std_dev_vert              : Vertical position standard deviation (float)
                vn                        : True velocity in m/s in NORTH direction in earth-fixed NED frame (float)
                ve                        : True velocity in m/s in EAST direction in earth-fixed NED frame (float)
                vd                        : True velocity in m/s in DOWN direction in earth-fixed NED frame (float)

*/
mavlink.messages.sim_state = function(q1, q2, q3, q4, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lon, alt, std_dev_horz, std_dev_vert, vn, ve, vd) {

    this.format = '<fffffffffffffffffffff';
    this.id = mavlink.MAVLINK_MSG_ID_SIM_STATE;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
    this.crc_extra = 32;
    this.name = 'SIM_STATE';

    this.fieldnames = ['q1', 'q2', 'q3', 'q4', 'roll', 'pitch', 'yaw', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'lat', 'lon', 'alt', 'std_dev_horz', 'std_dev_vert', 'vn', 've', 'vd'];


    this.set(arguments);

}
        
mavlink.messages.sim_state.prototype = new mavlink.message;

mavlink.messages.sim_state.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.q1, this.q2, this.q3, this.q4, this.roll, this.pitch, this.yaw, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.lat, this.lon, this.alt, this.std_dev_horz, this.std_dev_vert, this.vn, this.ve, this.vd]));
}

/* 
Status generated by radio and injected into MAVLink stream.

                rssi                      : Local signal strength (uint8_t)
                remrssi                   : Remote signal strength (uint8_t)
                txbuf                     : Remaining free buffer space in percent. (uint8_t)
                noise                     : Background noise level (uint8_t)
                remnoise                  : Remote background noise level (uint8_t)
                rxerrors                  : Receive errors (uint16_t)
                fixed                     : Count of error corrected packets (uint16_t)

*/
mavlink.messages.radio_status = function(rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed) {

    this.format = '<HHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_RADIO_STATUS;
    this.order_map = [2, 3, 4, 5, 6, 0, 1];
    this.crc_extra = 185;
    this.name = 'RADIO_STATUS';

    this.fieldnames = ['rssi', 'remrssi', 'txbuf', 'noise', 'remnoise', 'rxerrors', 'fixed'];


    this.set(arguments);

}
        
mavlink.messages.radio_status.prototype = new mavlink.message;

mavlink.messages.radio_status.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.rxerrors, this.fixed, this.rssi, this.remrssi, this.txbuf, this.noise, this.remnoise]));
}

/* 
File transfer message

                target_network            : Network ID (0 for broadcast) (uint8_t)
                target_system             : System ID (0 for broadcast) (uint8_t)
                target_component          : Component ID (0 for broadcast) (uint8_t)
                payload                   : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields.  The entire content of this block is opaque unless you understand any the encoding message_type.  The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)

*/
mavlink.messages.file_transfer_protocol = function(target_network, target_system, target_component, payload) {

    this.format = '<BBB251s';
    this.id = mavlink.MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 84;
    this.name = 'FILE_TRANSFER_PROTOCOL';

    this.fieldnames = ['target_network', 'target_system', 'target_component', 'payload'];


    this.set(arguments);

}
        
mavlink.messages.file_transfer_protocol.prototype = new mavlink.message;

mavlink.messages.file_transfer_protocol.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_network, this.target_system, this.target_component, this.payload]));
}

/* 
Time synchronization message.

                tc1                       : Time sync timestamp 1 (int64_t)
                ts1                       : Time sync timestamp 2 (int64_t)

*/
mavlink.messages.timesync = function(tc1, ts1) {

    this.format = '<qq';
    this.id = mavlink.MAVLINK_MSG_ID_TIMESYNC;
    this.order_map = [0, 1];
    this.crc_extra = 34;
    this.name = 'TIMESYNC';

    this.fieldnames = ['tc1', 'ts1'];


    this.set(arguments);

}
        
mavlink.messages.timesync.prototype = new mavlink.message;

mavlink.messages.timesync.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.tc1, this.ts1]));
}

/* 
Camera-IMU triggering and synchronisation message.

                time_usec                 : Timestamp for the image frame in microseconds (uint64_t)
                seq                       : Image frame sequence (uint32_t)

*/
mavlink.messages.camera_trigger = function(time_usec, seq) {

    this.format = '<QI';
    this.id = mavlink.MAVLINK_MSG_ID_CAMERA_TRIGGER;
    this.order_map = [0, 1];
    this.crc_extra = 174;
    this.name = 'CAMERA_TRIGGER';

    this.fieldnames = ['time_usec', 'seq'];


    this.set(arguments);

}
        
mavlink.messages.camera_trigger.prototype = new mavlink.message;

mavlink.messages.camera_trigger.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.seq]));
}

/* 
The global position, as returned by the Global Positioning System
(GPS). This is                  NOT the global position estimate of
the sytem, but rather a RAW sensor value. See message GLOBAL_POSITION
for the global position estimate. Coordinate frame is right-handed,
Z-axis up (GPS frame).

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                fix_type                  : 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. (uint8_t)
                lat                       : Latitude (WGS84), in degrees * 1E7 (int32_t)
                lon                       : Longitude (WGS84), in degrees * 1E7 (int32_t)
                alt                       : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
                eph                       : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
                epv                       : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 (uint16_t)
                vel                       : GPS ground speed (m/s * 100). If unknown, set to: 65535 (uint16_t)
                vn                        : GPS velocity in cm/s in NORTH direction in earth-fixed NED frame (int16_t)
                ve                        : GPS velocity in cm/s in EAST direction in earth-fixed NED frame (int16_t)
                vd                        : GPS velocity in cm/s in DOWN direction in earth-fixed NED frame (int16_t)
                cog                       : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 (uint16_t)
                satellites_visible        : Number of satellites visible. If unknown, set to 255 (uint8_t)

*/
mavlink.messages.hil_gps = function(time_usec, fix_type, lat, lon, alt, eph, epv, vel, vn, ve, vd, cog, satellites_visible) {

    this.format = '<QiiiHHHhhhHBB';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_GPS;
    this.order_map = [0, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12];
    this.crc_extra = 124;
    this.name = 'HIL_GPS';

    this.fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'vn', 've', 'vd', 'cog', 'satellites_visible'];


    this.set(arguments);

}
        
mavlink.messages.hil_gps.prototype = new mavlink.message;

mavlink.messages.hil_gps.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.lat, this.lon, this.alt, this.eph, this.epv, this.vel, this.vn, this.ve, this.vd, this.cog, this.fix_type, this.satellites_visible]));
}

/* 
Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical
mouse sensor)

                time_usec                 : Timestamp (microseconds, synced to UNIX time or since system boot) (uint64_t)
                sensor_id                 : Sensor ID (uint8_t)
                integration_time_us        : Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. (uint32_t)
                integrated_x              : Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) (float)
                integrated_y              : Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) (float)
                integrated_xgyro          : RH rotation around X axis (rad) (float)
                integrated_ygyro          : RH rotation around Y axis (rad) (float)
                integrated_zgyro          : RH rotation around Z axis (rad) (float)
                temperature               : Temperature * 100 in centi-degrees Celsius (int16_t)
                quality                   : Optical flow quality / confidence. 0: no valid flow, 255: maximum quality (uint8_t)
                time_delta_distance_us        : Time in microseconds since the distance was sampled. (uint32_t)
                distance                  : Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. (float)

*/
mavlink.messages.hil_optical_flow = function(time_usec, sensor_id, integration_time_us, integrated_x, integrated_y, integrated_xgyro, integrated_ygyro, integrated_zgyro, temperature, quality, time_delta_distance_us, distance) {

    this.format = '<QIfffffIfhBB';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
    this.order_map = [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8];
    this.crc_extra = 237;
    this.name = 'HIL_OPTICAL_FLOW';

    this.fieldnames = ['time_usec', 'sensor_id', 'integration_time_us', 'integrated_x', 'integrated_y', 'integrated_xgyro', 'integrated_ygyro', 'integrated_zgyro', 'temperature', 'quality', 'time_delta_distance_us', 'distance'];


    this.set(arguments);

}
        
mavlink.messages.hil_optical_flow.prototype = new mavlink.message;

mavlink.messages.hil_optical_flow.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.integration_time_us, this.integrated_x, this.integrated_y, this.integrated_xgyro, this.integrated_ygyro, this.integrated_zgyro, this.time_delta_distance_us, this.distance, this.temperature, this.sensor_id, this.quality]));
}

/* 
Sent from simulation to autopilot, avoids in contrast to HIL_STATE
singularities. This packet is useful for high throughput applications
such as hardware in the loop simulations.

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                attitude_quaternion        : Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) (float)
                rollspeed                 : Body frame roll / phi angular speed (rad/s) (float)
                pitchspeed                : Body frame pitch / theta angular speed (rad/s) (float)
                yawspeed                  : Body frame yaw / psi angular speed (rad/s) (float)
                lat                       : Latitude, expressed as * 1E7 (int32_t)
                lon                       : Longitude, expressed as * 1E7 (int32_t)
                alt                       : Altitude in meters, expressed as * 1000 (millimeters) (int32_t)
                vx                        : Ground X Speed (Latitude), expressed as m/s * 100 (int16_t)
                vy                        : Ground Y Speed (Longitude), expressed as m/s * 100 (int16_t)
                vz                        : Ground Z Speed (Altitude), expressed as m/s * 100 (int16_t)
                ind_airspeed              : Indicated airspeed, expressed as m/s * 100 (uint16_t)
                true_airspeed             : True airspeed, expressed as m/s * 100 (uint16_t)
                xacc                      : X acceleration (mg) (int16_t)
                yacc                      : Y acceleration (mg) (int16_t)
                zacc                      : Z acceleration (mg) (int16_t)

*/
mavlink.messages.hil_state_quaternion = function(time_usec, attitude_quaternion, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc) {

    this.format = '<Q4ffffiiihhhHHhhh';
    this.id = mavlink.MAVLINK_MSG_ID_HIL_STATE_QUATERNION;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    this.crc_extra = 4;
    this.name = 'HIL_STATE_QUATERNION';

    this.fieldnames = ['time_usec', 'attitude_quaternion', 'rollspeed', 'pitchspeed', 'yawspeed', 'lat', 'lon', 'alt', 'vx', 'vy', 'vz', 'ind_airspeed', 'true_airspeed', 'xacc', 'yacc', 'zacc'];


    this.set(arguments);

}
        
mavlink.messages.hil_state_quaternion.prototype = new mavlink.message;

mavlink.messages.hil_state_quaternion.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.attitude_quaternion, this.rollspeed, this.pitchspeed, this.yawspeed, this.lat, this.lon, this.alt, this.vx, this.vy, this.vz, this.ind_airspeed, this.true_airspeed, this.xacc, this.yacc, this.zacc]));
}

/* 
The RAW IMU readings for secondary 9DOF sensor setup. This message
should contain the scaled values to the described units

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                xacc                      : X acceleration (mg) (int16_t)
                yacc                      : Y acceleration (mg) (int16_t)
                zacc                      : Z acceleration (mg) (int16_t)
                xgyro                     : Angular speed around X axis (millirad /sec) (int16_t)
                ygyro                     : Angular speed around Y axis (millirad /sec) (int16_t)
                zgyro                     : Angular speed around Z axis (millirad /sec) (int16_t)
                xmag                      : X Magnetic field (milli tesla) (int16_t)
                ymag                      : Y Magnetic field (milli tesla) (int16_t)
                zmag                      : Z Magnetic field (milli tesla) (int16_t)

*/
mavlink.messages.scaled_imu2 = function(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag) {

    this.format = '<Ihhhhhhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_SCALED_IMU2;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    this.crc_extra = 76;
    this.name = 'SCALED_IMU2';

    this.fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag'];


    this.set(arguments);

}
        
mavlink.messages.scaled_imu2.prototype = new mavlink.message;

mavlink.messages.scaled_imu2.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag]));
}

/* 
Request a list of available logs. On some systems calling this may
stop on-board logging until LOG_REQUEST_END is called.

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                start                     : First log id (0 for first available) (uint16_t)
                end                       : Last log id (0xffff for last available) (uint16_t)

*/
mavlink.messages.log_request_list = function(target_system, target_component, start, end) {

    this.format = '<HHBB';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_REQUEST_LIST;
    this.order_map = [2, 3, 0, 1];
    this.crc_extra = 128;
    this.name = 'LOG_REQUEST_LIST';

    this.fieldnames = ['target_system', 'target_component', 'start', 'end'];


    this.set(arguments);

}
        
mavlink.messages.log_request_list.prototype = new mavlink.message;

mavlink.messages.log_request_list.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.start, this.end, this.target_system, this.target_component]));
}

/* 
Reply to LOG_REQUEST_LIST

                id                        : Log id (uint16_t)
                num_logs                  : Total number of logs (uint16_t)
                last_log_num              : High log number (uint16_t)
                time_utc                  : UTC timestamp of log in seconds since 1970, or 0 if not available (uint32_t)
                size                      : Size of the log (may be approximate) in bytes (uint32_t)

*/
mavlink.messages.log_entry = function(id, num_logs, last_log_num, time_utc, size) {

    this.format = '<IIHHH';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_ENTRY;
    this.order_map = [2, 3, 4, 0, 1];
    this.crc_extra = 56;
    this.name = 'LOG_ENTRY';

    this.fieldnames = ['id', 'num_logs', 'last_log_num', 'time_utc', 'size'];


    this.set(arguments);

}
        
mavlink.messages.log_entry.prototype = new mavlink.message;

mavlink.messages.log_entry.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_utc, this.size, this.id, this.num_logs, this.last_log_num]));
}

/* 
Request a chunk of a log

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                id                        : Log id (from LOG_ENTRY reply) (uint16_t)
                ofs                       : Offset into the log (uint32_t)
                count                     : Number of bytes (uint32_t)

*/
mavlink.messages.log_request_data = function(target_system, target_component, id, ofs, count) {

    this.format = '<IIHBB';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_REQUEST_DATA;
    this.order_map = [3, 4, 2, 0, 1];
    this.crc_extra = 116;
    this.name = 'LOG_REQUEST_DATA';

    this.fieldnames = ['target_system', 'target_component', 'id', 'ofs', 'count'];


    this.set(arguments);

}
        
mavlink.messages.log_request_data.prototype = new mavlink.message;

mavlink.messages.log_request_data.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.ofs, this.count, this.id, this.target_system, this.target_component]));
}

/* 
Reply to LOG_REQUEST_DATA

                id                        : Log id (from LOG_ENTRY reply) (uint16_t)
                ofs                       : Offset into the log (uint32_t)
                count                     : Number of bytes (zero for end of log) (uint8_t)
                data                      : log data (uint8_t)

*/
mavlink.messages.log_data = function(id, ofs, count, data) {

    this.format = '<IHB90s';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_DATA;
    this.order_map = [1, 0, 2, 3];
    this.crc_extra = 134;
    this.name = 'LOG_DATA';

    this.fieldnames = ['id', 'ofs', 'count', 'data'];


    this.set(arguments);

}
        
mavlink.messages.log_data.prototype = new mavlink.message;

mavlink.messages.log_data.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.ofs, this.id, this.count, this.data]));
}

/* 
Erase all logs

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)

*/
mavlink.messages.log_erase = function(target_system, target_component) {

    this.format = '<BB';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_ERASE;
    this.order_map = [0, 1];
    this.crc_extra = 237;
    this.name = 'LOG_ERASE';

    this.fieldnames = ['target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.log_erase.prototype = new mavlink.message;

mavlink.messages.log_erase.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component]));
}

/* 
Stop log transfer and resume normal logging

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)

*/
mavlink.messages.log_request_end = function(target_system, target_component) {

    this.format = '<BB';
    this.id = mavlink.MAVLINK_MSG_ID_LOG_REQUEST_END;
    this.order_map = [0, 1];
    this.crc_extra = 203;
    this.name = 'LOG_REQUEST_END';

    this.fieldnames = ['target_system', 'target_component'];


    this.set(arguments);

}
        
mavlink.messages.log_request_end.prototype = new mavlink.message;

mavlink.messages.log_request_end.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component]));
}

/* 
data for injecting into the onboard GPS (used for DGPS)

                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                len                       : data length (uint8_t)
                data                      : raw data (110 is enough for 12 satellites of RTCMv2) (uint8_t)

*/
mavlink.messages.gps_inject_data = function(target_system, target_component, len, data) {

    this.format = '<BBB110s';
    this.id = mavlink.MAVLINK_MSG_ID_GPS_INJECT_DATA;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 250;
    this.name = 'GPS_INJECT_DATA';

    this.fieldnames = ['target_system', 'target_component', 'len', 'data'];


    this.set(arguments);

}
        
mavlink.messages.gps_inject_data.prototype = new mavlink.message;

mavlink.messages.gps_inject_data.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.target_system, this.target_component, this.len, this.data]));
}

/* 
Second GPS data. Coordinate frame is right-handed, Z-axis up (GPS
frame).

                time_usec                 : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t)
                fix_type                  : 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. (uint8_t)
                lat                       : Latitude (WGS84), in degrees * 1E7 (int32_t)
                lon                       : Longitude (WGS84), in degrees * 1E7 (int32_t)
                alt                       : Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) (int32_t)
                eph                       : GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
                epv                       : GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX (uint16_t)
                vel                       : GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX (uint16_t)
                cog                       : Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX (uint16_t)
                satellites_visible        : Number of satellites visible. If unknown, set to 255 (uint8_t)
                dgps_numch                : Number of DGPS satellites (uint8_t)
                dgps_age                  : Age of DGPS info (uint32_t)

*/
mavlink.messages.gps2_raw = function(time_usec, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, dgps_numch, dgps_age) {

    this.format = '<QiiiIHHHHBBB';
    this.id = mavlink.MAVLINK_MSG_ID_GPS2_RAW;
    this.order_map = [0, 9, 1, 2, 3, 5, 6, 7, 8, 10, 11, 4];
    this.crc_extra = 87;
    this.name = 'GPS2_RAW';

    this.fieldnames = ['time_usec', 'fix_type', 'lat', 'lon', 'alt', 'eph', 'epv', 'vel', 'cog', 'satellites_visible', 'dgps_numch', 'dgps_age'];


    this.set(arguments);

}
        
mavlink.messages.gps2_raw.prototype = new mavlink.message;

mavlink.messages.gps2_raw.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.lat, this.lon, this.alt, this.dgps_age, this.eph, this.epv, this.vel, this.cog, this.fix_type, this.satellites_visible, this.dgps_numch]));
}

/* 
Power supply status

                Vcc                       : 5V rail voltage in millivolts (uint16_t)
                Vservo                    : servo rail voltage in millivolts (uint16_t)
                flags                     : power supply status flags (see MAV_POWER_STATUS enum) (uint16_t)

*/
mavlink.messages.power_status = function(Vcc, Vservo, flags) {

    this.format = '<HHH';
    this.id = mavlink.MAVLINK_MSG_ID_POWER_STATUS;
    this.order_map = [0, 1, 2];
    this.crc_extra = 203;
    this.name = 'POWER_STATUS';

    this.fieldnames = ['Vcc', 'Vservo', 'flags'];


    this.set(arguments);

}
        
mavlink.messages.power_status.prototype = new mavlink.message;

mavlink.messages.power_status.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.Vcc, this.Vservo, this.flags]));
}

/* 
Control a serial port. This can be used for raw access to an onboard
serial peripheral such as a GPS or telemetry radio. It is designed to
make it possible to update the devices firmware via MAVLink messages
or change the devices settings. A message with zero bytes can be used
to change just the baudrate.

                device                    : See SERIAL_CONTROL_DEV enum (uint8_t)
                flags                     : See SERIAL_CONTROL_FLAG enum (uint8_t)
                timeout                   : Timeout for reply data in milliseconds (uint16_t)
                baudrate                  : Baudrate of transfer. Zero means no change. (uint32_t)
                count                     : how many bytes in this transfer (uint8_t)
                data                      : serial data (uint8_t)

*/
mavlink.messages.serial_control = function(device, flags, timeout, baudrate, count, data) {

    this.format = '<IHBBB70s';
    this.id = mavlink.MAVLINK_MSG_ID_SERIAL_CONTROL;
    this.order_map = [2, 3, 1, 0, 4, 5];
    this.crc_extra = 220;
    this.name = 'SERIAL_CONTROL';

    this.fieldnames = ['device', 'flags', 'timeout', 'baudrate', 'count', 'data'];


    this.set(arguments);

}
        
mavlink.messages.serial_control.prototype = new mavlink.message;

mavlink.messages.serial_control.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.baudrate, this.timeout, this.device, this.flags, this.count, this.data]));
}

/* 
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting

                time_last_baseline_ms        : Time since boot of last baseline message received in ms. (uint32_t)
                rtk_receiver_id           : Identification of connected RTK receiver. (uint8_t)
                wn                        : GPS Week Number of last baseline (uint16_t)
                tow                       : GPS Time of Week of last baseline (uint32_t)
                rtk_health                : GPS-specific health report for RTK data. (uint8_t)
                rtk_rate                  : Rate of baseline messages being received by GPS, in HZ (uint8_t)
                nsats                     : Current number of sats used for RTK calculation. (uint8_t)
                baseline_coords_type        : Coordinate system of baseline. 0 == ECEF, 1 == NED (uint8_t)
                baseline_a_mm             : Current baseline in ECEF x or NED north component in mm. (int32_t)
                baseline_b_mm             : Current baseline in ECEF y or NED east component in mm. (int32_t)
                baseline_c_mm             : Current baseline in ECEF z or NED down component in mm. (int32_t)
                accuracy                  : Current estimate of baseline accuracy. (uint32_t)
                iar_num_hypotheses        : Current number of integer ambiguity hypotheses. (int32_t)

*/
mavlink.messages.gps_rtk = function(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses) {

    this.format = '<IIiiiIiHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_GPS_RTK;
    this.order_map = [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6];
    this.crc_extra = 25;
    this.name = 'GPS_RTK';

    this.fieldnames = ['time_last_baseline_ms', 'rtk_receiver_id', 'wn', 'tow', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses'];


    this.set(arguments);

}
        
mavlink.messages.gps_rtk.prototype = new mavlink.message;

mavlink.messages.gps_rtk.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_last_baseline_ms, this.tow, this.baseline_a_mm, this.baseline_b_mm, this.baseline_c_mm, this.accuracy, this.iar_num_hypotheses, this.wn, this.rtk_receiver_id, this.rtk_health, this.rtk_rate, this.nsats, this.baseline_coords_type]));
}

/* 
RTK GPS data. Gives information on the relative baseline calculation
the GPS is reporting

                time_last_baseline_ms        : Time since boot of last baseline message received in ms. (uint32_t)
                rtk_receiver_id           : Identification of connected RTK receiver. (uint8_t)
                wn                        : GPS Week Number of last baseline (uint16_t)
                tow                       : GPS Time of Week of last baseline (uint32_t)
                rtk_health                : GPS-specific health report for RTK data. (uint8_t)
                rtk_rate                  : Rate of baseline messages being received by GPS, in HZ (uint8_t)
                nsats                     : Current number of sats used for RTK calculation. (uint8_t)
                baseline_coords_type        : Coordinate system of baseline. 0 == ECEF, 1 == NED (uint8_t)
                baseline_a_mm             : Current baseline in ECEF x or NED north component in mm. (int32_t)
                baseline_b_mm             : Current baseline in ECEF y or NED east component in mm. (int32_t)
                baseline_c_mm             : Current baseline in ECEF z or NED down component in mm. (int32_t)
                accuracy                  : Current estimate of baseline accuracy. (uint32_t)
                iar_num_hypotheses        : Current number of integer ambiguity hypotheses. (int32_t)

*/
mavlink.messages.gps2_rtk = function(time_last_baseline_ms, rtk_receiver_id, wn, tow, rtk_health, rtk_rate, nsats, baseline_coords_type, baseline_a_mm, baseline_b_mm, baseline_c_mm, accuracy, iar_num_hypotheses) {

    this.format = '<IIiiiIiHBBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_GPS2_RTK;
    this.order_map = [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6];
    this.crc_extra = 226;
    this.name = 'GPS2_RTK';

    this.fieldnames = ['time_last_baseline_ms', 'rtk_receiver_id', 'wn', 'tow', 'rtk_health', 'rtk_rate', 'nsats', 'baseline_coords_type', 'baseline_a_mm', 'baseline_b_mm', 'baseline_c_mm', 'accuracy', 'iar_num_hypotheses'];


    this.set(arguments);

}
        
mavlink.messages.gps2_rtk.prototype = new mavlink.message;

mavlink.messages.gps2_rtk.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_last_baseline_ms, this.tow, this.baseline_a_mm, this.baseline_b_mm, this.baseline_c_mm, this.accuracy, this.iar_num_hypotheses, this.wn, this.rtk_receiver_id, this.rtk_health, this.rtk_rate, this.nsats, this.baseline_coords_type]));
}

/* 
The RAW IMU readings for 3rd 9DOF sensor setup. This message should
contain the scaled values to the described units

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                xacc                      : X acceleration (mg) (int16_t)
                yacc                      : Y acceleration (mg) (int16_t)
                zacc                      : Z acceleration (mg) (int16_t)
                xgyro                     : Angular speed around X axis (millirad /sec) (int16_t)
                ygyro                     : Angular speed around Y axis (millirad /sec) (int16_t)
                zgyro                     : Angular speed around Z axis (millirad /sec) (int16_t)
                xmag                      : X Magnetic field (milli tesla) (int16_t)
                ymag                      : Y Magnetic field (milli tesla) (int16_t)
                zmag                      : Z Magnetic field (milli tesla) (int16_t)

*/
mavlink.messages.scaled_imu3 = function(time_boot_ms, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag) {

    this.format = '<Ihhhhhhhhh';
    this.id = mavlink.MAVLINK_MSG_ID_SCALED_IMU3;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    this.crc_extra = 46;
    this.name = 'SCALED_IMU3';

    this.fieldnames = ['time_boot_ms', 'xacc', 'yacc', 'zacc', 'xgyro', 'ygyro', 'zgyro', 'xmag', 'ymag', 'zmag'];


    this.set(arguments);

}
        
mavlink.messages.scaled_imu3.prototype = new mavlink.message;

mavlink.messages.scaled_imu3.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.xacc, this.yacc, this.zacc, this.xgyro, this.ygyro, this.zgyro, this.xmag, this.ymag, this.zmag]));
}

/* 


                type                      : type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h) (uint8_t)
                size                      : total data size in bytes (set on ACK only) (uint32_t)
                width                     : Width of a matrix or image (uint16_t)
                height                    : Height of a matrix or image (uint16_t)
                packets                   : number of packets beeing sent (set on ACK only) (uint16_t)
                payload                   : payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only) (uint8_t)
                jpg_quality               : JPEG quality out of [1,100] (uint8_t)

*/
mavlink.messages.data_transmission_handshake = function(type, size, width, height, packets, payload, jpg_quality) {

    this.format = '<IHHHBBB';
    this.id = mavlink.MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE;
    this.order_map = [4, 0, 1, 2, 3, 5, 6];
    this.crc_extra = 29;
    this.name = 'DATA_TRANSMISSION_HANDSHAKE';

    this.fieldnames = ['type', 'size', 'width', 'height', 'packets', 'payload', 'jpg_quality'];


    this.set(arguments);

}
        
mavlink.messages.data_transmission_handshake.prototype = new mavlink.message;

mavlink.messages.data_transmission_handshake.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.size, this.width, this.height, this.packets, this.type, this.payload, this.jpg_quality]));
}

/* 


                seqnr                     : sequence number (starting with 0 on every transmission) (uint16_t)
                data                      : image data bytes (uint8_t)

*/
mavlink.messages.encapsulated_data = function(seqnr, data) {

    this.format = '<H253s';
    this.id = mavlink.MAVLINK_MSG_ID_ENCAPSULATED_DATA;
    this.order_map = [0, 1];
    this.crc_extra = 223;
    this.name = 'ENCAPSULATED_DATA';

    this.fieldnames = ['seqnr', 'data'];


    this.set(arguments);

}
        
mavlink.messages.encapsulated_data.prototype = new mavlink.message;

mavlink.messages.encapsulated_data.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seqnr, this.data]));
}

/* 


                time_boot_ms              : Time since system boot (uint32_t)
                min_distance              : Minimum distance the sensor can measure in centimeters (uint16_t)
                max_distance              : Maximum distance the sensor can measure in centimeters (uint16_t)
                current_distance          : Current distance reading (uint16_t)
                type                      : Type from MAV_DISTANCE_SENSOR enum. (uint8_t)
                id                        : Onboard ID of the sensor (uint8_t)
                orientation               : Direction the sensor faces from MAV_SENSOR_ORIENTATION enum. (uint8_t)
                covariance                : Measurement covariance in centimeters, 0 for unknown / invalid readings (uint8_t)

*/
mavlink.messages.distance_sensor = function(time_boot_ms, min_distance, max_distance, current_distance, type, id, orientation, covariance) {

    this.format = '<IHHHBBBB';
    this.id = mavlink.MAVLINK_MSG_ID_DISTANCE_SENSOR;
    this.order_map = [0, 1, 2, 3, 4, 5, 6, 7];
    this.crc_extra = 85;
    this.name = 'DISTANCE_SENSOR';

    this.fieldnames = ['time_boot_ms', 'min_distance', 'max_distance', 'current_distance', 'type', 'id', 'orientation', 'covariance'];


    this.set(arguments);

}
        
mavlink.messages.distance_sensor.prototype = new mavlink.message;

mavlink.messages.distance_sensor.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.min_distance, this.max_distance, this.current_distance, this.type, this.id, this.orientation, this.covariance]));
}

/* 
Request for terrain data and terrain status

                lat                       : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
                lon                       : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
                grid_spacing              : Grid spacing in meters (uint16_t)
                mask                      : Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) (uint64_t)

*/
mavlink.messages.terrain_request = function(lat, lon, grid_spacing, mask) {

    this.format = '<QiiH';
    this.id = mavlink.MAVLINK_MSG_ID_TERRAIN_REQUEST;
    this.order_map = [1, 2, 3, 0];
    this.crc_extra = 6;
    this.name = 'TERRAIN_REQUEST';

    this.fieldnames = ['lat', 'lon', 'grid_spacing', 'mask'];


    this.set(arguments);

}
        
mavlink.messages.terrain_request.prototype = new mavlink.message;

mavlink.messages.terrain_request.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.mask, this.lat, this.lon, this.grid_spacing]));
}

/* 
Terrain data sent from GCS. The lat/lon and grid_spacing must be the
same as a lat/lon from a TERRAIN_REQUEST

                lat                       : Latitude of SW corner of first grid (degrees *10^7) (int32_t)
                lon                       : Longitude of SW corner of first grid (in degrees *10^7) (int32_t)
                grid_spacing              : Grid spacing in meters (uint16_t)
                gridbit                   : bit within the terrain request mask (uint8_t)
                data                      : Terrain data in meters AMSL (int16_t)

*/
mavlink.messages.terrain_data = function(lat, lon, grid_spacing, gridbit, data) {

    this.format = '<iiH16hB';
    this.id = mavlink.MAVLINK_MSG_ID_TERRAIN_DATA;
    this.order_map = [0, 1, 2, 4, 3];
    this.crc_extra = 229;
    this.name = 'TERRAIN_DATA';

    this.fieldnames = ['lat', 'lon', 'grid_spacing', 'gridbit', 'data'];


    this.set(arguments);

}
        
mavlink.messages.terrain_data.prototype = new mavlink.message;

mavlink.messages.terrain_data.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.lat, this.lon, this.grid_spacing, this.data, this.gridbit]));
}

/* 
Request that the vehicle report terrain height at the given location.
Used by GCS to check if vehicle has all terrain data needed for a
mission.

                lat                       : Latitude (degrees *10^7) (int32_t)
                lon                       : Longitude (degrees *10^7) (int32_t)

*/
mavlink.messages.terrain_check = function(lat, lon) {

    this.format = '<ii';
    this.id = mavlink.MAVLINK_MSG_ID_TERRAIN_CHECK;
    this.order_map = [0, 1];
    this.crc_extra = 203;
    this.name = 'TERRAIN_CHECK';

    this.fieldnames = ['lat', 'lon'];


    this.set(arguments);

}
        
mavlink.messages.terrain_check.prototype = new mavlink.message;

mavlink.messages.terrain_check.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.lat, this.lon]));
}

/* 
Response from a TERRAIN_CHECK request

                lat                       : Latitude (degrees *10^7) (int32_t)
                lon                       : Longitude (degrees *10^7) (int32_t)
                spacing                   : grid spacing (zero if terrain at this location unavailable) (uint16_t)
                terrain_height            : Terrain height in meters AMSL (float)
                current_height            : Current vehicle height above lat/lon terrain height (meters) (float)
                pending                   : Number of 4x4 terrain blocks waiting to be received or read from disk (uint16_t)
                loaded                    : Number of 4x4 terrain blocks in memory (uint16_t)

*/
mavlink.messages.terrain_report = function(lat, lon, spacing, terrain_height, current_height, pending, loaded) {

    this.format = '<iiffHHH';
    this.id = mavlink.MAVLINK_MSG_ID_TERRAIN_REPORT;
    this.order_map = [0, 1, 4, 2, 3, 5, 6];
    this.crc_extra = 1;
    this.name = 'TERRAIN_REPORT';

    this.fieldnames = ['lat', 'lon', 'spacing', 'terrain_height', 'current_height', 'pending', 'loaded'];


    this.set(arguments);

}
        
mavlink.messages.terrain_report.prototype = new mavlink.message;

mavlink.messages.terrain_report.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.lat, this.lon, this.terrain_height, this.current_height, this.spacing, this.pending, this.loaded]));
}

/* 
Barometer readings for 2nd barometer

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                press_abs                 : Absolute pressure (hectopascal) (float)
                press_diff                : Differential pressure 1 (hectopascal) (float)
                temperature               : Temperature measurement (0.01 degrees celsius) (int16_t)

*/
mavlink.messages.scaled_pressure2 = function(time_boot_ms, press_abs, press_diff, temperature) {

    this.format = '<Iffh';
    this.id = mavlink.MAVLINK_MSG_ID_SCALED_PRESSURE2;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 195;
    this.name = 'SCALED_PRESSURE2';

    this.fieldnames = ['time_boot_ms', 'press_abs', 'press_diff', 'temperature'];


    this.set(arguments);

}
        
mavlink.messages.scaled_pressure2.prototype = new mavlink.message;

mavlink.messages.scaled_pressure2.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.press_abs, this.press_diff, this.temperature]));
}

/* 
Motion capture attitude and position

                time_usec                 : Timestamp (micros since boot or Unix epoch) (uint64_t)
                q                         : Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) (float)
                x                         : X position in meters (NED) (float)
                y                         : Y position in meters (NED) (float)
                z                         : Z position in meters (NED) (float)

*/
mavlink.messages.att_pos_mocap = function(time_usec, q, x, y, z) {

    this.format = '<Q4ffff';
    this.id = mavlink.MAVLINK_MSG_ID_ATT_POS_MOCAP;
    this.order_map = [0, 1, 2, 3, 4];
    this.crc_extra = 109;
    this.name = 'ATT_POS_MOCAP';

    this.fieldnames = ['time_usec', 'q', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.att_pos_mocap.prototype = new mavlink.message;

mavlink.messages.att_pos_mocap.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.q, this.x, this.y, this.z]));
}

/* 
Set the vehicle attitude and body angular rates.

                time_usec                 : Timestamp (micros since boot or Unix epoch) (uint64_t)
                group_mlx                 : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
                target_system             : System ID (uint8_t)
                target_component          : Component ID (uint8_t)
                controls                  : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)

*/
mavlink.messages.set_actuator_control_target = function(time_usec, group_mlx, target_system, target_component, controls) {

    this.format = '<Q8fBBB';
    this.id = mavlink.MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET;
    this.order_map = [0, 2, 3, 4, 1];
    this.crc_extra = 168;
    this.name = 'SET_ACTUATOR_CONTROL_TARGET';

    this.fieldnames = ['time_usec', 'group_mlx', 'target_system', 'target_component', 'controls'];


    this.set(arguments);

}
        
mavlink.messages.set_actuator_control_target.prototype = new mavlink.message;

mavlink.messages.set_actuator_control_target.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.controls, this.group_mlx, this.target_system, this.target_component]));
}

/* 
Set the vehicle attitude and body angular rates.

                time_usec                 : Timestamp (micros since boot or Unix epoch) (uint64_t)
                group_mlx                 : Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. (uint8_t)
                controls                  : Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. (float)

*/
mavlink.messages.actuator_control_target = function(time_usec, group_mlx, controls) {

    this.format = '<Q8fB';
    this.id = mavlink.MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
    this.order_map = [0, 2, 1];
    this.crc_extra = 181;
    this.name = 'ACTUATOR_CONTROL_TARGET';

    this.fieldnames = ['time_usec', 'group_mlx', 'controls'];


    this.set(arguments);

}
        
mavlink.messages.actuator_control_target.prototype = new mavlink.message;

mavlink.messages.actuator_control_target.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.controls, this.group_mlx]));
}

/* 
Battery information

                id                        : Battery ID (uint8_t)
                battery_function          : Function of the battery (uint8_t)
                type                      : Type (chemistry) of the battery (uint8_t)
                temperature               : Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature. (int16_t)
                voltages                  : Battery voltage of cells, in millivolts (1 = 1 millivolt) (uint16_t)
                current_battery           : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
                current_consumed          : Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate (int32_t)
                energy_consumed           : Consumed energy, in 100*Joules (intergrated U*I*dt)  (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate (int32_t)
                battery_remaining         : Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery (int8_t)

*/
mavlink.messages.battery_status = function(id, battery_function, type, temperature, voltages, current_battery, current_consumed, energy_consumed, battery_remaining) {

    this.format = '<iih10HhBBBb';
    this.id = mavlink.MAVLINK_MSG_ID_BATTERY_STATUS;
    this.order_map = [5, 6, 7, 2, 3, 4, 0, 1, 8];
    this.crc_extra = 154;
    this.name = 'BATTERY_STATUS';

    this.fieldnames = ['id', 'battery_function', 'type', 'temperature', 'voltages', 'current_battery', 'current_consumed', 'energy_consumed', 'battery_remaining'];


    this.set(arguments);

}
        
mavlink.messages.battery_status.prototype = new mavlink.message;

mavlink.messages.battery_status.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.current_consumed, this.energy_consumed, this.temperature, this.voltages, this.current_battery, this.id, this.battery_function, this.type, this.battery_remaining]));
}

/* 
Version and capability of autopilot software

                capabilities              : bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) (uint64_t)
                flight_sw_version         : Firmware version number (uint32_t)
                middleware_sw_version        : Middleware version number (uint32_t)
                os_sw_version             : Operating system version number (uint32_t)
                board_version             : HW / board version (last 8 bytes should be silicon ID, if any) (uint32_t)
                flight_custom_version        : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
                middleware_custom_version        : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
                os_custom_version         : Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. (uint8_t)
                vendor_id                 : ID of the board vendor (uint16_t)
                product_id                : ID of the product (uint16_t)
                uid                       : UID if provided by hardware (uint64_t)

*/
mavlink.messages.autopilot_version = function(capabilities, flight_sw_version, middleware_sw_version, os_sw_version, board_version, flight_custom_version, middleware_custom_version, os_custom_version, vendor_id, product_id, uid) {

    this.format = '<QQIIIIHH8s8s8s';
    this.id = mavlink.MAVLINK_MSG_ID_AUTOPILOT_VERSION;
    this.order_map = [0, 2, 3, 4, 5, 8, 9, 10, 6, 7, 1];
    this.crc_extra = 178;
    this.name = 'AUTOPILOT_VERSION';

    this.fieldnames = ['capabilities', 'flight_sw_version', 'middleware_sw_version', 'os_sw_version', 'board_version', 'flight_custom_version', 'middleware_custom_version', 'os_custom_version', 'vendor_id', 'product_id', 'uid'];


    this.set(arguments);

}
        
mavlink.messages.autopilot_version.prototype = new mavlink.message;

mavlink.messages.autopilot_version.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.capabilities, this.uid, this.flight_sw_version, this.middleware_sw_version, this.os_sw_version, this.board_version, this.vendor_id, this.product_id, this.flight_custom_version, this.middleware_custom_version, this.os_custom_version]));
}

/* 
The location of a landing area captured from a downward facing camera

                target_num                : The ID of the target if multiple targets are present (uint8_t)
                frame                     : MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc. (uint8_t)
                angle_x                   : X-axis angular offset (in radians) of the target from the center of the image (float)
                angle_y                   : Y-axis angular offset (in radians) of the target from the center of the image (float)
                distance                  : Distance to the target from the vehicle in meters (float)

*/
mavlink.messages.landing_target = function(target_num, frame, angle_x, angle_y, distance) {

    this.format = '<fffBB';
    this.id = mavlink.MAVLINK_MSG_ID_LANDING_TARGET;
    this.order_map = [3, 4, 0, 1, 2];
    this.crc_extra = 255;
    this.name = 'LANDING_TARGET';

    this.fieldnames = ['target_num', 'frame', 'angle_x', 'angle_y', 'distance'];


    this.set(arguments);

}
        
mavlink.messages.landing_target.prototype = new mavlink.message;

mavlink.messages.landing_target.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.angle_x, this.angle_y, this.distance, this.target_num, this.frame]));
}

/* 
Vibration levels and accelerometer clipping

                time_usec                 : Timestamp (micros since boot or Unix epoch) (uint64_t)
                vibration_x               : Vibration levels on X-axis (float)
                vibration_y               : Vibration levels on Y-axis (float)
                vibration_z               : Vibration levels on Z-axis (float)
                clipping_0                : first accelerometer clipping count (uint32_t)
                clipping_1                : second accelerometer clipping count (uint32_t)
                clipping_2                : third accelerometer clipping count (uint32_t)

*/
mavlink.messages.vibration = function(time_usec, vibration_x, vibration_y, vibration_z, clipping_0, clipping_1, clipping_2) {

    this.format = '<QfffIII';
    this.id = mavlink.MAVLINK_MSG_ID_VIBRATION;
    this.order_map = [0, 1, 2, 3, 4, 5, 6];
    this.crc_extra = 90;
    this.name = 'VIBRATION';

    this.fieldnames = ['time_usec', 'vibration_x', 'vibration_y', 'vibration_z', 'clipping_0', 'clipping_1', 'clipping_2'];


    this.set(arguments);

}
        
mavlink.messages.vibration.prototype = new mavlink.message;

mavlink.messages.vibration.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.vibration_x, this.vibration_y, this.vibration_z, this.clipping_0, this.clipping_1, this.clipping_2]));
}

/* 
Message implementing parts of the V2 payload specs in V1 frames for
transitional support.

                target_network            : Network ID (0 for broadcast) (uint8_t)
                target_system             : System ID (0 for broadcast) (uint8_t)
                target_component          : Component ID (0 for broadcast) (uint8_t)
                message_type              : A code that identifies the software component that understands this message (analogous to usb device classes or mime type strings).  If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/extension-message-ids.xml.  Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. (uint16_t)
                payload                   : Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields.  The entire content of this block is opaque unless you understand any the encoding message_type.  The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. (uint8_t)

*/
mavlink.messages.v2_extension = function(target_network, target_system, target_component, message_type, payload) {

    this.format = '<HBBB249s';
    this.id = mavlink.MAVLINK_MSG_ID_V2_EXTENSION;
    this.order_map = [1, 2, 3, 0, 4];
    this.crc_extra = 8;
    this.name = 'V2_EXTENSION';

    this.fieldnames = ['target_network', 'target_system', 'target_component', 'message_type', 'payload'];


    this.set(arguments);

}
        
mavlink.messages.v2_extension.prototype = new mavlink.message;

mavlink.messages.v2_extension.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.message_type, this.target_network, this.target_system, this.target_component, this.payload]));
}

/* 
Send raw controller memory. The use of this message is discouraged for
normal packets, but a quite efficient way for testing new messages and
getting experimental debug output.

                address                   : Starting address of the debug variables (uint16_t)
                ver                       : Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below (uint8_t)
                type                      : Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 (uint8_t)
                value                     : Memory contents at specified address (int8_t)

*/
mavlink.messages.memory_vect = function(address, ver, type, value) {

    this.format = '<HBB32s';
    this.id = mavlink.MAVLINK_MSG_ID_MEMORY_VECT;
    this.order_map = [0, 1, 2, 3];
    this.crc_extra = 204;
    this.name = 'MEMORY_VECT';

    this.fieldnames = ['address', 'ver', 'type', 'value'];


    this.set(arguments);

}
        
mavlink.messages.memory_vect.prototype = new mavlink.message;

mavlink.messages.memory_vect.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.address, this.ver, this.type, this.value]));
}

/* 


                name                      : Name (char)
                time_usec                 : Timestamp (uint64_t)
                x                         : x (float)
                y                         : y (float)
                z                         : z (float)

*/
mavlink.messages.debug_vect = function(name, time_usec, x, y, z) {

    this.format = '<Qfff10s';
    this.id = mavlink.MAVLINK_MSG_ID_DEBUG_VECT;
    this.order_map = [4, 0, 1, 2, 3];
    this.crc_extra = 49;
    this.name = 'DEBUG_VECT';

    this.fieldnames = ['name', 'time_usec', 'x', 'y', 'z'];


    this.set(arguments);

}
        
mavlink.messages.debug_vect.prototype = new mavlink.message;

mavlink.messages.debug_vect.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_usec, this.x, this.y, this.z, this.name]));
}

/* 
Send a key-value pair as float. The use of this message is discouraged
for normal packets, but a quite efficient way for testing new messages
and getting experimental debug output.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                name                      : Name of the debug variable (char)
                value                     : Floating point value (float)

*/
mavlink.messages.named_value_float = function(time_boot_ms, name, value) {

    this.format = '<If10s';
    this.id = mavlink.MAVLINK_MSG_ID_NAMED_VALUE_FLOAT;
    this.order_map = [0, 2, 1];
    this.crc_extra = 170;
    this.name = 'NAMED_VALUE_FLOAT';

    this.fieldnames = ['time_boot_ms', 'name', 'value'];


    this.set(arguments);

}
        
mavlink.messages.named_value_float.prototype = new mavlink.message;

mavlink.messages.named_value_float.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.value, this.name]));
}

/* 
Send a key-value pair as integer. The use of this message is
discouraged for normal packets, but a quite efficient way for testing
new messages and getting experimental debug output.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                name                      : Name of the debug variable (char)
                value                     : Signed integer value (int32_t)

*/
mavlink.messages.named_value_int = function(time_boot_ms, name, value) {

    this.format = '<Ii10s';
    this.id = mavlink.MAVLINK_MSG_ID_NAMED_VALUE_INT;
    this.order_map = [0, 2, 1];
    this.crc_extra = 44;
    this.name = 'NAMED_VALUE_INT';

    this.fieldnames = ['time_boot_ms', 'name', 'value'];


    this.set(arguments);

}
        
mavlink.messages.named_value_int.prototype = new mavlink.message;

mavlink.messages.named_value_int.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.value, this.name]));
}

/* 
Status text message. These messages are printed in yellow in the COMM
console of QGroundControl. WARNING: They consume quite some bandwidth,
so use only for important status and error messages. If implemented
wisely, these messages are buffered on the MCU and sent only at a
limited rate (e.g. 10 Hz).

                severity                  : Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. (uint8_t)
                text                      : Status text message, without null termination character (char)

*/
mavlink.messages.statustext = function(severity, text) {

    this.format = '<B50s';
    this.id = mavlink.MAVLINK_MSG_ID_STATUSTEXT;
    this.order_map = [0, 1];
    this.crc_extra = 83;
    this.name = 'STATUSTEXT';

    this.fieldnames = ['severity', 'text'];


    this.set(arguments);

}
        
mavlink.messages.statustext.prototype = new mavlink.message;

mavlink.messages.statustext.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.severity, this.text]));
}

/* 
Send a debug value. The index is used to discriminate between values.
These values show up in the plot of QGroundControl as DEBUG N.

                time_boot_ms              : Timestamp (milliseconds since system boot) (uint32_t)
                ind                       : index of debug variable (uint8_t)
                value                     : DEBUG value (float)

*/
mavlink.messages.debug = function(time_boot_ms, ind, value) {

    this.format = '<IfB';
    this.id = mavlink.MAVLINK_MSG_ID_DEBUG;
    this.order_map = [0, 2, 1];
    this.crc_extra = 46;
    this.name = 'DEBUG';

    this.fieldnames = ['time_boot_ms', 'ind', 'value'];


    this.set(arguments);

}
        
mavlink.messages.debug.prototype = new mavlink.message;

mavlink.messages.debug.prototype.pack = function(mav) {
    return mavlink.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.time_boot_ms, this.value, this.ind]));
}



mavlink.map = {
        0: { format: '<IBBBBB', type: mavlink.messages.heartbeat, order_map: [1, 2, 3, 0, 4, 5], crc_extra: 50 },
        1: { format: '<IIIHHhHHHHHHb', type: mavlink.messages.sys_status, order_map: [0, 1, 2, 3, 4, 5, 12, 6, 7, 8, 9, 10, 11], crc_extra: 124 },
        2: { format: '<QI', type: mavlink.messages.system_time, order_map: [0, 1], crc_extra: 137 },
        4: { format: '<QIBB', type: mavlink.messages.ping, order_map: [0, 1, 2, 3], crc_extra: 237 },
        5: { format: '<BBB25s', type: mavlink.messages.change_operator_control, order_map: [0, 1, 2, 3], crc_extra: 217 },
        6: { format: '<BBB', type: mavlink.messages.change_operator_control_ack, order_map: [0, 1, 2], crc_extra: 104 },
        7: { format: '<32s', type: mavlink.messages.auth_key, order_map: [0], crc_extra: 119 },
        11: { format: '<IBB', type: mavlink.messages.set_mode, order_map: [1, 2, 0], crc_extra: 89 },
        20: { format: '<hBB16s', type: mavlink.messages.param_request_read, order_map: [1, 2, 3, 0], crc_extra: 214 },
        21: { format: '<BB', type: mavlink.messages.param_request_list, order_map: [0, 1], crc_extra: 159 },
        22: { format: '<fHH16sB', type: mavlink.messages.param_value, order_map: [3, 0, 4, 1, 2], crc_extra: 220 },
        23: { format: '<fBB16sB', type: mavlink.messages.param_set, order_map: [1, 2, 3, 0, 4], crc_extra: 168 },
        24: { format: '<QiiiHHHHBB', type: mavlink.messages.gps_raw_int, order_map: [0, 8, 1, 2, 3, 4, 5, 6, 7, 9], crc_extra: 24 },
        25: { format: '<B20s20s20s20s20s', type: mavlink.messages.gps_status, order_map: [0, 1, 2, 3, 4, 5], crc_extra: 23 },
        26: { format: '<Ihhhhhhhhh', type: mavlink.messages.scaled_imu, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], crc_extra: 170 },
        27: { format: '<Qhhhhhhhhh', type: mavlink.messages.raw_imu, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], crc_extra: 144 },
        28: { format: '<Qhhhh', type: mavlink.messages.raw_pressure, order_map: [0, 1, 2, 3, 4], crc_extra: 67 },
        29: { format: '<Iffh', type: mavlink.messages.scaled_pressure, order_map: [0, 1, 2, 3], crc_extra: 115 },
        30: { format: '<Iffffff', type: mavlink.messages.attitude, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 39 },
        31: { format: '<Ifffffff', type: mavlink.messages.attitude_quaternion, order_map: [0, 1, 2, 3, 4, 5, 6, 7], crc_extra: 246 },
        32: { format: '<Iffffff', type: mavlink.messages.local_position_ned, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 185 },
        33: { format: '<IiiiihhhH', type: mavlink.messages.global_position_int, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8], crc_extra: 104 },
        34: { format: '<IhhhhhhhhBB', type: mavlink.messages.rc_channels_scaled, order_map: [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10], crc_extra: 237 },
        35: { format: '<IHHHHHHHHBB', type: mavlink.messages.rc_channels_raw, order_map: [0, 9, 1, 2, 3, 4, 5, 6, 7, 8, 10], crc_extra: 244 },
        36: { format: '<IHHHHHHHHB', type: mavlink.messages.servo_output_raw, order_map: [0, 9, 1, 2, 3, 4, 5, 6, 7, 8], crc_extra: 222 },
        37: { format: '<hhBB', type: mavlink.messages.mission_request_partial_list, order_map: [2, 3, 0, 1], crc_extra: 212 },
        38: { format: '<hhBB', type: mavlink.messages.mission_write_partial_list, order_map: [2, 3, 0, 1], crc_extra: 9 },
        39: { format: '<fffffffHHBBBBB', type: mavlink.messages.mission_item, order_map: [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6], crc_extra: 254 },
        40: { format: '<HBB', type: mavlink.messages.mission_request, order_map: [1, 2, 0], crc_extra: 230 },
        41: { format: '<HBB', type: mavlink.messages.mission_set_current, order_map: [1, 2, 0], crc_extra: 28 },
        42: { format: '<H', type: mavlink.messages.mission_current, order_map: [0], crc_extra: 28 },
        43: { format: '<BB', type: mavlink.messages.mission_request_list, order_map: [0, 1], crc_extra: 132 },
        44: { format: '<HBB', type: mavlink.messages.mission_count, order_map: [1, 2, 0], crc_extra: 221 },
        45: { format: '<BB', type: mavlink.messages.mission_clear_all, order_map: [0, 1], crc_extra: 232 },
        46: { format: '<H', type: mavlink.messages.mission_item_reached, order_map: [0], crc_extra: 11 },
        47: { format: '<BBB', type: mavlink.messages.mission_ack, order_map: [0, 1, 2], crc_extra: 153 },
        48: { format: '<iiiB', type: mavlink.messages.set_gps_global_origin, order_map: [3, 0, 1, 2], crc_extra: 41 },
        49: { format: '<iii', type: mavlink.messages.gps_global_origin, order_map: [0, 1, 2], crc_extra: 39 },
        50: { format: '<ffffhBB16sB', type: mavlink.messages.param_map_rc, order_map: [5, 6, 7, 4, 8, 0, 1, 2, 3], crc_extra: 78 },
        54: { format: '<ffffffBBB', type: mavlink.messages.safety_set_allowed_area, order_map: [6, 7, 8, 0, 1, 2, 3, 4, 5], crc_extra: 15 },
        55: { format: '<ffffffB', type: mavlink.messages.safety_allowed_area, order_map: [6, 0, 1, 2, 3, 4, 5], crc_extra: 3 },
        61: { format: '<I4ffff9f', type: mavlink.messages.attitude_quaternion_cov, order_map: [0, 1, 2, 3, 4, 5], crc_extra: 153 },
        62: { format: '<fffffhhH', type: mavlink.messages.nav_controller_output, order_map: [0, 1, 5, 6, 7, 2, 3, 4], crc_extra: 183 },
        63: { format: '<QIiiiifff36fB', type: mavlink.messages.global_position_int_cov, order_map: [1, 0, 10, 2, 3, 4, 5, 6, 7, 8, 9], crc_extra: 51 },
        64: { format: '<QIfffffffff45fB', type: mavlink.messages.local_position_ned_cov, order_map: [1, 0, 12, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], crc_extra: 59 },
        65: { format: '<IHHHHHHHHHHHHHHHHHHBB', type: mavlink.messages.rc_channels, order_map: [0, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20], crc_extra: 118 },
        66: { format: '<HBBBB', type: mavlink.messages.request_data_stream, order_map: [1, 2, 3, 0, 4], crc_extra: 148 },
        67: { format: '<HBB', type: mavlink.messages.data_stream, order_map: [1, 0, 2], crc_extra: 21 },
        69: { format: '<hhhhHB', type: mavlink.messages.manual_control, order_map: [5, 0, 1, 2, 3, 4], crc_extra: 243 },
        70: { format: '<HHHHHHHHBB', type: mavlink.messages.rc_channels_override, order_map: [8, 9, 0, 1, 2, 3, 4, 5, 6, 7], crc_extra: 124 },
        73: { format: '<ffffiifHHBBBBB', type: mavlink.messages.mission_item_int, order_map: [9, 10, 7, 11, 8, 12, 13, 0, 1, 2, 3, 4, 5, 6], crc_extra: 38 },
        74: { format: '<ffffhH', type: mavlink.messages.vfr_hud, order_map: [0, 1, 4, 5, 2, 3], crc_extra: 20 },
        75: { format: '<ffffiifHBBBBB', type: mavlink.messages.command_int, order_map: [8, 9, 10, 7, 11, 12, 0, 1, 2, 3, 4, 5, 6], crc_extra: 158 },
        76: { format: '<fffffffHBBB', type: mavlink.messages.command_long, order_map: [8, 9, 7, 10, 0, 1, 2, 3, 4, 5, 6], crc_extra: 152 },
        77: { format: '<HB', type: mavlink.messages.command_ack, order_map: [0, 1], crc_extra: 143 },
        81: { format: '<IffffBB', type: mavlink.messages.manual_setpoint, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 106 },
        82: { format: '<I4fffffBBB', type: mavlink.messages.set_attitude_target, order_map: [0, 6, 7, 8, 1, 2, 3, 4, 5], crc_extra: 49 },
        83: { format: '<I4fffffB', type: mavlink.messages.attitude_target, order_map: [0, 6, 1, 2, 3, 4, 5], crc_extra: 22 },
        84: { format: '<IfffffffffffHBBB', type: mavlink.messages.set_position_target_local_ned, order_map: [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], crc_extra: 143 },
        85: { format: '<IfffffffffffHB', type: mavlink.messages.position_target_local_ned, order_map: [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], crc_extra: 140 },
        86: { format: '<IiifffffffffHBBB', type: mavlink.messages.set_position_target_global_int, order_map: [0, 13, 14, 15, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], crc_extra: 5 },
        87: { format: '<IiifffffffffHB', type: mavlink.messages.position_target_global_int, order_map: [0, 13, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], crc_extra: 150 },
        89: { format: '<Iffffff', type: mavlink.messages.local_position_ned_system_global_offset, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 231 },
        90: { format: '<Qffffffiiihhhhhh', type: mavlink.messages.hil_state, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], crc_extra: 183 },
        91: { format: '<QffffffffBB', type: mavlink.messages.hil_controls, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], crc_extra: 63 },
        92: { format: '<QHHHHHHHHHHHHB', type: mavlink.messages.hil_rc_inputs_raw, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], crc_extra: 54 },
        100: { format: '<QfffhhBB', type: mavlink.messages.optical_flow, order_map: [0, 6, 4, 5, 1, 2, 7, 3], crc_extra: 175 },
        101: { format: '<Qffffff', type: mavlink.messages.global_vision_position_estimate, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 102 },
        102: { format: '<Qffffff', type: mavlink.messages.vision_position_estimate, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 158 },
        103: { format: '<Qfff', type: mavlink.messages.vision_speed_estimate, order_map: [0, 1, 2, 3], crc_extra: 208 },
        104: { format: '<Qffffff', type: mavlink.messages.vicon_position_estimate, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 56 },
        105: { format: '<QfffffffffffffH', type: mavlink.messages.highres_imu, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], crc_extra: 93 },
        106: { format: '<QIfffffIfhBB', type: mavlink.messages.optical_flow_rad, order_map: [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8], crc_extra: 138 },
        107: { format: '<QfffffffffffffI', type: mavlink.messages.hil_sensor, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], crc_extra: 108 },
        108: { format: '<fffffffffffffffffffff', type: mavlink.messages.sim_state, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], crc_extra: 32 },
        109: { format: '<HHBBBBB', type: mavlink.messages.radio_status, order_map: [2, 3, 4, 5, 6, 0, 1], crc_extra: 185 },
        110: { format: '<BBB251s', type: mavlink.messages.file_transfer_protocol, order_map: [0, 1, 2, 3], crc_extra: 84 },
        111: { format: '<qq', type: mavlink.messages.timesync, order_map: [0, 1], crc_extra: 34 },
        112: { format: '<QI', type: mavlink.messages.camera_trigger, order_map: [0, 1], crc_extra: 174 },
        113: { format: '<QiiiHHHhhhHBB', type: mavlink.messages.hil_gps, order_map: [0, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12], crc_extra: 124 },
        114: { format: '<QIfffffIfhBB', type: mavlink.messages.hil_optical_flow, order_map: [0, 10, 1, 2, 3, 4, 5, 6, 9, 11, 7, 8], crc_extra: 237 },
        115: { format: '<Q4ffffiiihhhHHhhh', type: mavlink.messages.hil_state_quaternion, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], crc_extra: 4 },
        116: { format: '<Ihhhhhhhhh', type: mavlink.messages.scaled_imu2, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], crc_extra: 76 },
        117: { format: '<HHBB', type: mavlink.messages.log_request_list, order_map: [2, 3, 0, 1], crc_extra: 128 },
        118: { format: '<IIHHH', type: mavlink.messages.log_entry, order_map: [2, 3, 4, 0, 1], crc_extra: 56 },
        119: { format: '<IIHBB', type: mavlink.messages.log_request_data, order_map: [3, 4, 2, 0, 1], crc_extra: 116 },
        120: { format: '<IHB90s', type: mavlink.messages.log_data, order_map: [1, 0, 2, 3], crc_extra: 134 },
        121: { format: '<BB', type: mavlink.messages.log_erase, order_map: [0, 1], crc_extra: 237 },
        122: { format: '<BB', type: mavlink.messages.log_request_end, order_map: [0, 1], crc_extra: 203 },
        123: { format: '<BBB110s', type: mavlink.messages.gps_inject_data, order_map: [0, 1, 2, 3], crc_extra: 250 },
        124: { format: '<QiiiIHHHHBBB', type: mavlink.messages.gps2_raw, order_map: [0, 9, 1, 2, 3, 5, 6, 7, 8, 10, 11, 4], crc_extra: 87 },
        125: { format: '<HHH', type: mavlink.messages.power_status, order_map: [0, 1, 2], crc_extra: 203 },
        126: { format: '<IHBBB70s', type: mavlink.messages.serial_control, order_map: [2, 3, 1, 0, 4, 5], crc_extra: 220 },
        127: { format: '<IIiiiIiHBBBBB', type: mavlink.messages.gps_rtk, order_map: [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6], crc_extra: 25 },
        128: { format: '<IIiiiIiHBBBBB', type: mavlink.messages.gps2_rtk, order_map: [0, 8, 7, 1, 9, 10, 11, 12, 2, 3, 4, 5, 6], crc_extra: 226 },
        129: { format: '<Ihhhhhhhhh', type: mavlink.messages.scaled_imu3, order_map: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], crc_extra: 46 },
        130: { format: '<IHHHBBB', type: mavlink.messages.data_transmission_handshake, order_map: [4, 0, 1, 2, 3, 5, 6], crc_extra: 29 },
        131: { format: '<H253s', type: mavlink.messages.encapsulated_data, order_map: [0, 1], crc_extra: 223 },
        132: { format: '<IHHHBBBB', type: mavlink.messages.distance_sensor, order_map: [0, 1, 2, 3, 4, 5, 6, 7], crc_extra: 85 },
        133: { format: '<QiiH', type: mavlink.messages.terrain_request, order_map: [1, 2, 3, 0], crc_extra: 6 },
        134: { format: '<iiH16hB', type: mavlink.messages.terrain_data, order_map: [0, 1, 2, 4, 3], crc_extra: 229 },
        135: { format: '<ii', type: mavlink.messages.terrain_check, order_map: [0, 1], crc_extra: 203 },
        136: { format: '<iiffHHH', type: mavlink.messages.terrain_report, order_map: [0, 1, 4, 2, 3, 5, 6], crc_extra: 1 },
        137: { format: '<Iffh', type: mavlink.messages.scaled_pressure2, order_map: [0, 1, 2, 3], crc_extra: 195 },
        138: { format: '<Q4ffff', type: mavlink.messages.att_pos_mocap, order_map: [0, 1, 2, 3, 4], crc_extra: 109 },
        139: { format: '<Q8fBBB', type: mavlink.messages.set_actuator_control_target, order_map: [0, 2, 3, 4, 1], crc_extra: 168 },
        140: { format: '<Q8fB', type: mavlink.messages.actuator_control_target, order_map: [0, 2, 1], crc_extra: 181 },
        147: { format: '<iih10HhBBBb', type: mavlink.messages.battery_status, order_map: [5, 6, 7, 2, 3, 4, 0, 1, 8], crc_extra: 154 },
        148: { format: '<QQIIIIHH8s8s8s', type: mavlink.messages.autopilot_version, order_map: [0, 2, 3, 4, 5, 8, 9, 10, 6, 7, 1], crc_extra: 178 },
        149: { format: '<fffBB', type: mavlink.messages.landing_target, order_map: [3, 4, 0, 1, 2], crc_extra: 255 },
        241: { format: '<QfffIII', type: mavlink.messages.vibration, order_map: [0, 1, 2, 3, 4, 5, 6], crc_extra: 90 },
        248: { format: '<HBBB249s', type: mavlink.messages.v2_extension, order_map: [1, 2, 3, 0, 4], crc_extra: 8 },
        249: { format: '<HBB32s', type: mavlink.messages.memory_vect, order_map: [0, 1, 2, 3], crc_extra: 204 },
        250: { format: '<Qfff10s', type: mavlink.messages.debug_vect, order_map: [4, 0, 1, 2, 3], crc_extra: 49 },
        251: { format: '<If10s', type: mavlink.messages.named_value_float, order_map: [0, 2, 1], crc_extra: 170 },
        252: { format: '<Ii10s', type: mavlink.messages.named_value_int, order_map: [0, 2, 1], crc_extra: 44 },
        253: { format: '<B50s', type: mavlink.messages.statustext, order_map: [0, 1], crc_extra: 83 },
        254: { format: '<IfB', type: mavlink.messages.debug, order_map: [0, 2, 1], crc_extra: 46 },
}


// Special mavlink message to capture malformed data packets for debugging
mavlink.messages.bad_data = function(data, reason) {
    this.id = mavlink.MAVLINK_MSG_ID_BAD_DATA;
    this.data = data;
    this.reason = reason;
    this.msgbuf = data;
}

/* MAVLink protocol handling class */
MAVLink = function(logger, srcSystem, srcComponent) {

    this.logger = logger;

    this.seq = 0;
    this.buf = new Buffer(0);
    this.bufInError = new Buffer(0);
   
    this.srcSystem = (typeof srcSystem === 'undefined') ? 0 : srcSystem;
    this.srcComponent =  (typeof srcComponent === 'undefined') ? 0 : srcComponent;

    // The first packet we expect is a valid header, 6 bytes.
    this.expected_length = 6;

    this.have_prefix_error = false;

    this.protocol_marker = 254;
    this.little_endian = true;

    this.crc_extra = true;
    this.sort_fields = true;
    this.total_packets_sent = 0;
    this.total_bytes_sent = 0;
    this.total_packets_received = 0;
    this.total_bytes_received = 0;
    this.total_receive_errors = 0;
    this.startup_time = Date.now();
    
}

// Implements EventEmitter
util.inherits(MAVLink, events.EventEmitter);

// If the logger exists, this function will add a message to it.
// Assumes the logger is a winston object.
MAVLink.prototype.log = function(message) {
    if(this.logger) {
        this.logger.info(message);
    }
}

MAVLink.prototype.log = function(level, message) {
    if(this.logger) {
        this.logger.log(level, message);
    }
}

MAVLink.prototype.send = function(mavmsg) {
    buf = mavmsg.pack(this);
    this.file.write(buf);
    this.seq = (this.seq + 1) % 256;
    this.total_packets_sent +=1;
    this.total_bytes_sent += buf.length;
}

// return number of bytes needed for next parsing stage
MAVLink.prototype.bytes_needed = function() {
    ret = this.expected_length - this.buf.length;
    return ( ret <= 0 ) ? 1 : ret;
}

// add data to the local buffer
MAVLink.prototype.pushBuffer = function(data) {
    if(data) {
        this.buf = Buffer.concat([this.buf, data]);
        this.total_bytes_received += data.length;
    }
}

// Decode prefix.  Elides the prefix.
MAVLink.prototype.parsePrefix = function() {

    // Test for a message prefix.
    if( this.buf.length >= 1 && this.buf[0] != 254 ) {

        // Strip the offending initial byte and throw an error.
        var badPrefix = this.buf[0];
        this.bufInError = this.buf.slice(0,1);
        this.buf = this.buf.slice(1);
        this.expected_length = 6;

        // TODO: enable subsequent prefix error suppression if robust_parsing is implemented
        //if(!this.have_prefix_error) {
        //    this.have_prefix_error = true;
            throw new Error("Bad prefix ("+badPrefix+")");
        //}

    }
    //else if( this.buf.length >= 1 && this.buf[0] == 254 ) {
    //    this.have_prefix_error = false;
    //}

}

// Determine the length.  Leaves buffer untouched.
MAVLink.prototype.parseLength = function() {
    
    if( this.buf.length >= 2 ) {
        var unpacked = jspack.Unpack('BB', this.buf.slice(0, 2));
        this.expected_length = unpacked[1] + 8; // length of message + header + CRC
    }

}

// input some data bytes, possibly returning a new message
MAVLink.prototype.parseChar = function(c) {

    var m = null;

    try {

        this.pushBuffer(c);
        this.parsePrefix();
        this.parseLength();
        m = this.parsePayload();

    } catch(e) {

        this.log('error', e.message);
        this.total_receive_errors += 1;
        m = new mavlink.messages.bad_data(this.bufInError, e.message);
        this.bufInError = new Buffer(0);
        
    }

    if(null != m) {
        this.emit(m.name, m);
        this.emit('message', m);
    }

    return m;

}

MAVLink.prototype.parsePayload = function() {

    var m = null;

    // If we have enough bytes to try and read it, read it.
    if( this.expected_length >= 8 && this.buf.length >= this.expected_length ) {

        // Slice off the expected packet length, reset expectation to be to find a header.
        var mbuf = this.buf.slice(0, this.expected_length);
        // TODO: slicing off the buffer should depend on the error produced by the decode() function
        // - if a message we find a well formed message, cut-off the expected_length
        // - if the message is not well formed (correct prefix by accident), cut-off 1 char only
        this.buf = this.buf.slice(this.expected_length);
        this.expected_length = 6;

        // w.info("Attempting to parse packet, message candidate buffer is ["+mbuf.toByteArray()+"]");

        try {
            m = this.decode(mbuf);
            this.total_packets_received += 1;
        }
        catch(e) {
            // Set buffer in question and re-throw to generic error handling
            this.bufInError = mbuf;
            throw e;
        }
    }

    return m;

}

// input some data bytes, possibly returning an array of new messages
MAVLink.prototype.parseBuffer = function(s) {
    
    // Get a message, if one is available in the stream.
    var m = this.parseChar(s);

    // No messages available, bail.
    if ( null === m ) {
        return null;
    }
    
    // While more valid messages can be read from the existing buffer, add
    // them to the array of new messages and return them.
    var ret = [m];
    while(true) {
        m = this.parseChar();
        if ( null === m ) {
            // No more messages left.
            return ret;
        }
        ret.push(m);
    }
    return ret;

}

/* decode a buffer as a MAVLink message */
MAVLink.prototype.decode = function(msgbuf) {

    var magic, mlen, seq, srcSystem, srcComponent, unpacked, msgId;

    // decode the header
    try {
        unpacked = jspack.Unpack('cBBBBB', msgbuf.slice(0, 6));
        magic = unpacked[0];
        mlen = unpacked[1];
        seq = unpacked[2];
        srcSystem = unpacked[3];
        srcComponent = unpacked[4];
        msgId = unpacked[5];
    }
    catch(e) {
        throw new Error('Unable to unpack MAVLink header: ' + e.message);
    }

    if (magic.charCodeAt(0) != 254) {
        throw new Error("Invalid MAVLink prefix ("+magic.charCodeAt(0)+")");
    }

    if( mlen != msgbuf.length - 8 ) {
        throw new Error("Invalid MAVLink message length.  Got " + (msgbuf.length - 8) + " expected " + mlen + ", msgId=" + msgId);
    }

    if( false === _.has(mavlink.map, msgId) ) {
        throw new Error("Unknown MAVLink message ID (" + msgId + ")");
    }

    // decode the payload
    // refs: (fmt, type, order_map, crc_extra) = mavlink.map[msgId]
    var decoder = mavlink.map[msgId];

    // decode the checksum
    try {
        var receivedChecksum = jspack.Unpack('<H', msgbuf.slice(msgbuf.length - 2));
    } catch (e) {
        throw new Error("Unable to unpack MAVLink CRC: " + e.message);
    }

    var messageChecksum = mavlink.x25Crc(msgbuf.slice(1, msgbuf.length - 2));

    // Assuming using crc_extra = True.  See the message.prototype.pack() function.
    messageChecksum = mavlink.x25Crc([decoder.crc_extra], messageChecksum);
    
    if ( receivedChecksum != messageChecksum ) {
        throw new Error('invalid MAVLink CRC in msgID ' +msgId+ ', got 0x' + receivedChecksum + ' checksum, calculated payload checkum as 0x'+messageChecksum );
    }

    // Decode the payload and reorder the fields to match the order map.
    try {
        var t = jspack.Unpack(decoder.format, msgbuf.slice(6, msgbuf.length));
    }
    catch (e) {
        throw new Error('Unable to unpack MAVLink payload type='+decoder.type+' format='+decoder.format+' payloadLength='+ msgbuf.slice(6, -2).length +': '+ e.message);
    }

    // Reorder the fields to match the order map
    var args = [];
    _.each(t, function(e, i, l) {
        args[i] = t[decoder.order_map[i]]
    });

    // construct the message object
    try {
        var m = new decoder.type(args);
        m.set.call(m, args);
    }
    catch (e) {
        throw new Error('Unable to instantiate MAVLink message of type '+decoder.type+' : ' + e.message);
    }
    m.msgbuf = msgbuf;
    m.payload = msgbuf.slice(6);
    m.crc = receivedChecksum;
    m.header = new mavlink.header(msgId, mlen, seq, srcSystem, srcComponent);
    this.log(m);
    return m;
}


// Expose this code as a module
module.exports = mavlink;

