diff --git a/assets/mavFlightMode.js b/assets/mavFlightMode.js index 111a195..0be5e2c 100644 --- a/assets/mavFlightMode.js +++ b/assets/mavFlightMode.js @@ -86,9 +86,9 @@ MavFlightMode.prototype.attachHandlers = function(sysid,mavlink,mavlinkParser,st // else ignore data for other sysids than the one we are interested in. - if ( heartbeat.header.srcSystem != sysid ) return; + if ( heartbeat._header.srcSystem != sysid ) return; - //console.log('zzzzzzzzzzzzzzzzzzzz'+heartbeat.header.srcSystem); + //console.log('zzzzzzzzzzzzzzzzzzzz'+heartbeat._header.srcSystem); //console.log('xxxxxxxxxxxxxxxxxxxx'+sysid); //console.log(`custom mode: ${heartbeat.custom_mode}`); //console.log(`base mode: ${heartbeat.base_mode}`); @@ -102,8 +102,17 @@ MavFlightMode.prototype.attachHandlers = function(sysid,mavlink,mavlinkParser,st // Translate the bitfields for use in the client. - // arduplane uses packet.custom_mode to index into mode_mapping_apm - TODO copter uses acm - newState.mode = mode_mapping_apm[heartbeat.custom_mode]; + + //copter or plane or something else? + if (heartbeat.type == mavlink20.MAV_TYPE_FIXED_WING ) { + // arduplane uses packet.custom_mode to index into mode_mapping_apm + newState.mode = mode_mapping_apm[heartbeat.custom_mode]; + } + if (heartbeat.type == mavlink20.MAV_TYPE_QUADROTOR ) { + // arducopter uses packet.custom_mode to index into mode_mapping_acm + newState.mode = mode_mapping_acm[heartbeat.custom_mode]; + } + //console.log("ardumode:"+newState.mode); newState.armed = ( mavlink.MAV_MODE_FLAG_SAFETY_ARMED & heartbeat.base_mode ) ? true : false; diff --git a/local_modules/README.md b/local_modules/README.md new file mode 100644 index 0000000..76643a5 --- /dev/null +++ b/local_modules/README.md @@ -0,0 +1,6 @@ +This folder is a locally modified copy of some Node/npm packages 'jspack' and 'long'. we have copied them here and tweaked them to be compatible with our needs, please see their respective README.md file for their original info, which we have not changed. + +This README.md serves to make you aware that these two packages as stored here in the 'jspack' and 'long' folders ARE MODIFIED from the originals. +By placing this statement here, and putting a notice in long.js as well, we feel are in compliance with the LICENSE file of 'long' , wich requires us to tell you they are modified. + +We have included their original license files, in compliance with them, as both license/s permit distribution of derived works in source and/or binary form. diff --git a/local_modules/jspack/.npmignore b/local_modules/jspack/.npmignore new file mode 100644 index 0000000..be1ea81 --- /dev/null +++ b/local_modules/jspack/.npmignore @@ -0,0 +1,19 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.pyc + +pids +logs +results + +npm-debug.log +node_modules + +**~ +**.swp diff --git a/local_modules/jspack/LICENSE b/local_modules/jspack/LICENSE new file mode 100644 index 0000000..d646dd7 --- /dev/null +++ b/local_modules/jspack/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2008, Fair Oaks Labs, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + + * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors may be + used to endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/local_modules/jspack/README.md b/local_modules/jspack/README.md new file mode 100644 index 0000000..2a6e6ef --- /dev/null +++ b/local_modules/jspack/README.md @@ -0,0 +1,147 @@ +jspack - library to pack primitives to octet arrays +==================================================== + +[![Build status](https://travis-ci.org/birchroad/node-jspack.svg?branch=master)](https://travis-ci.org/birchroad/node-jspack) + +## Disclaimer +The jspack module and documentation are essentially ports of the +Python struct module and documentation, with such changes as were necessary. The port was originaly made by Fair Oaks Labs, Inc. and published at http://code.google.com/p/jspack/ +If any Python people are miffed that their documentation got ripped off, let me know, +and I'll gladly revise them. + +This module performs conversions between JavaScript values and C structs +represented as octet arrays (i.e. JavaScript arrays of integral numbers +between 0 and 255, inclusive). It uses format strings (explained below) as +compact descriptions of the layout of the C structs and the intended conversion +to/from JavaScript values. This can be used to handle binary data stored in +files, or received from network connections or other sources. + +## Install + npm install jspack + +## Reference + +The module defines the following functions: + +### Unpack(fmt, a, p) +Return an array containing values unpacked from the octet array a, +beginning at position p, according to the supplied format string. If there +are more octets in a than required by the format string, the excess is +ignored. If there are fewer octets than required, Unpack() will return +undefined. If no value is supplied for the p argument, zero is assumed. + +### PackTo(fmt, a, p, values) +Pack and store the values array into the supplied octet array a, beginning +at position p. If there are more values supplied than are specified in the +format string, the excess is ignored. If there are fewer values supplied, +PackTo() will return false. If there is insufficient space in a to store +the packed values, PackTo() will return false. On success, PackTo() returns +the a argument. If any value is of an inappropriate type, the results are +undefined. + +### Pack(fmt, values) +Return an octet array containing the packed values array. If there are +more values supplied than are specified in the format string, the excess is +ignored. If there are fewer values supplied, Pack() will return false. If +any value is of an inappropriate type, the results are undefined. + +### CalcLength(fmt) +Return the number of octets required to store the given format string. + + +## Formats +Format characters have the following meanings; the conversion between C and +JavaScript values should be obvious given their types: + + Format | C Type | JavaScript Type | Size (octets) | Notes + ------------------------------------------------------------------- + A | char[] | Array | Length | (1) + x | pad byte | N/A | 1 | + c | char | string (length 1) | 1 | (2) + b | signed char | number | 1 | (3) + B | unsigned char | number | 1 | (3) + h | signed short | number | 2 | (3) + H | unsigned short | number | 2 | (3) + i | signed int | number | 4 | (3) + I | unsigned int | number | 4 | (3) + l | signed long | number | 4 | (3) + L | unsigned long | number | 4 | (3) + q | signed long | number | 8 | (6) + Q | unsigned long | number | 8 | (6) + s | char[] | string | Length | (2) + f | float | number | 4 | (4) + d | double | number | 8 | (5) + +*Notes:* + + **(1)** The "A" code simply returns a slice of the source octet array. This is + primarily useful when a data structure contains bytes which are subject to + multiple intepretations (e.g. unions), and the data structure is being + decoded in multiple passes. + + **(2)** The "c" and "s" codes handle strings with codepoints between 0 and 255, + inclusive. The data are not bounds-checked, so strings containing characters + with codepoints outside this range will encode to "octet" arrays that contain + values outside the range of an octet. Furthermore, since these codes decode + octet arrays by assuming the octets represent UNICODE codepoints, they may + not "correctly" decode bytes in the range 128-255, since that range is subject + to multiple interpretations. Caveat coder! + + **(3)** The 8 "integer" codes clip their encoded values to the minima and maxmima + of their respective types: If you invoke Struct.Pack('b', [-129]), for + instance, the result will be [128], which is the octet encoding of -128, + which is the minima of a signed char. Similarly, Struct.Pack('h', [-32769]) + returns [128, 0]. Fractions are truncated. + + **(4)** Since JavaScript doesn't natively support 32-bit floats, whenever a float + is stored, the source JavaScript number must be rounded. This module applies + correct rounding during this process. Numbers with magnitude greater than or + equal to 2^128-2^103 round to either positive or negative Infinity. The + rounding algorithm assumes that JavsScript is using exactly 64 bits of + floating point precision; 128-bit floating point will result in subtle errors. + + **(5)** This module assumes that JavaScript is using 64 bits of floating point + precision, so the "d" code performs no rounding. 128-bit floating point will + cause the "d" code to simply truncate significands to 52 bits. + + **(6)** Since 64bit longs cannot be represented by numbers JavaScript, this version of + jspack will process longs as arrays in the form: ```[lowBits, hightBits]```. The + decoded long array contains a third element, the unsigned flag, which is ```false``` for signed + and ```true``` for unsigned values. + This representation is similar to what [Long.js](https://github.com/dcodeIO/Long.js), and + therefore the [Google Closure Libaray](https://github.com/google/closure-library), uses. + See [test/int64.js](test/int64.js) for examples how to work with Long.js. + +A format character may be preceded by an integral repeat count. For example, +the format string "4h" means exactly the same thing as "hhhh". + +Whitespace characters between formats are ignored; a count and its format must +not be separated by whitespace, however. + +For the "A" format character, the count is interpreted as the size of the +array, not a repeat count as for the other format characters; for example, "10A" +means a single 10-octet array. When packing, the Array is truncated or padded +with 0 bytes as appropriate to make it conform to the specified length. When +unpacking, the resulting Array always has exactly the specified number of bytes. +As a special case, "0A" means a single, empty Array. + +For the "s" format character, the count is interpreted as the size of the +string, not a repeat count as for the other format characters; for example, +"10s" means a single 10-byte string, while "10c" means 10 characters. When +packing, the string is truncated or padded with 0 bytes as appropriate to make +it conform to the specified length. When unpacking, the resulting string always +has exactly the specified number of bytes. As a special case, "0s" means a +single, empty string (while "0c" means 0 characters). + + +By default, C numbers are represented in network (or big-endian) byte order. +Alternatively, the first character of the format string can be used to indicate +byte order of the packed data, according to the following table: + + Character | Byte Order + ---------------------------------- + < | little-endian + > | big-endian + ! | network (= big-endian) + +If the first character is not one of these, "!" is assumed. diff --git a/local_modules/jspack/jspack.js b/local_modules/jspack/jspack.js new file mode 100644 index 0000000..02e3768 --- /dev/null +++ b/local_modules/jspack/jspack.js @@ -0,0 +1,890 @@ +/** + * @license + + Copyright © 2008 Fair Oaks Labs, Inc. + All rights reserved. + + This file is Modified from the original, by buzz 2020: + - ran thru http://www.jsnice.org/ and manually renamed the variables to be clearer + - added optionally enabled debugging/verbose/printfs throughout + - bugfixes and integration so it now passes our mavlink.js testsuite/s + - please see README.md in the upper level folder. +*/ +'use strict'; + +var Long = require('long'); + +let DEBUG = false; + +/** + * @return {undefined} + */ +function JSPack() { + var el; + /** @type {boolean} */ + var booleanIsBigEndian = false; + var m = this; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @param {number} len + * @return {?} + */ + //Raw byte arrays + // m._DeArray = function(octet_array_a, offset_p, len) { + // if (DEBUG) console.log("zzz1"); + // return [octet_array_a.slice(offset_p, offset_p + len)]; + //}; + + /** + * @param {!Array} to_octet_array_a + * @param {number} offset_p + * @param {number} len + * @param {!NodeList} from_array_v + * @return {undefined} + */ + // m._EnArray = function(to_octet_array_a, offset_p, len, from_array_v) { + // if (DEBUG) console.log("zzz2"); + /** @type {number} */ + // var i = 0; + // for (; i < len; to_octet_array_a[offset_p + i] = from_array_v[i] ? from_array_v[i] : 0, i++) { + // } + //}; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + // ASCII characters + m._DeChar = function(octet_array_a, offset_p) { + if (DEBUG) console.log("zzz3"); + return String.fromCharCode(octet_array_a[offset_p]); + }; + /** + * @param {!Array} to_octet_array_a + * @param {number} offset_p + * @param {string} from_str_array_v + * @return {undefined} + */ + // m._EnChar = function(to_octet_array_a, offset_p, from_str_array_v) { + // if (DEBUG) console.log("zzz4"); + // /** @type {number} */ + // to_octet_array_a[offset_p] = from_str_array_v.charCodeAt(0); + // }; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + //Little-endian (un)signed N-byte integers + m._DeInt = function(octet_array_a, offset_p) { + if (DEBUG) console.log("zzz5"); + /** @type {number} */ + var lsb = booleanIsBigEndian ? el.len - 1 : 0; + /** @type {number} */ + var nsb = booleanIsBigEndian ? -1 : 1; + /** @type {number} */ + var stop = lsb + nsb * el.len; + var rv; + var i; + var f; + /** @type {number} */ + rv = 0; + /** @type {number} */ + i = lsb; + /** @type {number} */ + f = 1; + for (; i != stop; rv = rv + octet_array_a[offset_p + i] * f, i = i + nsb, f = f * 256) { + } + if (el.bSigned && rv & Math.pow(2, el.len * 8 - 1)) { + /** @type {number} */ + rv = rv - Math.pow(2, el.len * 8); + } + return rv; + }; + + + /** + * @param {!Array} octet_array_a + * @param {number} offset_p + * @param {number} val + * @return {undefined} + */ + m._EnInt = function(octet_array_a, offset_p, val) { + if (DEBUG) console.log("chunk-from: "+val); + /** @type {number} */ + var lsb = booleanIsBigEndian ? el.len - 1 : 0; + /** @type {number} */ + var nsb = booleanIsBigEndian ? -1 : 1; + /** @type {number} */ + var stop = lsb + nsb * el.len; + var i; + // range limit: + if (val < el.min ) { + val = el.min; + console.log("value limited to MIN:"+val); + } + if (val > el.max ) { + val = el.max; + console.log("value limited to MAX:"+val); + } + /** @type {number} */ + i = lsb; + if (DEBUG) console.log("booleanIsBigEndian:"+booleanIsBigEndian); + if (DEBUG) console.log("el.len:"+el.len); + if (DEBUG) console.log("lsb:"+lsb); + if (DEBUG) console.log("nsb:"+nsb); + if (DEBUG) console.log("i:"+i); + if (DEBUG) console.log("stop:"+stop); + for (; i != stop; ) { + + var to = JSON.stringify(val&255); + if (DEBUG) console.log("chunk as bytes: "+to); + + octet_array_a[offset_p + i] = val & 255; + i = i + nsb; + val = val >> 8; + + + } + }; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @param {number} len + * @return {?} + */ + // ASCII character strings + m._DeString = function(octet_array_a, offset_p, len) { + if (DEBUG) console.log("zzz7"); + /** @type {!Array} */ + var retval = new Array(len); + /** @type {number} */ + var i = 0; + for (; i < len; retval[i] = String.fromCharCode(octet_array_a[offset_p + i]), i++) { + } + return retval.join(""); + }; + /** + * @param {!Array} octet_array_a + * @param {number} offset_p + * @param {number} len + * @param {string} strval + * @return {undefined} + */ + m._EnString = function(octet_array_a, offset_p, len, strval) { + if (DEBUG) console.log("zzz8"); + var t; + /** @type {number} */ + if ( DEBUG ) console.log("strencode before: "+octet_array_a+"\np:"+offset_p+" len:"+len+" strval:"+strval) + var i = 0; + //if (DEBUG) console.log("strval:"+strval); +//console.trace("Here I am!") + + // we all strings to be passed in as a string of characters, or a an array or buffer of them is ok too + + if (typeof strval.charCodeAt === "function") { + for (; i < len; octet_array_a[offset_p + i] = (t = strval.charCodeAt(i)) ? t : 0, i++) { + if ( t > 255 ) console.log("ERROR ERROR ERROR ERROR ERROR ERROR - It seems u passed unicode/utf-8/etc to jspack, not 8 bit ascii. please use .toString('binary'); not .toString();"); + } + if ( DEBUG ) console.log("strencode from CHAR-string."); + + } else if (Array.isArray(strval)) { + for (; i < len; octet_array_a[offset_p + i] = (t = strval[i]) ? t : 0, i++) { + // referring directly to 't' inside this loop is bad, seems delayed by an iteration, but strval[i] is ok. + if ( strval[i] > 255 ) console.log("ERROR ERROR ERROR ERROR ERROR ERROR - It seems u passed unicode/utf-8/etc, or array data with values > 255, to jspack, not 8 bit ascii.\n(bad Array data)"+strval[i]); + } + if ( DEBUG ) console.log("strencode from ARRAY."); + + } else if (Buffer.isBuffer(strval)) { + for (; i < len; octet_array_a[offset_p + i] = (t = strval[i]) ? t : 0, i++) { + if ( strval[i] > 255 ) console.log("ERROR ERROR ERROR ERROR ERROR ERROR - It seems u passed unicode/utf-8/etc to jspack, not 8 bit ascii. \n(bad Buffer data)"+strval[i]); + } + if ( DEBUG ) console.log("strencode from Buffer."); + + } else { + console.log("ERROR encoding string _EnString: array:"+octet_array_a+" p:"+offset_p+" len:"+len+" strval:"+JSON.stringify(strval)) +} + }; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + // Little-endian N-bit IEEE 754 floating point + m._De754 = function(octet_array_a, offset_p) { + if (DEBUG) console.log("zzz9"); + var bool_s; + var exponent; + var mantissa; + var i; + var d; + var nBits; + var mantissaLen; + var exponentLen; + var eBias; + var eMax; + mantissaLen = el.mLen; + /** @type {number} */ + exponentLen = el.len * 8 - el.mLen - 1; + /** @type {number} */ + eMax = (1 << exponentLen) - 1; + /** @type {number} */ + eBias = eMax >> 1; + /** @type {number} */ + i = booleanIsBigEndian ? 0 : el.len - 1; + /** @type {number} */ + d = booleanIsBigEndian ? 1 : -1; + bool_s = octet_array_a[offset_p + i]; + /** @type {number} */ + i = i + d; + /** @type {number} */ + nBits = -7; + /** @type {number} */ + exponent = bool_s & (1 << -nBits) - 1; + /** @type {number} */ + bool_s = bool_s >> -nBits; + /** @type {number} */ + nBits = nBits + exponentLen; + for (; nBits > 0; exponent = exponent * 256 + octet_array_a[offset_p + i], i = i + d, nBits = nBits - 8) { + } + /** @type {number} */ + mantissa = exponent & (1 << -nBits) - 1; + /** @type {number} */ + exponent = exponent >> -nBits; + nBits = nBits + mantissaLen; + for (; nBits > 0; mantissa = mantissa * 256 + octet_array_a[offset_p + i], i = i + d, nBits = nBits - 8) { + } + switch(exponent) { + case 0: + /** @type {number} */ + // Zero, or denormalized number + exponent = 1 - eBias; + break; + case eMax: + // NaN, or +/-Infinity + return mantissa ? NaN : (bool_s ? -1 : 1) * Infinity; + default: + // Normalized number + mantissa = mantissa + Math.pow(2, mantissaLen); + /** @type {number} */ + exponent = exponent - eBias; + break; + } + return (bool_s ? -1 : 1) * mantissa * Math.pow(2, exponent - mantissaLen); + }; + /** + * @param {!Array} octet_array_a + * @param {number} offset_p + * @param {number} v + * @return {undefined} + */ + m._En754 = function(octet_array_a, offset_p, v) { + if (DEBUG) console.log("zzz_10"); + var bool_s; + var exponent; + var mantissa; + var i; + var d; + var c; + var mantissaLen; + var exponentLen; + var eBias; + var eMax; + mantissaLen = el.mLen; + /** @type {number} */ + exponentLen = el.len * 8 - el.mLen - 1; + /** @type {number} */ + eMax = (1 << exponentLen) - 1; + /** @type {number} */ + eBias = eMax >> 1; + /** @type {number} */ + bool_s = v < 0 ? 1 : 0; + /** @type {number} */ + v = Math.abs(v); + if (isNaN(v) || v == Infinity) { + /** @type {number} */ + mantissa = isNaN(v) ? 1 : 0; + /** @type {number} */ + exponent = eMax; + } else { + /** @type {number} */ + exponent = Math.floor(Math.log(v) / Math.LN2);// Calculate log2 of the value + if (v * (c = Math.pow(2, -exponent)) < 1) { // Math.log() isn't 100% reliable + exponent--; + /** @type {number} */ + c = c * 2; + } + // Round by adding 1/2 the significand's LSD + if (exponent + eBias >= 1) { + /** @type {number} */ + v = v + el.rt / c; // Normalized: mLen significand digits + } else { + /** @type {number} */ + v = v + el.rt * Math.pow(2, 1 - eBias);// Denormalized: <= mLen significand digits + } + if (v * c >= 2) { + exponent++; + /** @type {number} */ + c = c / 2; // Rounding can increment the exponent + } + if (exponent + eBias >= eMax) { + // Overflow + /** @type {number} */ + mantissa = 0; + /** @type {number} */ + exponent = eMax; + } else { + if (exponent + eBias >= 1) { + // Normalized - term order matters, as Math.pow(2, 52-e) and v*Math.pow(2, 52) can overflow + /** @type {number} */ + mantissa = (v * c - 1) * Math.pow(2, mantissaLen); + /** @type {number} */ + exponent = exponent + eBias; + } else { + // Denormalized - also catches the '0' case, somewhat by chance + /** @type {number} */ + mantissa = v * Math.pow(2, eBias - 1) * Math.pow(2, mantissaLen); + /** @type {number} */ + exponent = 0; + } + } + } + /** @type {number} */ + i = booleanIsBigEndian ? el.len - 1 : 0; + /** @type {number} */ + d = booleanIsBigEndian ? -1 : 1; + for (; mantissaLen >= 8; octet_array_a[offset_p + i] = mantissa & 255, i = i + d, mantissa = mantissa / 256, mantissaLen = mantissaLen - 8) { + } + /** @type {number} */ + exponent = exponent << mantissaLen | mantissa; + exponentLen = exponentLen + mantissaLen; + for (; exponentLen > 0; octet_array_a[offset_p + i] = exponent & 255, i = i + d, exponent = exponent / 256, exponentLen = exponentLen - 8) { + } + octet_array_a[offset_p + i - d] |= bool_s * 128; + }; + + + /** + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + // Convert int64 to array with 3 elements: [lowBits, highBits, unsignedFlag] + // '>>>' trick to convert signed 32bit int to unsigned int (because << always results in a signed 32bit int) + m._DeInt64 = function(octet_array_a, offset_p) { + if (DEBUG) console.log("zzz_11"); + /** @type {number} */ + var lsb = booleanIsBigEndian ? 0 : 7; + /** @type {number} */ + var nsb = booleanIsBigEndian ? 1 : -1; + /** @type {number} */ + var stop = lsb + nsb * 8; + /** @type {!Array} */ + var nextIdLookup = [0, 0, !el.bSigned]; + var i; + var f; + var indexLookupKey; + /** @type {number} */ + i = lsb; + /** @type {number} */ + indexLookupKey = 1; + /** @type {number} */ + f = 0; + for (; i != stop; nextIdLookup[indexLookupKey] = (nextIdLookup[indexLookupKey] << 8 >>> 0) + octet_array_a[offset_p + i], i = i + nsb, f++, indexLookupKey = f < 4 ? 1 : 0) { + + if ( DEBUG ) console.log("jsPacking int64:"+octet_array_a[offset_p + i]); + + } + return nextIdLookup; + }; + /** + * @param {!Array} octet_array_a + * @param {number} offset_p + * @param {!Object} v + * @return {undefined} + */ + m._EnInt64 = function(octet_array_a, offset_p, v) { + + if (v.length != 2) { //todo put this error back + console.log("ERROR ERROR: jspack needs an array of at least length TWO to pack an int64 "+v+' len:'+v.length); + } +// if (DEBUG) console.log("zzz_12 v:"+v); + /** @type {number} */ + var lsb = booleanIsBigEndian ? 0 : 7; + /** @type {number} */ + var nsb = booleanIsBigEndian ? 1 : -1; + /** @type {number} */ + var stop = lsb + nsb * 8; + var i; + var f; + var j; + var shift; + /** @type {number} */ + i = lsb; + /** @type {number} */ + j = 1; + /** @type {number} */ + f = 0; + /** @type {number} */ + shift = 24; + + for (; i != stop; octet_array_a[offset_p + i] = v[j] >> shift & 255, i = i + nsb, f++, j = f < 4 ? 1 : 0, shift = 24 - 8 * (f % 4)) { + var x = v[j] >> shift & 255 ; + var vj = v[j]; + + if ( DEBUG ) console.log('js qqqq vj:'+vj+' j:'+j+' x:'+x+' a:'+octet_array_a+' i:'+i+" offset_p:"+offset_p+" v:"+v); + } + }; + + + + // Class data + /** @type {string} */ + m._sPattern = "(\\d+)?([AxcbBhHsfdiIlLqQ])"; + + m._lenLut = {'A':1, 'x':1, 'c':1, 'b':1, 'B':1, 'h':2, 'H':2, 's':1, 'f':4, 'd':8, 'i':4, 'I':4, 'l':4, 'L':4, 'q':8, 'Q':8}; + + m._elLookUpTable = { 'A': {en:m._EnArray, de:m._DeArray}, + 's': {en:m._EnString, de:m._DeString}, + 'c': {en:m._EnChar, de:m._DeChar}, + 'b': {en:m._EnInt, de:m._DeInt, len:1, bSigned:true, min:-Math.pow(2, 7), max:Math.pow(2, 7)-1}, + 'B': {en:m._EnInt, de:m._DeInt, len:1, bSigned:false, min:0, max:Math.pow(2, 8)-1}, + 'h': {en:m._EnInt, de:m._DeInt, len:2, bSigned:true, min:-Math.pow(2, 15), max:Math.pow(2, 15)-1}, + 'H': {en:m._EnInt, de:m._DeInt, len:2, bSigned:false, min:0, max:Math.pow(2, 16)-1}, + 'i': {en:m._EnInt, de:m._DeInt, len:4, bSigned:true, min:-Math.pow(2, 31), max:Math.pow(2, 31)-1}, + 'I': {en:m._EnInt, de:m._DeInt, len:4, bSigned:false, min:0, max:Math.pow(2, 32)-1}, + 'l': {en:m._EnInt, de:m._DeInt, len:4, bSigned:true, min:-Math.pow(2, 31), max:Math.pow(2, 31)-1}, + 'L': {en:m._EnInt, de:m._DeInt, len:4, bSigned:false, min:0, max:Math.pow(2, 32)-1}, + 'f': {en:m._En754, de:m._De754, len:4, mLen:23, rt:Math.pow(2, -24)-Math.pow(2, -77)}, + 'd': {en:m._En754, de:m._De754, len:8, mLen:52, rt:0}, + 'q': {en:m._EnInt64, de:m._DeInt64, bSigned:true, len:8 }, // 64bit fields need 8 bytes.. + 'Q': {en:m._EnInt64, de:m._DeInt64, bSigned:false, len:8 }}; // quirk of longs is they come in with a length of 2 in an array + + + /** + * @param {number} num_elements_n + * @param {number} size_s + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + // Unpack a series of n elements of size s from array a at offset p with fxn + m._UnpackSeries = function(num_elements_n, size_s, octet_array_a, offset_p) { + if (DEBUG) console.log("zzz_13"); + var fxn = el.de; + /** @type {!Array} */ + var rv = []; + /** @type {number} */ + var o = 0; + for (; o < num_elements_n; rv.push(fxn(octet_array_a, offset_p + o * size_s)), o++) { + } + return rv; + }; + /** + * @param {number} num_elements_n + * @param {number} size_s + * @param {!Array} to_octet_array_a + * @param {number} array_a_offset_p + * @param {(Array|NodeList|null)} from_array_v + * @param {number} array_v_offset_i + * @return {undefined} + */ + // Pack a series of n elements of size s from array v at offset i to array a at offset p with fxn + + m._PackSeries = function(num_elements_n, size_s, to_octet_array_a, array_a_offset_p, from_array_v, array_v_offset_i) { + if (DEBUG) console.log("pack-series: "); + + + if ( DEBUG ) console.log('js before 0:'+0+' num_elements_n:'+num_elements_n+' size_s:'+size_s+' to_a:'+to_octet_array_a+' i:'+array_v_offset_i+" offset_p:"+array_a_offset_p+" v:"+from_array_v); + var fxn = el.en; + /** @type {number} */ + var o = 0; + for (; o < num_elements_n; o++) { + //if (DEBUG) console.log("14 called fxn with o:"+o); + var z = from_array_v[array_v_offset_i + o]; + var to = JSON.stringify(z); + var too = JSON.stringify(from_array_v); + if (DEBUG) console.log('js pre-ffff z:'+z+' to:'+to+' too:'+too+''); + // handle flattened arrays - non-array things dont have a .length + try { + if (z.length == undefined ) { + //from_array_v = [ from_array_v ] ; + if (DEBUG) console.log('Z FIX'); + }} catch (e){} + var z = from_array_v[array_v_offset_i + o]; + var to = JSON.stringify(z); + var too = JSON.stringify(from_array_v); + + // if we only have one thing to back and its got an 8 byte target len ( its a 64bit long), and length of source array is 2 ( low and high bits ) + // we treat it as a singular thing... we use this for Q type, which gets passed in as [lowBits, hightBits] + if (( num_elements_n == 1 ) && (size_s == 8) && (from_array_v.length == 2) ) { + z = from_array_v; + if (DEBUG) console.log("js handling Q 64bit array"); + } + + + if (DEBUG) console.log('js partial z:'+z+' to:'+to+' too:'+too+' num_elements_n:'+num_elements_n+' size_s:'+size_s+' to_a:'+to_octet_array_a+' v_offset_i:'+array_v_offset_i+" a_offset_p:"+array_a_offset_p+" from_v:"+from_array_v); + + fxn(to_octet_array_a, array_a_offset_p + o * size_s, z); + + } + if (DEBUG) console.log('js after to_a:'+to_octet_array_a); + }; + + + /** + * @param {string} fmt + * @param {!Object} octet_array_a + * @param {number} offset_p + * @return {?} + */ + // Unpack the octet array a, beginning at offset p, according to the fmt string + m.Unpack = function(fmt, octet_array_a, offset_p) { + if (DEBUG) console.log("zzz_15"); + /** @type {boolean} */ + // Set the private bBE flag based on the format string - assume big-endianness + booleanIsBigEndian = fmt.charAt(0) != "<"; + /** @type {number} */ + offset_p = offset_p ? offset_p : 0; + /** @type {!RegExp} */ + var re = new RegExp(this._sPattern, "g"); + var re_match; + var repeat_count_n; + var element_size_s; + /** @type {!Array} */ + var rv = []; + + //loop over chars in the format string with regex due to optional digits + for (; re_match = re.exec(fmt);) { + /** @type {number} */ + repeat_count_n = re_match[1] == undefined || re_match[1] == "" ? 1 : parseInt(re_match[1]); + element_size_s = this._lenLut[re_match[2]]; + if (offset_p + repeat_count_n * element_size_s > octet_array_a.length) { + return undefined; + } + switch(re_match[2]) { + case "A": + case "s": + rv.push(this._elLookUpTable[re_match[2]].de(octet_array_a, offset_p, repeat_count_n)); + break; + case "c": + case "b": + case "B": + case "h": + case "H": + case "i": + case "I": + case "l": + case "L": + case "f": + case "d": + case "q": + case "Q": + el = this._elLookUpTable[re_match[2]]; + + //rv.push(this._UnpackSeries(repeat_count_n, element_size_s, octet_array_a, offset_p)); + + // unpack arrays to an actual array type within the field array result: + // https://github.com/AndreasAntener/node-jspack/commit/4f16680101303a6b4a1b0deba8cf7d20fc68213e + if (repeat_count_n > 1) { + // Field is array, unpack into separate array and push as such + var arr = []; + arr.push(this._UnpackSeries(repeat_count_n, element_size_s, octet_array_a, offset_p)); + rv.push(arr); + } else { + rv.push(this._UnpackSeries(repeat_count_n, element_size_s, octet_array_a, offset_p)); + } + + break; + } + /** @type {number} */ + offset_p = offset_p + repeat_count_n * element_size_s; + } + return Array.prototype.concat.apply([], rv); + }; + + + // cross check the list of input data matches the size of bytes we'll be assembling + // this is a slightly tweaked implementation of the previous 'PackTo' commented out below. + // it has a more-consistent approach to input and output arrays, paying particular attention to Q,q, long, etc + m.WouldPack = function(fmt, octet_array_a, offset_p, values) { + //if (DEBUG) console.log("zzz_16 fmt:"+JSON.stringify(fmt)+" values:"+JSON.stringify(values)); + // @type {boolean} / + // Set the private bBE flag based on the format string - assume big-endianness + booleanIsBigEndian = fmt.charAt(0) != "<"; + // @type {!RegExp} / + var re = new RegExp(this._sPattern, "g"); + + var m; + var n; + var s; + var values_i = 0; // current index into the values[] + + var j; + for (; m = re.exec(fmt);) { + + // leading optional prefix num or 1 + n = m[1] == undefined || m[1] == "" ? 1 : parseInt(m[1]); + + s = this._lenLut[m[2]]; + + + if (DEBUG) console.log("character: "+m[2]+" how many(n)?: "+n); + el = this._elLookUpTable[m[2]]; + + //if (DEBUG) console.log("using lookup table:"+JSON.stringify(el)); + var bytes_consumed_per_element = el["len"]; + bytes_consumed_per_element = bytes_consumed_per_element == undefined ? 1 : bytes_consumed_per_element ; // undefined means 1 + if (DEBUG) console.log("bytes_consumed_per_element:"+JSON.stringify(bytes_consumed_per_element)); + if (DEBUG) console.log("current_values_idx:"+JSON.stringify(values_i) +" values:"+JSON.stringify(values[values_i]) ) ; + + + // do per-case behaviours 'A' , 's' and 'x' are special, everything else gets the same + switch(m[2]) { + //------------------------------------------ + case "A": + case "s": + if (values_i + 1 > values.length) { + console.log("JSPACK-ERROR: values_i + 1 > values.length values_i:"+values_i+" values.length:"+values.length); + //return false; + } + if (DEBUG) console.log("all values:"+JSON.stringify(values)); + this._elLookUpTable[m[2]].en(octet_array_a, offset_p, n, values[values_i]); + // @type {number} / + values_i = values_i + 1; + break; + //------------------------------------------ + case "x": + // @type {number} / + j = 0; + for (; j < n; j++) { + // @type {number} / + octet_array_a[offset_p + j] = 0; + } + break; + //------------------------------------------ + // everything else + default: + + // if n > 1 , ie its multiple occurances of a 'thing' + if (n > 1 ) { + + // if we were handed an array at this idx, we need the array to be the same length as n + if (Array.isArray(values[values_i])) { + + // Value series is array, iterate through that, only increment by 1 + if ((values_i + 1) > values.length) { + if (DEBUG) console.log("JSPACK-ERROR: value series is array but (values_i + 1) > values.length. i:"+values_i+" values.length:"+values.length); + //return false; + } + if (DEBUG) console.log("(dst IS array) (source IS array)"); + this._PackSeries(n, s, octet_array_a, offset_p, values[values_i], 0); + values_i += 1; + } + else { + if (DEBUG) console.log("ERROR: (dst IS array) (source is not array)"); + } + } + + // if n == 1, it just one of a thing + if (n == 1 ) { + + // type Q can have the source as an array when there is only 1 of them. + if (Array.isArray(values[values_i]) ) { + + if (( m[2] == 'Q' ) || ( m[2] == 'q' ) ) { + this._PackSeries(n, s, octet_array_a, offset_p, values[values_i], 0); + values_i += 1; + } + if (DEBUG) console.log("(dst is not array) (source IS array)"); + + } else { + if ((values_i + n ) > values.length) { + if (DEBUG) console.log("JSPACK-ERROR: value series NOT array but (values_i + n ) > values.length. i:"+values_i+" n:"+n+" values.length:"+values.length+" values:"+JSON.stringify(values)); + //return false; + } + if (DEBUG) console.log("(dst is not array) (source is not array)"); + this._PackSeries(n, s, octet_array_a, offset_p, values, values_i); + values_i += n; + } + } + + if (DEBUG) console.log(""); + break; + //------------------------------------------ + } + + offset_p = offset_p + n * s; + + } + if (DEBUG) console.log("wouldpack completed, result array_a is:"+JSON.stringify(octet_array_a)); + return octet_array_a + } + + + + /** + * @param {string} fmt + * @param {!Array} octet_array_a + * @param {number} offset_p + * @param {!NodeList} values + * @return {?} + */ +/* + // Pack the supplied values into the octet array a, beginning at offset p, according to the fmt string + m.PackTo = function(fmt, octet_array_a, offset_p, values) { + if (DEBUG) console.log("zzz_16 fmt:"+JSON.stringify(fmt)+" values:"+JSON.stringify(values)); + // @type {boolean} / + // Set the private bBE flag based on the format string - assume big-endianness + booleanIsBigEndian = fmt.charAt(0) != "<"; + // @type {!RegExp} / + var re = new RegExp(this._sPattern, "g"); + var m; + var n; + var s; + // @type {number} / + var i = 0; + var j; + for (; m = re.exec(fmt);) { + // @type {number} / + n = m[1] == undefined || m[1] == "" ? 1 : parseInt(m[1]); + s = this._lenLut[m[2]]; + if (offset_p + n * s > octet_array_a.length) { + console.log("JSPACK-ERROR: offset_p + n * s > octet_array_a.length offset_p:"+offset_p+" n:"+n+" s:"+s+" octet_array_a.length:"+octet_array_a.length+" octet_array_a:"+JSON.stringify(octet_array_a)); + return false; + } + if (DEBUG) console.log("\n---------------------------------------------\n"); + if (DEBUG) console.log("handling format specifier:"+m[2]+" how many:"+n); + switch(m[2]) { + case "A": + case "s": + if (i + 1 > values.length) { + console.log("JSPACK-ERROR: i + 1 > values.length i:"+i+" values.length:"+values.length); + return false; + } + if (DEBUG) console.log("zzz_16A values:"+JSON.stringify(values)); + this._elLookUpTable[m[2]].en(octet_array_a, offset_p, n, values[i]); + // @type {number} / + i = i + 1; + break; + case "c": + case "b": + case "B": + case "h": + case "H": + case "i": + case "I": + case "l": + case "L": + case "f": + case "d": + case "q": + case "Q": + if (DEBUG) console.log("16 blerg"); + el = this._elLookUpTable[m[2]]; + if (DEBUG) console.log("using lookup table:"+JSON.stringify(el)); + //if (i + n > values.length) { return false; } + //this._PackSeries(n, s, octet_array_a, offset_p, values, i); + //i = i + n; + //added support for packing value series when they are supplied as arrays within the values array + // https://github.com/AndreasAntener/node-jspack/commit/8de80d20aa06dea15527b3073c6c8631abda0f17 + if (n > 1 && Array.isArray(values[i])) { + // Value series is array, iterate through that, only increment by 1 + if ((i + 1) > values.length) { + console.log("JSPACK-ERROR: value series is array but (i + 1) > values.length. i:"+i+" values.length:"+values.length); + return false; + } + if (DEBUG) console.log("zzz_16 option 1 (source is array)"); + this._PackSeries(n, s, octet_array_a, offset_p, values[i], 0); + i += 1; + } else { + if ((i + n) > values.length) { + console.log("JSPACK-ERROR: value series NOT array but (i + n) > values.length. i:"+i+" n:"+n+" values.length:"+values.length+" values:"+JSON.stringify(values)); + //return false; + } + if (DEBUG) console.log("zzz_16 option 2 (source is not array)"); + this._PackSeries(n, s, octet_array_a, offset_p, values, i); + i += n; + } + + if (DEBUG) console.log("end case"); + break; + case "x": + // @type {number} / + j = 0; + for (; j < n; j++) { + // @type {number} / + octet_array_a[offset_p + j] = 0; + } + break; + } + // @type {number} / + offset_p = offset_p + n * s; + } + console.log("pack completed, result array_a is:"+JSON.stringify(octet_array_a)); + return octet_array_a; + }; + */ + + /** + * @param {string} fmt + * @param {(Node|NodeList|null|string)} values + * @return {?} + */ + // Pack the supplied values into a new octet array, according to the fmt string + m.Pack = function(fmt, values) { + if (DEBUG) console.log("\n\n------------------------------------------------------------------------------------------------------------\n\n"); + if (DEBUG) console.log("initial unpacked values:"+JSON.stringify(values)); + if (DEBUG) console.log("initial format string:"+JSON.stringify(fmt)); + if (DEBUG) console.log("\n\nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n\n"); + return this.WouldPack(fmt, new Array(this.CalcLength(fmt)), 0, values); + //if (DEBUG) console.log("\n\nmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm\n\n"); + // return this.PackTo(fmt, new Array(this.CalcLength(fmt)), 0, values); + }; + + /** + * @param {string} fmt + * @param {(Node|NodeList|null|string)} values + * @return {?} + */ + // Pack the supplied values into a new octet array, according to the fmt string + m.oldPack = function(fmt, values) { + if (DEBUG) console.log("\n\n------------------------------------------------------------------------------------------------------------\n\n"); + if (DEBUG) console.log("initial unpacked values:"+JSON.stringify(values)); + if (DEBUG) console.log("initial format string:"+JSON.stringify(fmt)); + return this.PackTo(fmt, new Array(this.CalcLength(fmt)), 0, values); + }; + + /** + * @param {string} fmt + * @return {?} + */ + // Determine the number of bytes represented by the format string + m.CalcLength = function(fmt) { + + /** @type {!RegExp} */ + var re = new RegExp(this._sPattern, "g"); + var m; + /** @type {number} */ + var value = 0; + for (; m = re.exec(fmt);) { + /** @type {number} */ + value = value + (m[1] == undefined || m[1] == "" ? 1 : parseInt(m[1])) * this._lenLut[m[2]]; + } + if (DEBUG) console.log("number of bytes in format string?: "+value+"\n"); + return value; + }; +} +exports.jspack = new JSPack; + diff --git a/local_modules/jspack/package.json b/local_modules/jspack/package.json new file mode 100644 index 0000000..1233368 --- /dev/null +++ b/local_modules/jspack/package.json @@ -0,0 +1,64 @@ +{ + "_from": "jspack@0.0.4", + "_id": "jspack@0.0.4", + "_inBundle": false, + "_integrity": "sha1-Mt01x/3LPjRWwY+7fvntC8YjgXc=", + "_location": "/jspack", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": false, + "raw": "jspack@0.0.4", + "name": "jspack", + "escapedName": "jspack", + "rawSpec": "0.0.4", + "saveSpec": null, + "fetchSpec": "0.0.4" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "local_modules/jspack", + "_shasum": "32dd35c7fdcb3e3456c18fbb7ef9ed0bc6238177", + "_spec": "jspack@0.0.4", + "_where": "/home/buzz/GCS/mavlink/pymavlink/generator/javascript", + "author": { + "name": "https://github.com/pgriess" + }, + "bugs": { + "url": "https://github.com/birchroad/node-jspack/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "JavaScript library to pack primitives to octet arrays, including int64 support, packaged for NodeJS.", + "devDependencies": { + "long": "", + "mocha": "", + "should": "", + "sinon": "" + }, + "homepage": "https://github.com/birchroad/node-jspack", + "main": "./jspack.js", + "maintainers": [ + { + "name": "Peter Magnusson", + "email": "peter@birchroad.net", + "url": "http://github.com/birchroad/node-jspack" + }, + { + "name": "Andreas Antener", + "url": "https://github.com/AndreasAntener/node-jspack" + } + ], + "name": "jspack", + "repository": { + "type": "git", + "url": "git://github.com/birchroad/node-jspack.git" + }, + "scripts": { + "pretest": "npm install", + "test": "mocha test" + }, + "version": "0.0.4" +} diff --git a/local_modules/jspack/test/int64.js b/local_modules/jspack/test/int64.js new file mode 100644 index 0000000..b24617e --- /dev/null +++ b/local_modules/jspack/test/int64.js @@ -0,0 +1,456 @@ +// This file is MODIFIED from the original, by buzz 2020, please see README.md in the upper level folder for more details. +var should = require('should'); +var jspack = require('../jspack.js').jspack; +var Long = require('long'); + +describe('Test long integration (examples):', function() { + + // Demonstrating the use together with Long.js (https://github.com/dcodeIO/Long.js) + // + // Packing a long requires the input of a 2 part array containing the [low, high] bits + // of the specific long value. + // Unpacking a long results in a 3 part array containing [low, high, unsigned] bits and flag. + // The decoded value can be applied directly to Long.fromBits() + // + // Test number u 228290380562207 (BE: 0x00, 0x00, 0xcf, 0xa0, 0xff, 0x09, 0xff, 0x1f) + // (LE: 0x1f, 0xff, 0x09, 0xff, 0xa0, 0xcf, 0x00, 0x00) + // Test number s -228290380562207 (BE: 0xff, 0xff, 0x30, 0x5f, 0x00, 0xf6, 0x00, 0xe1) + // (LE: 0xe1, 0x00, 0xf6, 0x00, 0x5f, 0x30, 0xff, 0xff) + + it('pack Q', function() { + var buf = jspack.Pack('>Q', [[0xffe1ffff, 0xffa0]]); + buf.should.be.eql([0x00, 0x00, 0xff, 0xa0, 0xff, 0xe1, 0xff, 0xff]); + }); + + it('unpack Q', function() { + var buf = jspack.Unpack('>Q', [0x00, 0x00, 0xff, 0xa0, 0xff, 0xe1, 0xff, 0xff]); + buf.length.should.be.eql(1); + buf[0].length.should.be.eql(3); + buf[0][0].should.be.eql(0xffe1ffff); + buf[0][1].should.be.eql(0xffa0); + buf[0][2].should.be.true; + }); + + // Test lower-case q as well. This only test the matching of the caracter and the unsigned bit, + // the parsing is the same as for upper-case Q (since we don't actually convert to a number). + it('pack >q (signed)', function() { + var buf = jspack.Pack('>q', [[0xffe1ffff, 0xffa0]]); + buf.should.be.eql([0x00, 0x00, 0xff, 0xa0, 0xff, 0xe1, 0xff, 0xff]); + }); + + it('unpack >> 0).toString(2); + y = ("00000000000000000000000000000000" + x).slice(-32) + y1 = y.substring(0,8); + y2 = y.substring(8,16); + y3 = y.substring(16,24); + y4 = y.substring(24,32); + return [y,y1,y2,y3,y4]; +} +function dec2bin_ws(dec) { + var str = dec2bin(dec); + var bb = str.slice(1); //1-4 skipping zero + var bbj = bb.join(' '); + return bbj; +} + +describe('ASCII Boundary tests:', function() { + + it('pack <4s correctly over the ascii 127->128->129 boundary', function() { // should work in range 0-255 if u use 'binary' encoding + + this.format = '<4s'; + + this.ascii_bytes = new Buffer.from([ 126, 127, 128, 129]).toString('binary'); // 'binary' encoding is important here, as without it values above 128 are treated as unicode. + var buf = jspack.Pack(this.format, [ this.ascii_bytes]); + body = [ 0x7e, 0x7f, 0x80, 0x81]; // expected result + buf.should.be.eql(body); + + }); + + it('long Q buzz', function() { // should work in range 0-255 if u use 'binary' encoding + +//from aoa_ssa + + this.format = '> 8) & 0xFF), this.msgId>>16]; + + this.msgId = 130; + + var v1 = ((this.msgId & 0xFF) << 8) | ((this.msgId >> 8) & 0xFF); + var v2 = this.msgId>>16; + + v1.should.be.eql(33280); + v2.should.be.eql(0); + + var orderedfields = [253,13,0,0,40,11,10,33280,0]; + + console.log("------------------------------------------------------------------------\nmavheader:"+JSON.stringify(orderedfields)); + var hdr = jspack.Pack('BBBBBBBHB',orderedfields); + + buf = [0xfd, 0x0d, 0x00, 0x00, 0x28, 0x0b, 0x0a, 0x82, 0x00, 0x00]; + + buf.should.be.eql(hdr); + }); + +}); + +describe('Q Boundary tests:', function() { + + it('unpack >Q full', function() { + var buf = jspack.Unpack('>Q', [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]); + buf.length.should.be.eql(1); + buf[0].length.should.be.eql(3); + buf[0][0].should.be.eql(0xffffffff); + buf[0][1].should.be.eql(0xffffffff); + buf[0][2].should.be.true; + }); + + it('pack >Q full', function() { + var buf = jspack.Pack('>Q', [[0xffffffff, 0xffffffff]]); + buf.should.be.eql([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]); + }); + + it('unpack Q zero', function() { + var buf = jspack.Unpack('>Q', [0, 0, 0, 0, 0, 0, 0, 0]); + buf.length.should.be.eql(1); + buf[0].length.should.be.eql(3); + buf[0][0].should.be.eql(0); + buf[0][1].should.be.eql(0); + buf[0][2].should.be.true; + }); + + it('pack >Q zero', function() { + var buf = jspack.Pack('>Q', [[0, 0]]); + buf.should.be.eql([0, 0, 0, 0, 0, 0, 0, 0]); + }); + + it('unpack Q one', function() { + var buf = jspack.Unpack('>Q', [1, 1, 1, 1, 1, 1, 1, 1]); + buf.length.should.be.eql(1); + buf[0].length.should.be.eql(3); + buf[0][0].should.be.eql(0x01010101); + buf[0][1].should.be.eql(0x01010101); + buf[0][2].should.be.true; + }); + + it('pack >Q one', function() { + var buf = jspack.Pack('>Q', [[0x01010101, 0x01010101]]); + buf.should.be.eql([1, 1, 1, 1, 1, 1, 1, 1]); + }); + + it('unpack Q 0xfe', function() { + var buf = jspack.Unpack('>Q', [0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe]); + buf.length.should.be.eql(1); + buf[0].length.should.be.eql(3); + buf[0][0].should.be.eql(0xfefefefe); + buf[0][1].should.be.eql(0xfefefefe); + buf[0][2].should.be.true; + }); + + it('pack >Q 0xfe', function() { + var buf = jspack.Pack('>Q', [[0xfefefefe, 0xfefefefe]]); + buf.should.be.eql([0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe]); + }); + + it('unpack 53 are representable in the Number type", which is "representing the +doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic". +The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) +in JavaScript is 253-1. + +Example: 264-1 is 1844674407370955**1615** but in JavaScript it evaluates to 1844674407370955**2000**. + +Furthermore, bitwise operators in JavaScript "deal only with integers in the range −231 through +231−1, inclusive, or in the range 0 through 232−1, inclusive. These operators accept any value of +the Number type but first convert each such value to one of 232 integer values." + +In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full +64 bits. This is where long.js comes into play. + +Usage +----- + +The class is compatible with CommonJS and AMD loaders and is exposed globally as `Long` if neither is available. + +```javascript +var Long = require("long"); + +var longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF); + +console.log(longVal.toString()); +... +``` + +API +--- + +### Constructor + +* new **Long**(low: `number`, high: `number`, unsigned?: `boolean`)
+ Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. See the from* functions below for more convenient ways of constructing Longs. + +### Fields + +* Long#**low**: `number`
+ The low 32 bits as a signed value. + +* Long#**high**: `number`
+ The high 32 bits as a signed value. + +* Long#**unsigned**: `boolean`
+ Whether unsigned or not. + +### Constants + +* Long.**ZERO**: `Long`
+ Signed zero. + +* Long.**ONE**: `Long`
+ Signed one. + +* Long.**NEG_ONE**: `Long`
+ Signed negative one. + +* Long.**UZERO**: `Long`
+ Unsigned zero. + +* Long.**UONE**: `Long`
+ Unsigned one. + +* Long.**MAX_VALUE**: `Long`
+ Maximum signed value. + +* Long.**MIN_VALUE**: `Long`
+ Minimum signed value. + +* Long.**MAX_UNSIGNED_VALUE**: `Long`
+ Maximum unsigned value. + +### Utility + +* Long.**isLong**(obj: `*`): `boolean`
+ Tests if the specified object is a Long. + +* Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits. + +* Long.**fromBytes**(bytes: `number[]`, unsigned?: `boolean`, le?: `boolean`): `Long`
+ Creates a Long from its byte representation. + +* Long.**fromBytesLE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its little endian byte representation. + +* Long.**fromBytesBE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its big endian byte representation. + +* Long.**fromInt**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given 32 bit integer value. + +* Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + +* Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)
+ Long.**fromString**(str: `string`, radix: `number`)
+ Returns a Long representation of the given string, written using the specified radix. + +* Long.**fromValue**(val: `*`, unsigned?: `boolean`): `Long`
+ Converts the specified value to a Long using the appropriate from* function for its type. + +### Methods + +* Long#**add**(addend: `Long | number | string`): `Long`
+ Returns the sum of this and the specified Long. + +* Long#**and**(other: `Long | number | string`): `Long`
+ Returns the bitwise AND of this Long and the specified. + +* Long#**compare**/**comp**(other: `Long | number | string`): `number`
+ Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater. + +* Long#**divide**/**div**(divisor: `Long | number | string`): `Long`
+ Returns this Long divided by the specified. + +* Long#**equals**/**eq**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value equals the specified's. + +* Long#**getHighBits**(): `number`
+ Gets the high 32 bits as a signed integer. + +* Long#**getHighBitsUnsigned**(): `number`
+ Gets the high 32 bits as an unsigned integer. + +* Long#**getLowBits**(): `number`
+ Gets the low 32 bits as a signed integer. + +* Long#**getLowBitsUnsigned**(): `number`
+ Gets the low 32 bits as an unsigned integer. + +* Long#**getNumBitsAbs**(): `number`
+ Gets the number of bits needed to represent the absolute value of this Long. + +* Long#**greaterThan**/**gt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than the specified's. + +* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is greater than or equal the specified's. + +* Long#**isEven**(): `boolean`
+ Tests if this Long's value is even. + +* Long#**isNegative**(): `boolean`
+ Tests if this Long's value is negative. + +* Long#**isOdd**(): `boolean`
+ Tests if this Long's value is odd. + +* Long#**isPositive**(): `boolean`
+ Tests if this Long's value is positive. + +* Long#**isZero**/**eqz**(): `boolean`
+ Tests if this Long's value equals zero. + +* Long#**lessThan**/**lt**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than the specified's. + +* Long#**lessThanOrEqual**/**lte**/**le**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value is less than or equal the specified's. + +* Long#**modulo**/**mod**/**rem**(divisor: `Long | number | string`): `Long`
+ Returns this Long modulo the specified. + +* Long#**multiply**/**mul**(multiplier: `Long | number | string`): `Long`
+ Returns the product of this and the specified Long. + +* Long#**negate**/**neg**(): `Long`
+ Negates this Long's value. + +* Long#**not**(): `Long`
+ Returns the bitwise NOT of this Long. + +* Long#**notEquals**/**neq**/**ne**(other: `Long | number | string`): `boolean`
+ Tests if this Long's value differs from the specified's. + +* Long#**or**(other: `Long | number | string`): `Long`
+ Returns the bitwise OR of this Long and the specified. + +* Long#**shiftLeft**/**shl**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits shifted to the left by the given amount. + +* Long#**shiftRight**/**shr**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits arithmetically shifted to the right by the given amount. + +* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number | string`): `Long`
+ Returns this Long with bits logically shifted to the right by the given amount. + +* Long#**subtract**/**sub**(subtrahend: `Long | number | string`): `Long`
+ Returns the difference of this and the specified Long. + +* Long#**toBytes**(le?: `boolean`): `number[]`
+ Converts this Long to its byte representation. + +* Long#**toBytesLE**(): `number[]`
+ Converts this Long to its little endian byte representation. + +* Long#**toBytesBE**(): `number[]`
+ Converts this Long to its big endian byte representation. + +* Long#**toInt**(): `number`
+ Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + +* Long#**toNumber**(): `number`
+ Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + +* Long#**toSigned**(): `Long`
+ Converts this Long to signed. + +* Long#**toString**(radix?: `number`): `string`
+ Converts the Long to a string written in the specified radix. + +* Long#**toUnsigned**(): `Long`
+ Converts this Long to unsigned. + +* Long#**xor**(other: `Long | number | string`): `Long`
+ Returns the bitwise XOR of this Long and the given one. + +Building +-------- + +To build an UMD bundle to `dist/long.js`, run: + +``` +$> npm install +$> npm run build +``` + +Running the [tests](./tests): + +``` +$> npm test +``` diff --git a/local_modules/long/index.js b/local_modules/long/index.js new file mode 100644 index 0000000..46f6341 --- /dev/null +++ b/local_modules/long/index.js @@ -0,0 +1 @@ +module.exports = require("./src/long"); diff --git a/local_modules/long/long b/local_modules/long/long new file mode 120000 index 0000000..57c4d9e --- /dev/null +++ b/local_modules/long/long @@ -0,0 +1 @@ +node_modules/long \ No newline at end of file diff --git a/local_modules/long/package.json b/local_modules/long/package.json new file mode 100644 index 0000000..532202f --- /dev/null +++ b/local_modules/long/package.json @@ -0,0 +1,64 @@ +{ + "_from": "long@^4.0.0", + "_id": "long@4.0.0", + "_inBundle": false, + "_integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "_location": "/long", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": false, + "raw": "long@^4.0.0", + "name": "long", + "escapedName": "long", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "local_modules/long", + "_shasum": "9a7b71cfb7d361a194ea555241c92f7468d5bf28", + "_spec": "long@^4.0.0", + "_where": "/home/buzz/GCS/mavlink/pymavlink/generator/javascript", + "author": { + "name": "Daniel Wirtz", + "email": "dcode@dcode.io" + }, + "bugs": { + "url": "https://github.com/dcodeIO/long.js/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "A Long class for representing a 64-bit two's-complement integer value.", + "devDependencies": { + "webpack": "^3.10.0" + }, + "files": [ + "index.js", + "LICENSE", + "README.md", + "src/long.js", + "dist/long.js", + "dist/long.js.map" + ], + "homepage": "https://github.com/dcodeIO/long.js#readme", + "keywords": [ + "math" + ], + "license": "Apache-2.0", + "main": "src/long.js", + "name": "long", + "repository": { + "type": "git", + "url": "git+https://github.com/dcodeIO/long.js.git" + }, + "scripts": { + "build": "webpack", + "test": "node tests" + }, + "version": "4.0.0" +} diff --git a/local_modules/long/src/long.js b/local_modules/long/src/long.js new file mode 100644 index 0000000..c71f8c9 --- /dev/null +++ b/local_modules/long/src/long.js @@ -0,0 +1,1325 @@ +// This file is MODIFIED from the original, by buzz 2020, please see README.md in the upper level folder for more details. + +module.exports = Long; + +/** + * wasm optimizations, to do native i64 multiplication and divide + */ +var wasm = null; + +try { + wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 + ])), {}).exports; +} catch (e) { + // no wasm support :( +} + +/** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. + * See the from* functions below for more convenient ways of constructing Longs. + * @exports Long + * @class A Long class for representing a 64 bit two's-complement integer value. + * @param {number} low The low (signed) 32 bits of the long + * @param {number} high The high (signed) 32 bits of the long + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @constructor + */ +function Long(low, high, unsigned) { + + /** + * The low 32 bits as a signed value. + * @type {number} + */ + this.low = low | 0; + + /** + * The high 32 bits as a signed value. + * @type {number} + */ + this.high = high | 0; + + /** + * Whether unsigned or not. + * @type {boolean} + */ + this.unsigned = !!unsigned; +} + +// The internal representation of a long is the two given signed, 32-bit values. +// We use 32-bit pieces because these are the size of integers on which +// Javascript performs bit-operations. For operations like addition and +// multiplication, we split each number into 16 bit pieces, which can easily be +// multiplied within Javascript's floating-point representation without overflow +// or change in sign. +// +// In the algorithms below, we frequently reduce the negative case to the +// positive case by negating the input(s) and then post-processing the result. +// Note that we must ALWAYS check specially whether those values are MIN_VALUE +// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as +// a positive number, it overflows back into a negative). Not handling this +// case would often result in infinite recursion. +// +// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* +// methods on which they depend. + +/** + * An indicator used to reliably determine if an object is a Long or not. + * @type {boolean} + * @const + * @private + */ +Long.prototype.__isLong__; + +Object.defineProperty(Long.prototype, "__isLong__", { value: true }); + +/** + * @function + * @param {*} obj Object + * @returns {boolean} + * @inner + */ +function isLong(obj) { + return (obj && obj["__isLong__"]) === true; +} + +/** + * Tests if the specified object is a Long. + * @function + * @param {*} obj Object + * @returns {boolean} + */ +Long.isLong = isLong; + +/** + * A cache of the Long representations of small integer values. + * @type {!Object} + * @inner + */ +var INT_CACHE = {}; + +/** + * A cache of the Long representations of small unsigned integer values. + * @type {!Object} + * @inner + */ +var UINT_CACHE = {}; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromInt(value, unsigned) { + var obj, cachedObj, cache; + if (unsigned) { + value >>>= 0; + if (cache = (0 <= value && value < 256)) { + cachedObj = UINT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); + if (cache) + UINT_CACHE[value] = obj; + return obj; + } else { + value |= 0; + if (cache = (-128 <= value && value < 128)) { + cachedObj = INT_CACHE[value]; + if (cachedObj) + return cachedObj; + } + obj = fromBits(value, value < 0 ? -1 : 0, false); + if (cache) + INT_CACHE[value] = obj; + return obj; + } +} + +/** + * Returns a Long representing the given 32 bit integer value. + * @function + * @param {number} value The 32 bit integer in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromInt = fromInt; + +/** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromNumber(value, unsigned) { + if (isNaN(value)) + return unsigned ? UZERO : ZERO; + if (unsigned) { + if (value < 0) + return UZERO; + if (value >= TWO_PWR_64_DBL) + return MAX_UNSIGNED_VALUE; + } else { + if (value <= -TWO_PWR_63_DBL) + return MIN_VALUE; + if (value + 1 >= TWO_PWR_63_DBL) + return MAX_VALUE; + } + if (value < 0) + return fromNumber(-value, unsigned).neg(); + return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); +} + +/** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * @function + * @param {number} value The number in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromNumber = fromNumber; + +/** + * @param {number} lowBits + * @param {number} highBits + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromBits(lowBits, highBits, unsigned) { + return new Long(lowBits, highBits, unsigned); +} + +/** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is + * assumed to use 32 bits. + * @function + * @param {number} lowBits The low 32 bits + * @param {number} highBits The high 32 bits + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ +Long.fromBits = fromBits; + +/** + * @function + * @param {number} base + * @param {number} exponent + * @returns {number} + * @inner + */ +var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) + +/** + * @param {string} str + * @param {(boolean|number)=} unsigned + * @param {number=} radix + * @returns {!Long} + * @inner + */ +function fromString(str, unsigned, radix) { + if (str.length === 0) + throw Error('empty string'); + if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") + return ZERO; + if (typeof unsigned === 'number') { + // For goog.math.long compatibility + radix = unsigned, + unsigned = false; + } else { + unsigned = !! unsigned; + } + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + + var p; + if ((p = str.indexOf('-')) > 0) + throw Error('interior hyphen'); + else if (p === 0) { + return fromString(str.substring(1), unsigned, radix).neg(); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 8)); + + var result = ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i), + value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = fromNumber(pow_dbl(radix, size)); + result = result.mul(power).add(fromNumber(value)); + } else { + result = result.mul(radixToPower); + result = result.add(fromNumber(value)); + } + } + result.unsigned = unsigned; + return result; +} + +/** + * Returns a Long representation of the given string, written using the specified radix. + * @function + * @param {string} str The textual representation of the Long + * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed + * @param {number=} radix The radix in which the text is written (2-36), defaults to 10 + * @returns {!Long} The corresponding Long value + */ +Long.fromString = fromString; + +/** + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ +function fromValue(val, unsigned) { + if (typeof val === 'number') + return fromNumber(val, unsigned); + if (typeof val === 'string') + return fromString(val, unsigned); + // Throws for non-objects, converts non-instanceof Long: + return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned); +} + +/** + * Converts the specified value to a Long using the appropriate from* function for its type. + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} + */ +Long.fromValue = fromValue; + +// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be +// no runtime penalty for these. + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_16_DBL = 1 << 16; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_24_DBL = 1 << 24; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; + +/** + * @type {number} + * @const + * @inner + */ +var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; + +/** + * @type {!Long} + * @const + * @inner + */ +var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); + +/** + * @type {!Long} + * @inner + */ +var ZERO = fromInt(0); + +/** + * Signed zero. + * @type {!Long} + */ +Long.ZERO = ZERO; + +/** + * @type {!Long} + * @inner + */ +var UZERO = fromInt(0, true); + +/** + * Unsigned zero. + * @type {!Long} + */ +Long.UZERO = UZERO; + +/** + * @type {!Long} + * @inner + */ +var ONE = fromInt(1); + +/** + * Signed one. + * @type {!Long} + */ +Long.ONE = ONE; + +/** + * @type {!Long} + * @inner + */ +var UONE = fromInt(1, true); + +/** + * Unsigned one. + * @type {!Long} + */ +Long.UONE = UONE; + +/** + * @type {!Long} + * @inner + */ +var NEG_ONE = fromInt(-1); + +/** + * Signed negative one. + * @type {!Long} + */ +Long.NEG_ONE = NEG_ONE; + +/** + * @type {!Long} + * @inner + */ +var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false); + +/** + * Maximum signed value. + * @type {!Long} + */ +Long.MAX_VALUE = MAX_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true); + +/** + * Maximum unsigned value. + * @type {!Long} + */ +Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; + +/** + * @type {!Long} + * @inner + */ +var MIN_VALUE = fromBits(0, 0x80000000|0, false); + +/** + * Minimum signed value. + * @type {!Long} + */ +Long.MIN_VALUE = MIN_VALUE; + +/** + * @alias Long.prototype + * @inner + */ +var LongPrototype = Long.prototype; + +/** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @returns {number} + */ +LongPrototype.toInt = function toInt() { + return this.unsigned ? this.low >>> 0 : this.low; +}; + +/** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + * @returns {number} + */ +LongPrototype.toNumber = function toNumber() { + if (this.unsigned) + return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0); + return this.high * TWO_PWR_32_DBL + (this.low >>> 0); +}; + +/** + * Converts the Long to a string written in the specified radix. + * @param {number=} radix Radix (2-36), defaults to 10 + * @returns {string} + * @override + * @throws {RangeError} If `radix` is out of range + */ +LongPrototype.toString = function toString(radix) { + radix = radix || 10; + if (radix < 2 || 36 < radix) + throw RangeError('radix'); + if (this.isZero()) + return '0'; + if (this.isNegative()) { // Unsigned Longs are never negative + if (this.eq(MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = fromNumber(radix), + div = this.div(radixLong), + rem1 = div.mul(radixLong).sub(this); + return div.toString(radix) + rem1.toInt().toString(radix); + } else + return '-' + this.neg().toString(radix); + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), + rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower), + intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, + digits = intval.toString(radix); + rem = remDiv; + if (rem.isZero()) + return digits + result; + else { + while (digits.length < 6) + digits = '0' + digits; + result = '' + digits + result; + } + } +}; + +/** + * Gets the high 32 bits as a signed integer. + * @returns {number} Signed high bits + */ +LongPrototype.getHighBits = function getHighBits() { + return this.high; +}; + +/** + * Gets the high 32 bits as an unsigned integer. + * @returns {number} Unsigned high bits + */ +LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { + return this.high >>> 0; +}; + +/** + * Gets the low 32 bits as a signed integer. + * @returns {number} Signed low bits + */ +LongPrototype.getLowBits = function getLowBits() { + return this.low; +}; + +/** + * Gets the low 32 bits as an unsigned integer. + * @returns {number} Unsigned low bits + */ +LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { + return this.low >>> 0; +}; + +/** + * Gets the number of bits needed to represent the absolute value of this Long. + * @returns {number} + */ +LongPrototype.getNumBitsAbs = function getNumBitsAbs() { + if (this.isNegative()) // Unsigned Longs are never negative + return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); + var val = this.high != 0 ? this.high : this.low; + for (var bit = 31; bit > 0; bit--) + if ((val & (1 << bit)) != 0) + break; + return this.high != 0 ? bit + 33 : bit + 1; +}; + +/** + * Tests if this Long's value equals zero. + * @returns {boolean} + */ +LongPrototype.isZero = function isZero() { + return this.high === 0 && this.low === 0; +}; + +/** + * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}. + * @returns {boolean} + */ +LongPrototype.eqz = LongPrototype.isZero; + +/** + * Tests if this Long's value is negative. + * @returns {boolean} + */ +LongPrototype.isNegative = function isNegative() { + return !this.unsigned && this.high < 0; +}; + +/** + * Tests if this Long's value is positive. + * @returns {boolean} + */ +LongPrototype.isPositive = function isPositive() { + return this.unsigned || this.high >= 0; +}; + +/** + * Tests if this Long's value is odd. + * @returns {boolean} + */ +LongPrototype.isOdd = function isOdd() { + return (this.low & 1) === 1; +}; + +/** + * Tests if this Long's value is even. + * @returns {boolean} + */ +LongPrototype.isEven = function isEven() { + return (this.low & 1) === 0; +}; + +/** + * Tests if this Long's value equals the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.equals = function equals(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1) + return false; + return this.high === other.high && this.low === other.low; +}; + +/** + * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.eq = LongPrototype.equals; + +/** + * Tests if this Long's value differs from the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.notEquals = function notEquals(other) { + return !this.eq(/* validates */ other); +}; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.neq = LongPrototype.notEquals; + +/** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ne = LongPrototype.notEquals; + +/** + * Tests if this Long's value is less than the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThan = function lessThan(other) { + return this.comp(/* validates */ other) < 0; +}; + +/** + * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lt = LongPrototype.lessThan; + +/** + * Tests if this Long's value is less than or equal the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { + return this.comp(/* validates */ other) <= 0; +}; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.lte = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.le = LongPrototype.lessThanOrEqual; + +/** + * Tests if this Long's value is greater than the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThan = function greaterThan(other) { + return this.comp(/* validates */ other) > 0; +}; + +/** + * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gt = LongPrototype.greaterThan; + +/** + * Tests if this Long's value is greater than or equal the specified's. + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { + return this.comp(/* validates */ other) >= 0; +}; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.gte = LongPrototype.greaterThanOrEqual; + +/** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|string} other Other value + * @returns {boolean} + */ +LongPrototype.ge = LongPrototype.greaterThanOrEqual; + +/** + * Compares this Long's value with the specified's. + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.compare = function compare(other) { + if (!isLong(other)) + other = fromValue(other); + if (this.eq(other)) + return 0; + var thisNeg = this.isNegative(), + otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) + return -1; + if (!thisNeg && otherNeg) + return 1; + // At this point the sign bits are the same + if (!this.unsigned) + return this.sub(other).isNegative() ? -1 : 1; + // Both are positive if at least one is unsigned + return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1; +}; + +/** + * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}. + * @function + * @param {!Long|number|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ +LongPrototype.comp = LongPrototype.compare; + +/** + * Negates this Long's value. + * @returns {!Long} Negated Long + */ +LongPrototype.negate = function negate() { + if (!this.unsigned && this.eq(MIN_VALUE)) + return MIN_VALUE; + return this.not().add(ONE); +}; + +/** + * Negates this Long's value. This is an alias of {@link Long#negate}. + * @function + * @returns {!Long} Negated Long + */ +LongPrototype.neg = LongPrototype.negate; + +/** + * Returns the sum of this and the specified Long. + * @param {!Long|number|string} addend Addend + * @returns {!Long} Sum + */ +LongPrototype.add = function add(addend) { + if (!isLong(addend)) + addend = fromValue(addend); + + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = addend.high >>> 16; + var b32 = addend.high & 0xFFFF; + var b16 = addend.low >>> 16; + var b00 = addend.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 + b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the difference of this and the specified Long. + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.subtract = function subtract(subtrahend) { + if (!isLong(subtrahend)) + subtrahend = fromValue(subtrahend); + return this.add(subtrahend.neg()); +}; + +/** + * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. + * @function + * @param {!Long|number|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ +LongPrototype.sub = LongPrototype.subtract; + +/** + * Returns the product of this and the specified Long. + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.multiply = function multiply(multiplier) { + if (this.isZero()) + return this; + if (!isLong(multiplier)) + multiplier = fromValue(multiplier); + + // use wasm support if present + if (wasm) { + var low = wasm.mul(this.low, + this.high, + multiplier.low, + multiplier.high); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + if (multiplier.isZero()) + return (this.unsigned?UZERO:ZERO); + if (this.eq(MIN_VALUE)) + return multiplier.isOdd() ? MIN_VALUE : (this.unsigned?UZERO:ZERO); + if (multiplier.eq(MIN_VALUE)) + return this.isOdd() ? MIN_VALUE : (this.unsigned?UZERO:ZERO); + + if (this.isNegative()) { + if (multiplier.isNegative()) + return this.neg().mul(multiplier.neg()); + else + return this.neg().mul(multiplier).neg(); + } else if (multiplier.isNegative()) + return this.mul(multiplier.neg()).neg(); + + // If both longs are small, use float multiplication + if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) + return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); + + // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xFFFF; + var a16 = this.low >>> 16; + var a00 = this.low & 0xFFFF; + + var b48 = multiplier.high >>> 16; + var b32 = multiplier.high & 0xFFFF; + var b16 = multiplier.low >>> 16; + var b00 = multiplier.low & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xFFFF; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); +}; + +/** + * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. + * @function + * @param {!Long|number|string} multiplier Multiplier + * @returns {!Long} Product + */ +LongPrototype.mul = LongPrototype.multiply; + +/** + * Returns this Long divided by the specified. The result is signed if this Long is signed or + * unsigned if this Long is unsigned. + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.divide = function divide(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + if (divisor.isZero()) + throw Error('division by zero'); + + // use wasm support if present + if (wasm) { + // guard against signed division overflow: the largest + // negative number / -1 would be 1 larger than the largest + // positive number, due to two's complement. + if (!this.unsigned && + this.high === -0x80000000 && + divisor.low === -1 && divisor.high === -1) { + // be consistent with non-wasm code path + return this; + } + var low = (this.unsigned ? wasm.div_u : wasm.div_s)( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + if (this.isZero()) + return this.unsigned ? UZERO : ZERO; + var approx, rem, res; + if (!this.unsigned) { + // This section is only relevant for signed longs and is derived from the + // closure library as a whole. + if (this.eq(MIN_VALUE)) { + if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) + return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + else if (divisor.eq(MIN_VALUE)) + return ONE; + else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shr(1); + approx = halfThis.div(divisor).shl(1); + if (approx.eq(ZERO)) { + return divisor.isNegative() ? ONE : NEG_ONE; + } else { + rem = this.sub(divisor.mul(approx)); + res = approx.add(rem.div(divisor)); + return res; + } + } + } else if (divisor.eq(MIN_VALUE)) + return this.unsigned ? UZERO : ZERO; + if (this.isNegative()) { + if (divisor.isNegative()) + return this.neg().div(divisor.neg()); + return this.neg().div(divisor).neg(); + } else if (divisor.isNegative()) + return this.div(divisor.neg()).neg(); + res = ZERO; + } else { + // The algorithm below has not been made for unsigned longs. It's therefore + // required to take special care of the MSB prior to running it. + if (!divisor.unsigned) + divisor = divisor.toUnsigned(); + if (divisor.gt(this)) + return UZERO; + if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true + return UONE; + res = UZERO; + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + rem = this; + while (rem.gte(divisor)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2), + delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48), + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + approxRes = fromNumber(approx), + approxRem = approxRes.mul(divisor); + while (approxRem.isNegative() || approxRem.gt(rem)) { + approx -= delta; + approxRes = fromNumber(approx, this.unsigned); + approxRem = approxRes.mul(divisor); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) + approxRes = ONE; + + res = res.add(approxRes); + rem = rem.sub(approxRem); + } + return res; +}; + +/** + * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Quotient + */ +LongPrototype.div = LongPrototype.divide; + +/** + * Returns this Long modulo the specified. + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.modulo = function modulo(divisor) { + if (!isLong(divisor)) + divisor = fromValue(divisor); + + // use wasm support if present + if (wasm) { + var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)( + this.low, + this.high, + divisor.low, + divisor.high + ); + return fromBits(low, wasm.get_high(), this.unsigned); + } + + return this.sub(this.div(divisor).mul(divisor)); +}; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.mod = LongPrototype.modulo; + +/** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|string} divisor Divisor + * @returns {!Long} Remainder + */ +LongPrototype.rem = LongPrototype.modulo; + +/** + * Returns the bitwise NOT of this Long. + * @returns {!Long} + */ +LongPrototype.not = function not() { + return fromBits(~this.low, ~this.high, this.unsigned); +}; + +/** + * Returns the bitwise AND of this Long and the specified. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.and = function and(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low & other.low, this.high & other.high, this.unsigned); +}; + +/** + * Returns the bitwise OR of this Long and the specified. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.or = function or(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low | other.low, this.high | other.high, this.unsigned); +}; + +/** + * Returns the bitwise XOR of this Long and the given one. + * @param {!Long|number|string} other Other Long + * @returns {!Long} + */ +LongPrototype.xor = function xor(other) { + if (!isLong(other)) + other = fromValue(other); + return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftLeft = function shiftLeft(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned); + else + return fromBits(0, this.low << (numBits - 32), this.unsigned); +}; + +/** + * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shl = LongPrototype.shiftLeft; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRight = function shiftRight(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + if ((numBits &= 63) === 0) + return this; + else if (numBits < 32) + return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned); + else + return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned); +}; + +/** + * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr = LongPrototype.shiftRight; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { + if (isLong(numBits)) + numBits = numBits.toInt(); + numBits &= 63; + if (numBits === 0) + return this; + else { + var high = this.high; + if (numBits < 32) { + var low = this.low; + return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned); + } else if (numBits === 32) + return fromBits(high, 0, this.unsigned); + else + return fromBits(high >>> (numBits - 32), 0, this.unsigned); + } +}; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shru = LongPrototype.shiftRightUnsigned; + +/** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ +LongPrototype.shr_u = LongPrototype.shiftRightUnsigned; + +/** + * Converts this Long to signed. + * @returns {!Long} Signed long + */ +LongPrototype.toSigned = function toSigned() { + if (!this.unsigned) + return this; + return fromBits(this.low, this.high, false); +}; + +/** + * Converts this Long to unsigned. + * @returns {!Long} Unsigned long + */ +LongPrototype.toUnsigned = function toUnsigned() { + if (this.unsigned) + return this; + return fromBits(this.low, this.high, true); +}; + +/** + * Converts this Long to its byte representation. + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {!Array.} Byte representation + */ +LongPrototype.toBytes = function toBytes(le) { + return le ? this.toBytesLE() : this.toBytesBE(); +}; + +/** + * Converts this Long to its little endian byte representation. + * @returns {!Array.} Little endian byte representation + */ +LongPrototype.toBytesLE = function toBytesLE() { + var hi = this.high, + lo = this.low; + return [ + lo & 0xff, + lo >>> 8 & 0xff, + lo >>> 16 & 0xff, + lo >>> 24 , + hi & 0xff, + hi >>> 8 & 0xff, + hi >>> 16 & 0xff, + hi >>> 24 + ]; +}; + +/** + * Converts this Long to its big endian byte representation. + * @returns {!Array.} Big endian byte representation + */ +LongPrototype.toBytesBE = function toBytesBE() { + var hi = this.high, + lo = this.low; + return [ + hi >>> 24 , + hi >>> 16 & 0xff, + hi >>> 8 & 0xff, + hi & 0xff, + lo >>> 24 , + lo >>> 16 & 0xff, + lo >>> 8 & 0xff, + lo & 0xff + ]; +}; + +/** + * Creates a Long from its byte representation. + * @param {!Array.} bytes Byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {Long} The corresponding Long value + */ +Long.fromBytes = function fromBytes(bytes, unsigned, le) { + return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned); +}; + +/** + * Creates a Long from its little endian byte representation. + * @param {!Array.} bytes Little endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesLE = function fromBytesLE(bytes, unsigned) { + return new Long( + bytes[0] | + bytes[1] << 8 | + bytes[2] << 16 | + bytes[3] << 24, + bytes[4] | + bytes[5] << 8 | + bytes[6] << 16 | + bytes[7] << 24, + unsigned + ); +}; + +/** + * Creates a Long from its big endian byte representation. + * @param {!Array.} bytes Big endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ +Long.fromBytesBE = function fromBytesBE(bytes, unsigned) { + return new Long( + bytes[4] << 24 | + bytes[5] << 16 | + bytes[6] << 8 | + bytes[7], + bytes[0] << 24 | + bytes[1] << 16 | + bytes[2] << 8 | + bytes[3], + unsigned + ); +}; diff --git a/mav_v1.js b/mav_v1.js index 14eeb81..b6c8000 100644 --- a/mav_v1.js +++ b/mav_v1.js @@ -1,7 +1,7 @@ /* MAVLink protocol implementation for node.js (auto-generated by mavgen_javascript.py) -Generated from: ardupilotmega.xml,common.xml,uAvionix.xml,icarous.xml +Generated from: ardupilotmega.xml,common.xml,uAvionix.xml,icarous.xml,minimal.xml Note: this file has been auto-generated. DO NOT EDIT */ @@ -18,7 +18,7 @@ Buffer.prototype.toByteArray = function () { mavlink10 = function(){}; -// Implement the X25CRC function (present in the Python version through the mavutil.py package) +// Implement the CRC-16/MCRF4XX function (present in the Python version through the mavutil.py package) mavlink10.x25Crc = function(buffer, crcIN) { var bytes = buffer; @@ -110,14 +110,35 @@ mavlink10.ACCELCAL_VEHICLE_POS_SUCCESS = 16777215 // mavlink10.ACCELCAL_VEHICLE_POS_FAILED = 16777216 // mavlink10.ACCELCAL_VEHICLE_POS_ENUM_END = 16777217 // +// HEADING_TYPE +mavlink10.HEADING_TYPE_COURSE_OVER_GROUND = 0 // +mavlink10.HEADING_TYPE_HEADING = 1 // +mavlink10.HEADING_TYPE_ENUM_END = 2 // + +// SPEED_TYPE +mavlink10.SPEED_TYPE_AIRSPEED = 0 // +mavlink10.SPEED_TYPE_GROUNDSPEED = 1 // +mavlink10.SPEED_TYPE_ENUM_END = 2 // + // MAV_CMD mavlink10.MAV_CMD_NAV_WAYPOINT = 16 // Navigate to waypoint. mavlink10.MAV_CMD_NAV_LOITER_UNLIM = 17 // Loiter around this waypoint an unlimited amount of time mavlink10.MAV_CMD_NAV_LOITER_TURNS = 18 // Loiter around this waypoint for X turns -mavlink10.MAV_CMD_NAV_LOITER_TIME = 19 // Loiter around this waypoint for X seconds +mavlink10.MAV_CMD_NAV_LOITER_TIME = 19 // Loiter at the specified latitude, longitude and altitude for a certain + // amount of time. Multicopter vehicles stop + // at the point (within a vehicle-specific + // acceptance radius). Forward-only moving + // vehicles (e.g. fixed-wing) circle the point + // with the specified radius/direction. If the + // Heading Required parameter (2) is non-zero + // forward moving aircraft will only leave the + // loiter circle once heading towards the next + // waypoint. mavlink10.MAV_CMD_NAV_RETURN_TO_LAUNCH = 20 // Return to launch location mavlink10.MAV_CMD_NAV_LAND = 21 // Land at location. -mavlink10.MAV_CMD_NAV_TAKEOFF = 22 // Takeoff from ground / hand +mavlink10.MAV_CMD_NAV_TAKEOFF = 22 // Takeoff from ground / hand. Vehicles that support multiple takeoff + // modes (e.g. VTOL quadplane) should take off + // using the currently configured mode. mavlink10.MAV_CMD_NAV_LAND_LOCAL = 23 // Land at local position (local frame only) mavlink10.MAV_CMD_NAV_TAKEOFF_LOCAL = 24 // Takeoff from local position (local frame only) mavlink10.MAV_CMD_NAV_FOLLOW = 25 // Vehicle following, i.e. this waypoint represents the position of a @@ -131,15 +152,18 @@ mavlink10.MAV_CMD_NAV_LOITER_TO_ALT = 31 // Begin loiter at the specified Latitu // 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. + // been reached. Additionally, if the Heading + // Required parameter is non-zero the aircraft + // will not leave the loiter until heading + // toward the next waypoint. mavlink10.MAV_CMD_DO_FOLLOW = 32 // Begin following a target mavlink10.MAV_CMD_DO_FOLLOW_REPOSITION = 33 // Reposition the MAV after a follow target command has been sent +mavlink10.MAV_CMD_DO_ORBIT = 34 // Start orbiting on the circumference of a circle defined by the + // parameters. Setting any value NaN results + // in using defaults. mavlink10.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's control system to control the // vehicle attitude and the attitude of // various sensors such as cameras. mavlink10.MAV_CMD_NAV_PATHPLANNING = 81 // Control autonomous path planning on the MAV. @@ -154,7 +178,10 @@ mavlink10.MAV_CMD_NAV_ALTITUDE_WAIT = 83 // Mission command to wait for an altit // control surfaces to prevent them seizing // up. mavlink10.MAV_CMD_NAV_VTOL_TAKEOFF = 84 // Takeoff from ground using VTOL mode, and transition to forward flight - // with specified heading. + // with specified heading. The command should + // be ignored by vehicles that dont support + // both VTOL and fixed-wing flight + // (multicopters, boats,etc.). mavlink10.MAV_CMD_NAV_VTOL_LAND = 85 // Land using VTOL mode mavlink10.MAV_CMD_NAV_GUIDED_ENABLE = 92 // hand control over to an external controller mavlink10.MAV_CMD_NAV_DELAY = 93 // Delay the next navigation command a number of seconds or until a @@ -169,8 +196,9 @@ mavlink10.MAV_CMD_NAV_PAYLOAD_PLACE = 94 // Descend and place payload. Vehicle m mavlink10.MAV_CMD_NAV_LAST = 95 // NOP - This command is only used to mark the upper limit of the // NAV/ACTION commands in the enumeration mavlink10.MAV_CMD_CONDITION_DELAY = 112 // Delay mission state machine. -mavlink10.MAV_CMD_CONDITION_CHANGE_ALT = 113 // Ascend/descend at rate. Delay mission state machine until desired - // altitude reached. +mavlink10.MAV_CMD_CONDITION_CHANGE_ALT = 113 // Ascend/descend to target altitude at specified rate. Delay mission + // state machine until desired altitude + // reached. mavlink10.MAV_CMD_CONDITION_DISTANCE = 114 // Delay mission state machine until within desired distance of next NAV // point. mavlink10.MAV_CMD_CONDITION_YAW = 115 // Reach a certain target angle. @@ -193,6 +221,11 @@ mavlink10.MAV_CMD_DO_REPEAT_SERVO = 184 // Cycle a between its nominal setting a // number of cycles with a desired period. mavlink10.MAV_CMD_DO_FLIGHTTERMINATION = 185 // Terminate flight immediately mavlink10.MAV_CMD_DO_CHANGE_ALTITUDE = 186 // Change altitude set point. +mavlink10.MAV_CMD_DO_SET_ACTUATOR = 187 // Sets actuators (e.g. servos) to a desired value. The actuator numbers + // are mapped to specific outputs (e.g. on any + // MAIN or AUX PWM or UAVCAN) using a flight- + // stack specific mechanism (i.e. a + // parameter). mavlink10.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 @@ -211,28 +244,44 @@ mavlink10.MAV_CMD_DO_PAUSE_CONTINUE = 193 // If in a GPS controlled position mod // continue. mavlink10.MAV_CMD_DO_SET_REVERSE = 194 // Set moving direction to forward or reverse. mavlink10.MAV_CMD_DO_SET_ROI_LOCATION = 195 // Sets the region of interest (ROI) to a location. This can then be used - // by the vehicles control system to control + // by the vehicle's control system to control // the vehicle attitude and the attitude of - // various sensors such as cameras. + // various sensors such as cameras. This + // command can be sent to a gimbal manager but + // not to a gimbal device. A gimbal is not to + // react to this message. mavlink10.MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET = 196 // Sets the region of interest (ROI) to be toward next waypoint, with // optional pitch/roll/yaw offset. This can - // then be used by the vehicles control system - // to control the vehicle attitude and the - // attitude of various sensors such as - // cameras. + // then be used by the vehicle's control + // system to control the vehicle attitude and + // the attitude of various sensors such as + // cameras. This command can be sent to a + // gimbal manager but not to a gimbal device. + // A gimbal device is not to react to this + // message. mavlink10.MAV_CMD_DO_SET_ROI_NONE = 197 // Cancels any previous ROI command returning the vehicle/sensors to // default flight characteristics. This can - // then be used by the vehicles control system - // to control the vehicle attitude and the - // attitude of various sensors such as - // cameras. + // then be used by the vehicle's control + // system to control the vehicle attitude and + // the attitude of various sensors such as + // cameras. This command can be sent to a + // gimbal manager but not to a gimbal device. + // A gimbal device is not to react to this + // message. After this command the gimbal + // manager should go back to manual input if + // available, and otherwise assume a neutral + // position. mavlink10.MAV_CMD_DO_SET_ROI_SYSID = 198 // Mount tracks system with specified system ID. Determination of target // vehicle position may be done with // GLOBAL_POSITION_INT or any other means. + // This command can be sent to a gimbal + // manager but not to a gimbal device. A + // gimbal device is not to react to this + // message. mavlink10.MAV_CMD_DO_CONTROL_VIDEO = 200 // Control onboard camera system. mavlink10.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's control system to control the // vehicle attitude and the attitude of // various sensors such as cameras. mavlink10.MAV_CMD_DO_DIGICAM_CONFIGURE = 202 // Configure digital camera. This is a fallback message for systems that @@ -253,10 +302,11 @@ mavlink10.MAV_CMD_DO_SET_CAM_TRIGG_DIST = 206 // Mission command to set camera t // to set the shutter integration time for the // camera. mavlink10.MAV_CMD_DO_FENCE_ENABLE = 207 // Mission command to enable the geofence -mavlink10.MAV_CMD_DO_PARACHUTE = 208 // Mission command to trigger a parachute +mavlink10.MAV_CMD_DO_PARACHUTE = 208 // Mission item/command to release a parachute or enable/disable auto + // release. mavlink10.MAV_CMD_DO_MOTOR_TEST = 209 // Mission command to perform motor test. mavlink10.MAV_CMD_DO_INVERTED_FLIGHT = 210 // Change to/from inverted flight. -mavlink10.MAV_CMD_DO_GRIPPER = 211 // Mission command to operate EPM gripper. +mavlink10.MAV_CMD_DO_GRIPPER = 211 // Mission command to operate a gripper. mavlink10.MAV_CMD_DO_AUTOTUNE_ENABLE = 212 // Enable/disable autotune. mavlink10.MAV_CMD_NAV_SET_YAW_SPEED = 213 // Sets a desired vehicle turn angle and speed change. mavlink10.MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL = 214 // Mission command to set camera trigger interval for this flight. If @@ -264,6 +314,8 @@ mavlink10.MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL = 214 // Mission command to set came // triggered each time this interval expires. // This command can also be used to set the // shutter integration time for the camera. +mavlink10.MAV_CMD_DO_SET_RESUME_REPEAT_DIST = 215 // Set the distance to be repeated on mission resume +mavlink10.MAV_CMD_DO_SPRAYER = 216 // Control attached liquid sprayer mavlink10.MAV_CMD_DO_MOUNT_CONTROL_QUAT = 220 // Mission command to control a camera or antenna mount, using a // quaternion as reference. mavlink10.MAV_CMD_DO_GUIDED_MASTER = 221 // set id of master controller @@ -285,21 +337,57 @@ mavlink10.MAV_CMD_PREFLIGHT_CALIBRATION = 241 // Trigger calibration. This comma // be zero. mavlink10.MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS = 242 // Set sensor offsets. This command will be only accepted if in pre- // flight mode. -mavlink10.MAV_CMD_PREFLIGHT_UAVCAN = 243 // Trigger UAVCAN config. This command will be only accepted if in pre- - // flight mode. +mavlink10.MAV_CMD_PREFLIGHT_UAVCAN = 243 // Trigger UAVCAN configuration (actuator ID assignment and direction + // mapping). Note that this maps to the legacy + // UAVCAN v0 function UAVCAN_ENUMERATE, which + // is intended to be executed just once during + // initial vehicle configuration (it is not a + // normal pre-flight command and has been + // poorly named). mavlink10.MAV_CMD_PREFLIGHT_STORAGE = 245 // Request storage of different parameter values and logs. This command // will be only accepted if in pre-flight // mode. mavlink10.MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN = 246 // Request the reboot or shutdown of system components. +mavlink10.MAV_CMD_DO_UPGRADE = 247 // Request a target system to start an upgrade of one (or all) of its + // components. For example, the command might + // be sent to a companion computer to cause it + // to upgrade a connected flight controller. + // The system doing the upgrade will report + // progress using the normal command protocol + // sequence for a long running operation. + // Command protocol information: https://mavli + // nk.io/en/services/command.html. mavlink10.MAV_CMD_OVERRIDE_GOTO = 252 // Override current mission with command to pause mission, pause mission // and move to position, continue/resume // mission. When param 1 indicates that the // mission is paused (MAV_GOTO_DO_HOLD), param // 2 defines whether it holds in place or // moves to another position. +mavlink10.MAV_CMD_OBLIQUE_SURVEY = 260 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey + // (Replaces CAM_TRIGG_DIST for this purpose). + // The camera is triggered each time this + // distance is exceeded, then the mount moves + // to the next position. Params 4~6 set-up the + // angle limits and number of positions for + // oblique survey, where mount-enabled + // vehicles automatically roll the camera + // between shots to emulate an oblique camera + // setup (providing an increased HFOV). This + // command can also be used to set the shutter + // integration time for the camera. mavlink10.MAV_CMD_MISSION_START = 300 // start running a mission mavlink10.MAV_CMD_COMPONENT_ARM_DISARM = 400 // Arms / Disarms a component +mavlink10.MAV_CMD_ILLUMINATOR_ON_OFF = 405 // Turns illuminators ON/OFF. An illuminator is a light source that is + // used for lighting up dark areas external to + // the sytstem: e.g. a torch or searchlight + // (as opposed to a light source for + // illuminating the system itself, e.g. an + // indicator light). mavlink10.MAV_CMD_GET_HOME_POSITION = 410 // Request the home position from the vehicle. +mavlink10.MAV_CMD_INJECT_FAILURE = 420 // Inject artificial failure for testing purposes. Note that autopilots + // should implement an additional protection + // before accepting this command such as a + // specific param setting. mavlink10.MAV_CMD_START_RX_PAIR = 500 // Starts receiver pairing. mavlink10.MAV_CMD_GET_MESSAGE_INTERVAL = 510 // Request the interval between messages for a particular MAVLink message // ID. The receiver should ACK the command and @@ -311,6 +399,9 @@ mavlink10.MAV_CMD_SET_MESSAGE_INTERVAL = 511 // Set the interval between message mavlink10.MAV_CMD_REQUEST_MESSAGE = 512 // Request the target system(s) emit a single instance of a specified // message (i.e. a "one-shot" version of // MAV_CMD_SET_MESSAGE_INTERVAL). +mavlink10.MAV_CMD_REQUEST_PROTOCOL_VERSION = 519 // Request MAVLink protocol version compatibility. All receivers should + // ACK the command and then emit their + // capabilities in an PROTOCOL_VERSION message mavlink10.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES = 520 // Request autopilot capabilities. The receiver should ACK the command // and then emit its capabilities in an // AUTOPILOT_VERSION message @@ -330,6 +421,10 @@ mavlink10.MAV_CMD_SET_CAMERA_MODE = 530 // Set camera running mode. Use NaN for // MAV_CMD_REQUEST_VIDEO_STREAM_STATUS command // after a mode change if the camera supports // video streaming. +mavlink10.MAV_CMD_SET_CAMERA_ZOOM = 531 // Set camera zoom. Camera must respond with a CAMERA_SETTINGS message + // (on success). +mavlink10.MAV_CMD_SET_CAMERA_FOCUS = 532 // Set camera focus. Camera must respond with a CAMERA_SETTINGS message + // (on success). mavlink10.MAV_CMD_JUMP_TAG = 600 // Tagged jump target. Can be jumped to with MAV_CMD_DO_JUMP_TAG. mavlink10.MAV_CMD_DO_JUMP_TAG = 601 // Jump to the matching tag in the mission list. Repeat this action for // the specified number of times. A mission @@ -340,13 +435,45 @@ mavlink10.MAV_CMD_DO_JUMP_TAG = 601 // Jump to the matching tag in the mission l // multiple matching tags should always select // the one with the lowest mission sequence // number. +mavlink10.MAV_CMD_PARAM_TRANSACTION = 900 // Request to start or end a parameter transaction. Multiple kinds of + // transport layers can be used to exchange + // parameters in the transaction (param, + // param_ext and mavftp). The command response + // can either be a success/failure or an in + // progress in case the receiving side takes + // some time to apply the parameters. +mavlink10.MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW = 1000 // High level setpoint to be sent to a gimbal manager to set a gimbal + // attitude. It is possible to set + // combinations of the values below. E.g. an + // angle as well as a desired angular rate can + // be used to get to this angle at a certain + // angular rate, or an angular rate only will + // result in continuous turning. NaN is to be + // used to signal unset. Note: a gimbal is + // never to react to this command but only the + // gimbal manager. +mavlink10.MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE = 1001 // Gimbal configuration to set which sysid/compid is in primary and + // secondary control. mavlink10.MAV_CMD_IMAGE_START_CAPTURE = 2000 // Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each // capture. Use NaN for reserved values. mavlink10.MAV_CMD_IMAGE_STOP_CAPTURE = 2001 // Stop image capture sequence Use NaN for reserved values. +mavlink10.MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE = 2002 // Re-request a CAMERA_IMAGE_CAPTURED message. mavlink10.MAV_CMD_DO_TRIGGER_CONTROL = 2003 // Enable or disable on-board camera triggering system. -mavlink10.MAV_CMD_VIDEO_START_CAPTURE = 2500 // Starts video capture (recording). Use NaN for reserved values. -mavlink10.MAV_CMD_VIDEO_STOP_CAPTURE = 2501 // Stop the current video capture (recording). Use NaN for reserved - // values. +mavlink10.MAV_CMD_CAMERA_TRACK_POINT = 2004 // If the camera supports point visual tracking + // (CAMERA_CAP_FLAGS_HAS_TRACKING_POINT is + // set), this command allows to initiate the + // tracking. +mavlink10.MAV_CMD_CAMERA_TRACK_RECTANGLE = 2005 // If the camera supports rectangle visual tracking + // (CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE is + // set), this command allows to initiate the + // tracking. +mavlink10.MAV_CMD_CAMERA_STOP_TRACKING = 2010 // Stops ongoing tracking. +mavlink10.MAV_CMD_VIDEO_START_CAPTURE = 2500 // Starts video capture (recording). +mavlink10.MAV_CMD_VIDEO_STOP_CAPTURE = 2501 // Stop the current video capture (recording). +mavlink10.MAV_CMD_VIDEO_START_STREAMING = 2502 // Start video streaming +mavlink10.MAV_CMD_VIDEO_STOP_STREAMING = 2503 // Stop the given video stream +mavlink10.MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION = 2504 // Request video stream information (VIDEO_STREAM_INFORMATION) +mavlink10.MAV_CMD_REQUEST_VIDEO_STREAM_STATUS = 2505 // Request video stream status (VIDEO_STREAM_STATUS) mavlink10.MAV_CMD_LOGGING_START = 2510 // Request to start streaming logging data over MAVLink (see also // LOGGING_DATA message) mavlink10.MAV_CMD_LOGGING_STOP = 2511 // Request to stop streaming log data over MAVLink @@ -374,7 +501,10 @@ mavlink10.MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE = 4001 // This command sets submode // the velocity along the circle and change // the radius. If no input is given the // vehicle will hold position. -mavlink10.MAV_CMD_NAV_FENCE_RETURN_POINT = 5000 // Fence return point. There can only be one fence return point. +mavlink10.MAV_CMD_CONDITION_GATE = 4501 // Delay mission state machine until gate has been reached. +mavlink10.MAV_CMD_NAV_FENCE_RETURN_POINT = 5000 // Fence return point (there can only be one such point in a geofence + // definition). If rally points are supported + // they should be used instead. mavlink10.MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION = 5001 // Fence vertex for an inclusion polygon (the polygon must not be self- // intersecting). The vehicle must stay within // this area. Minimum of 3 vertices required. @@ -447,8 +577,7 @@ mavlink10.MAV_CMD_SOLO_BTN_PAUSE_CLICK = 42003 // PAUSE button has been clicked. mavlink10.MAV_CMD_FIXED_MAG_CAL = 42004 // Magnetometer calibration based on fixed position in earth // field given by inclination, declination and // intensity. -mavlink10.MAV_CMD_FIXED_MAG_CAL_FIELD = 42005 // Magnetometer calibration based on fixed expected field values in - // milliGauss. +mavlink10.MAV_CMD_FIXED_MAG_CAL_FIELD = 42005 // Magnetometer calibration based on fixed expected field values. mavlink10.MAV_CMD_FIXED_MAG_CAL_YAW = 42006 // Magnetometer calibration based on provided known yaw. This allows for // fast calibration using WMM field tables in // the vehicle, given only the known yaw of @@ -456,7 +585,7 @@ mavlink10.MAV_CMD_FIXED_MAG_CAL_YAW = 42006 // Magnetometer calibration based on // both zero then use the current vehicle // location. mavlink10.MAV_CMD_DO_START_MAG_CAL = 42424 // Initiate a magnetometer calibration. -mavlink10.MAV_CMD_DO_ACCEPT_MAG_CAL = 42425 // Initiate a magnetometer calibration. +mavlink10.MAV_CMD_DO_ACCEPT_MAG_CAL = 42425 // Accept a magnetometer calibration. mavlink10.MAV_CMD_DO_CANCEL_MAG_CAL = 42426 // Cancel a running magnetometer calibration. mavlink10.MAV_CMD_SET_FACTORY_TEST_MODE = 42427 // Command autopilot to get into factory test/diagnostic mode. mavlink10.MAV_CMD_DO_SEND_BANNER = 42428 // Reply with the version banner. @@ -473,7 +602,38 @@ mavlink10.MAV_CMD_DO_WINCH = 42600 // Command to operate winch. mavlink10.MAV_CMD_FLASH_BOOTLOADER = 42650 // Update the bootloader mavlink10.MAV_CMD_BATTERY_RESET = 42651 // Reset battery capacity for batteries that accumulate consumed battery // via integration. -mavlink10.MAV_CMD_ENUM_END = 42652 // +mavlink10.MAV_CMD_DEBUG_TRAP = 42700 // Issue a trap signal to the autopilot process, presumably to enter the + // debugger. +mavlink10.MAV_CMD_SCRIPTING = 42701 // Control onboard scripting. +mavlink10.MAV_CMD_GUIDED_CHANGE_SPEED = 43000 // Change flight speed at a given rate. This slews the vehicle at a + // controllable rate between it's previous + // speed and the new one. (affects GUIDED + // only. Outside GUIDED, aircraft ignores + // these commands. Designed for onboard + // companion-computer command-and-control, not + // normally operator/GCS control.) +mavlink10.MAV_CMD_GUIDED_CHANGE_ALTITUDE = 43001 // Change target altitude at a given rate. This slews the vehicle at a + // controllable rate between it's previous + // altitude and the new one. (affects GUIDED + // only. Outside GUIDED, aircraft ignores + // these commands. Designed for onboard + // companion-computer command-and-control, not + // normally operator/GCS control.) +mavlink10.MAV_CMD_GUIDED_CHANGE_HEADING = 43002 // Change to target heading at a given rate, overriding previous + // heading/s. This slews the vehicle at a + // controllable rate between it's previous + // heading and the new one. (affects GUIDED + // only. Exiting GUIDED returns aircraft to + // normal behaviour defined elsewhere. + // Designed for onboard companion-computer + // command-and-control, not normally + // operator/GCS control.) +mavlink10.MAV_CMD_ENUM_END = 43003 // + +// SCRIPTING_CMD +mavlink10.SCRIPTING_CMD_REPL_START = 0 // Start a REPL session. +mavlink10.SCRIPTING_CMD_REPL_STOP = 1 // End a REPL session. +mavlink10.SCRIPTING_CMD_ENUM_END = 2 // // LIMITS_STATE mavlink10.LIMITS_INIT = 0 // Pre-initialization. @@ -498,18 +658,6 @@ mavlink10.LAND_IMMEDIATELY = 2 // Flag set when plane is to immediately descend // until commanded to land. mavlink10.RALLY_FLAGS_ENUM_END = 3 // -// GRIPPER_ACTIONS -mavlink10.GRIPPER_ACTION_RELEASE = 0 // Gripper release cargo. -mavlink10.GRIPPER_ACTION_GRAB = 1 // Gripper grab onto cargo. -mavlink10.GRIPPER_ACTIONS_ENUM_END = 2 // - -// WINCH_ACTIONS -mavlink10.WINCH_RELAXED = 0 // Relax winch. -mavlink10.WINCH_RELATIVE_LENGTH_CONTROL = 1 // Winch unwinds or winds specified length of cable optionally using - // specified rate. -mavlink10.WINCH_RATE_CONTROL = 2 // Winch unwinds or winds cable at specified rate in meters/seconds. -mavlink10.WINCH_ACTIONS_ENUM_END = 3 // - // CAMERA_STATUS_TYPES mavlink10.CAMERA_STATUS_TYPE_HEARTBEAT = 0 // Camera heartbeat, announce camera component ID at 1Hz. mavlink10.CAMERA_STATUS_TYPE_TRIGGER = 1 // Camera image triggered. @@ -762,7 +910,8 @@ mavlink10.EKF_PRED_POS_HORIZ_REL = 256 // Set if EKF's predicted horizontal posi // good. mavlink10.EKF_PRED_POS_HORIZ_ABS = 512 // Set if EKF's predicted horizontal position (absolute) estimate is // good. -mavlink10.EKF_STATUS_FLAGS_ENUM_END = 513 // +mavlink10.EKF_UNINITIALIZED = 1024 // Set if EKF has never been healthy. +mavlink10.EKF_STATUS_FLAGS_ENUM_END = 1025 // // PID_TUNING_AXIS mavlink10.PID_TUNING_ROLL = 1 // @@ -773,17 +922,6 @@ mavlink10.PID_TUNING_STEER = 5 // mavlink10.PID_TUNING_LANDING = 6 // mavlink10.PID_TUNING_AXIS_ENUM_END = 7 // -// MAG_CAL_STATUS -mavlink10.MAG_CAL_NOT_STARTED = 0 // -mavlink10.MAG_CAL_WAITING_TO_START = 1 // -mavlink10.MAG_CAL_RUNNING_STEP_ONE = 2 // -mavlink10.MAG_CAL_RUNNING_STEP_TWO = 3 // -mavlink10.MAG_CAL_SUCCESS = 4 // -mavlink10.MAG_CAL_FAILED = 5 // -mavlink10.MAG_CAL_BAD_ORIENTATION = 6 // -mavlink10.MAG_CAL_BAD_RADIUS = 7 // -mavlink10.MAG_CAL_STATUS_ENUM_END = 8 // - // MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS mavlink10.MAV_REMOTE_LOG_DATA_BLOCK_STOP = 2147483645 // UAV to stop sending DataFlash blocks. mavlink10.MAV_REMOTE_LOG_DATA_BLOCK_START = 2147483646 // UAV to start sending DataFlash blocks. @@ -832,7 +970,9 @@ mavlink10.PLANE_MODE_QLOITER = 19 // mavlink10.PLANE_MODE_QLAND = 20 // mavlink10.PLANE_MODE_QRTL = 21 // mavlink10.PLANE_MODE_QAUTOTUNE = 22 // -mavlink10.PLANE_MODE_ENUM_END = 23 // +mavlink10.PLANE_MODE_QACRO = 23 // +mavlink10.PLANE_MODE_THERMAL = 24 // +mavlink10.PLANE_MODE_ENUM_END = 25 // // COPTER_MODE mavlink10.COPTER_MODE_STABILIZE = 0 // @@ -854,7 +994,12 @@ mavlink10.COPTER_MODE_THROW = 18 // mavlink10.COPTER_MODE_AVOID_ADSB = 19 // mavlink10.COPTER_MODE_GUIDED_NOGPS = 20 // mavlink10.COPTER_MODE_SMART_RTL = 21 // -mavlink10.COPTER_MODE_ENUM_END = 22 // +mavlink10.COPTER_MODE_FLOWHOLD = 22 // +mavlink10.COPTER_MODE_FOLLOW = 23 // +mavlink10.COPTER_MODE_ZIGZAG = 24 // +mavlink10.COPTER_MODE_SYSTEMID = 25 // +mavlink10.COPTER_MODE_AUTOROTATE = 26 // +mavlink10.COPTER_MODE_ENUM_END = 27 // // SUB_MODE mavlink10.SUB_MODE_STABILIZE = 0 // @@ -874,6 +1019,8 @@ mavlink10.ROVER_MODE_ACRO = 1 // mavlink10.ROVER_MODE_STEERING = 3 // mavlink10.ROVER_MODE_HOLD = 4 // mavlink10.ROVER_MODE_LOITER = 5 // +mavlink10.ROVER_MODE_FOLLOW = 6 // +mavlink10.ROVER_MODE_SIMPLE = 7 // mavlink10.ROVER_MODE_AUTO = 10 // mavlink10.ROVER_MODE_RTL = 11 // mavlink10.ROVER_MODE_SMART_RTL = 12 // @@ -890,68 +1037,24 @@ mavlink10.TRACKER_MODE_AUTO = 10 // mavlink10.TRACKER_MODE_INITIALIZING = 16 // mavlink10.TRACKER_MODE_ENUM_END = 17 // -// MAV_AUTOPILOT -mavlink10.MAV_AUTOPILOT_GENERIC = 0 // Generic autopilot, full support for everything -mavlink10.MAV_AUTOPILOT_RESERVED = 1 // Reserved for future use. -mavlink10.MAV_AUTOPILOT_SLUGS = 2 // SLUGS autopilot, http://slugsuav.soe.ucsc.edu -mavlink10.MAV_AUTOPILOT_ARDUPILOTMEGA = 3 // ArduPilot - Plane/Copter/Rover/Sub/Tracker, http://ardupilot.org -mavlink10.MAV_AUTOPILOT_OPENPILOT = 4 // OpenPilot, http://openpilot.org -mavlink10.MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5 // Generic autopilot only supporting simple waypoints -mavlink10.MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6 // Generic autopilot supporting waypoints and other simple navigation - // commands -mavlink10.MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7 // Generic autopilot supporting the full mission command set -mavlink10.MAV_AUTOPILOT_INVALID = 8 // No valid autopilot, e.g. a GCS or other MAVLink component -mavlink10.MAV_AUTOPILOT_PPZ = 9 // PPZ UAV - http://nongnu.org/paparazzi -mavlink10.MAV_AUTOPILOT_UDB = 10 // UAV Dev Board -mavlink10.MAV_AUTOPILOT_FP = 11 // FlexiPilot -mavlink10.MAV_AUTOPILOT_PX4 = 12 // PX4 Autopilot - http://px4.io/ -mavlink10.MAV_AUTOPILOT_SMACCMPILOT = 13 // SMACCMPilot - http://smaccmpilot.org -mavlink10.MAV_AUTOPILOT_AUTOQUAD = 14 // AutoQuad -- http://autoquad.org -mavlink10.MAV_AUTOPILOT_ARMAZILA = 15 // Armazila -- http://armazila.com -mavlink10.MAV_AUTOPILOT_AEROB = 16 // Aerob -- http://aerob.ru -mavlink10.MAV_AUTOPILOT_ASLUAV = 17 // ASLUAV autopilot -- http://www.asl.ethz.ch -mavlink10.MAV_AUTOPILOT_SMARTAP = 18 // SmartAP Autopilot - http://sky-drones.com -mavlink10.MAV_AUTOPILOT_AIRRAILS = 19 // AirRails - http://uaventure.com -mavlink10.MAV_AUTOPILOT_ENUM_END = 20 // - -// MAV_TYPE -mavlink10.MAV_TYPE_GENERIC = 0 // Generic micro air vehicle -mavlink10.MAV_TYPE_FIXED_WING = 1 // Fixed wing aircraft. -mavlink10.MAV_TYPE_QUADROTOR = 2 // Quadrotor -mavlink10.MAV_TYPE_COAXIAL = 3 // Coaxial helicopter -mavlink10.MAV_TYPE_HELICOPTER = 4 // Normal helicopter with tail rotor. -mavlink10.MAV_TYPE_ANTENNA_TRACKER = 5 // Ground installation -mavlink10.MAV_TYPE_GCS = 6 // Operator control unit / ground control station -mavlink10.MAV_TYPE_AIRSHIP = 7 // Airship, controlled -mavlink10.MAV_TYPE_FREE_BALLOON = 8 // Free balloon, uncontrolled -mavlink10.MAV_TYPE_ROCKET = 9 // Rocket -mavlink10.MAV_TYPE_GROUND_ROVER = 10 // Ground rover -mavlink10.MAV_TYPE_SURFACE_BOAT = 11 // Surface vessel, boat, ship -mavlink10.MAV_TYPE_SUBMARINE = 12 // Submarine -mavlink10.MAV_TYPE_HEXAROTOR = 13 // Hexarotor -mavlink10.MAV_TYPE_OCTOROTOR = 14 // Octorotor -mavlink10.MAV_TYPE_TRICOPTER = 15 // Tricopter -mavlink10.MAV_TYPE_FLAPPING_WING = 16 // Flapping wing -mavlink10.MAV_TYPE_KITE = 17 // Kite -mavlink10.MAV_TYPE_ONBOARD_CONTROLLER = 18 // Onboard companion controller -mavlink10.MAV_TYPE_VTOL_DUOROTOR = 19 // Two-rotor VTOL using control surfaces in vertical operation in - // addition. Tailsitter. -mavlink10.MAV_TYPE_VTOL_QUADROTOR = 20 // Quad-rotor VTOL using a V-shaped quad config in vertical operation. - // Tailsitter. -mavlink10.MAV_TYPE_VTOL_TILTROTOR = 21 // Tiltrotor VTOL -mavlink10.MAV_TYPE_VTOL_RESERVED2 = 22 // VTOL reserved 2 -mavlink10.MAV_TYPE_VTOL_RESERVED3 = 23 // VTOL reserved 3 -mavlink10.MAV_TYPE_VTOL_RESERVED4 = 24 // VTOL reserved 4 -mavlink10.MAV_TYPE_VTOL_RESERVED5 = 25 // VTOL reserved 5 -mavlink10.MAV_TYPE_GIMBAL = 26 // Gimbal -mavlink10.MAV_TYPE_ADSB = 27 // ADSB system -mavlink10.MAV_TYPE_PARAFOIL = 28 // Steerable, nonrigid airfoil -mavlink10.MAV_TYPE_DODECAROTOR = 29 // Dodecarotor -mavlink10.MAV_TYPE_CAMERA = 30 // Camera -mavlink10.MAV_TYPE_CHARGING_STATION = 31 // Charging station -mavlink10.MAV_TYPE_FLARM = 32 // FLARM collision avoidance system -mavlink10.MAV_TYPE_SERVO = 33 // Servo -mavlink10.MAV_TYPE_ENUM_END = 34 // +// OSD_PARAM_CONFIG_TYPE +mavlink10.OSD_PARAM_NONE = 0 // +mavlink10.OSD_PARAM_SERIAL_PROTOCOL = 1 // +mavlink10.OSD_PARAM_SERVO_FUNCTION = 2 // +mavlink10.OSD_PARAM_AUX_FUNCTION = 3 // +mavlink10.OSD_PARAM_FLIGHT_MODE = 4 // +mavlink10.OSD_PARAM_FAILSAFE_ACTION = 5 // +mavlink10.OSD_PARAM_FAILSAFE_ACTION_1 = 6 // +mavlink10.OSD_PARAM_FAILSAFE_ACTION_2 = 7 // +mavlink10.OSD_PARAM_NUM_TYPES = 8 // +mavlink10.OSD_PARAM_CONFIG_TYPE_ENUM_END = 9 // + +// OSD_PARAM_CONFIG_ERROR +mavlink10.OSD_PARAM_SUCCESS = 0 // +mavlink10.OSD_PARAM_INVALID_SCREEN = 1 // +mavlink10.OSD_PARAM_INVALID_PARAMETER_INDEX = 2 // +mavlink10.OSD_PARAM_INVALID_PARAMETER = 3 // +mavlink10.OSD_PARAM_CONFIG_ERROR_ENUM_END = 4 // // FIRMWARE_VERSION_TYPE mavlink10.FIRMWARE_VERSION_TYPE_DEV = 0 // development release @@ -961,42 +1064,23 @@ mavlink10.FIRMWARE_VERSION_TYPE_RC = 192 // release candidate mavlink10.FIRMWARE_VERSION_TYPE_OFFICIAL = 255 // official stable release mavlink10.FIRMWARE_VERSION_TYPE_ENUM_END = 256 // -// MAV_MODE_FLAG -mavlink10.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1 // 0b00000001 Reserved for future use. -mavlink10.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. -mavlink10.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. -mavlink10.MAV_MODE_FLAG_GUIDED_ENABLED = 8 // 0b00001000 guided mode enabled, system flies waypoints / mission - // items. -mavlink10.MAV_MODE_FLAG_STABILIZE_ENABLED = 16 // 0b00010000 system stabilizes electronically its attitude (and - // optionally position). It needs however - // further control inputs to move around. -mavlink10.MAV_MODE_FLAG_HIL_ENABLED = 32 // 0b00100000 hardware in the loop simulation. All motors / actuators are - // blocked, but internal software is full - // operational. -mavlink10.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64 // 0b01000000 remote control input is enabled. -mavlink10.MAV_MODE_FLAG_SAFETY_ARMED = 128 // 0b10000000 MAV safety set to armed. Motors are enabled / running / can - // start. Ready to fly. Additional note: this - // flag is to be ignore when sent in the - // command MAV_CMD_DO_SET_MODE and - // MAV_CMD_COMPONENT_ARM_DISARM shall be used - // instead. The flag can still be used to - // report the armed state. -mavlink10.MAV_MODE_FLAG_ENUM_END = 129 // - -// MAV_MODE_FLAG_DECODE_POSITION -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1 // Eighth bit: 00000001 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_TEST = 2 // Seventh bit: 00000010 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4 // Sixth bit: 00000100 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8 // Fifth bit: 00001000 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16 // Fourth bit: 00010000 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_HIL = 32 // Third bit: 00100000 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64 // Second bit: 01000000 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128 // First bit: 10000000 -mavlink10.MAV_MODE_FLAG_DECODE_POSITION_ENUM_END = 129 // +// HL_FAILURE_FLAG +mavlink10.HL_FAILURE_FLAG_GPS = 1 // GPS failure. +mavlink10.HL_FAILURE_FLAG_DIFFERENTIAL_PRESSURE = 2 // Differential pressure sensor failure. +mavlink10.HL_FAILURE_FLAG_ABSOLUTE_PRESSURE = 4 // Absolute pressure sensor failure. +mavlink10.HL_FAILURE_FLAG_3D_ACCEL = 8 // Accelerometer sensor failure. +mavlink10.HL_FAILURE_FLAG_3D_GYRO = 16 // Gyroscope sensor failure. +mavlink10.HL_FAILURE_FLAG_3D_MAG = 32 // Magnetometer sensor failure. +mavlink10.HL_FAILURE_FLAG_TERRAIN = 64 // Terrain subsystem failure. +mavlink10.HL_FAILURE_FLAG_BATTERY = 128 // Battery failure/critical low battery. +mavlink10.HL_FAILURE_FLAG_RC_RECEIVER = 256 // RC receiver failure/no rc connection. +mavlink10.HL_FAILURE_FLAG_OFFBOARD_LINK = 512 // Offboard link failure. +mavlink10.HL_FAILURE_FLAG_ENGINE = 1024 // Engine failure. +mavlink10.HL_FAILURE_FLAG_GEOFENCE = 2048 // Geofence violation. +mavlink10.HL_FAILURE_FLAG_ESTIMATOR = 4096 // Estimator failure, for example measurement rejection or large + // variances. +mavlink10.HL_FAILURE_FLAG_MISSION = 8192 // Mission failure. +mavlink10.HL_FAILURE_FLAG_ENUM_END = 8193 // // MAV_GOTO mavlink10.MAV_GOTO_DO_HOLD = 0 // Hold at the current position. @@ -1031,350 +1115,53 @@ mavlink10.MAV_MODE_AUTO_ARMED = 220 // System is allowed to be active, under aut // waypoints) mavlink10.MAV_MODE_ENUM_END = 221 // -// MAV_STATE -mavlink10.MAV_STATE_UNINIT = 0 // Uninitialized system, state is unknown. -mavlink10.MAV_STATE_BOOT = 1 // System is booting up. -mavlink10.MAV_STATE_CALIBRATING = 2 // System is calibrating and not flight-ready. -mavlink10.MAV_STATE_STANDBY = 3 // System is grounded and on standby. It can be launched any time. -mavlink10.MAV_STATE_ACTIVE = 4 // System is active and might be already airborne. Motors are engaged. -mavlink10.MAV_STATE_CRITICAL = 5 // System is in a non-normal flight mode. It can however still navigate. -mavlink10.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. -mavlink10.MAV_STATE_POWEROFF = 7 // System just initialized its power-down sequence, will shut down now. -mavlink10.MAV_STATE_FLIGHT_TERMINATION = 8 // System is terminating itself. -mavlink10.MAV_STATE_ENUM_END = 9 // - -// MAV_COMPONENT -mavlink10.MAV_COMP_ID_ALL = 0 // Target id (target_component) used to broadcast messages to all - // components of the receiving system. - // Components should attempt to process - // messages with this component ID and forward - // to components on any other interfaces. - // Note: This is not a valid *source* - // component id for a message. -mavlink10.MAV_COMP_ID_AUTOPILOT1 = 1 // System flight controller component ("autopilot"). Only one autopilot - // is expected in a particular system. -mavlink10.MAV_COMP_ID_USER1 = 25 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER2 = 26 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER3 = 27 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER4 = 28 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER5 = 29 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER6 = 30 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER7 = 31 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER8 = 32 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER9 = 33 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER10 = 34 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER11 = 35 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER12 = 36 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER13 = 37 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER14 = 38 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER15 = 39 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USE16 = 40 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER17 = 41 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER18 = 42 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER19 = 43 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER20 = 44 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER21 = 45 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER22 = 46 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER23 = 47 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER24 = 48 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER25 = 49 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER26 = 50 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER27 = 51 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER28 = 52 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER29 = 53 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER30 = 54 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER31 = 55 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER32 = 56 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER33 = 57 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER34 = 58 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER35 = 59 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER36 = 60 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER37 = 61 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER38 = 62 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER39 = 63 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER40 = 64 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER41 = 65 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER42 = 66 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER43 = 67 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER44 = 68 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER45 = 69 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER46 = 70 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER47 = 71 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER48 = 72 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER49 = 73 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER50 = 74 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER51 = 75 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER52 = 76 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER53 = 77 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER54 = 78 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER55 = 79 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER56 = 80 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER57 = 81 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER58 = 82 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER59 = 83 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER60 = 84 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER61 = 85 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER62 = 86 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER63 = 87 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER64 = 88 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER65 = 89 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER66 = 90 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER67 = 91 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER68 = 92 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER69 = 93 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER70 = 94 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER71 = 95 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER72 = 96 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER73 = 97 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER74 = 98 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_USER75 = 99 // Id for a component on privately managed MAVLink network. Can be used - // for any purpose but may not be published by - // components outside of the private network. -mavlink10.MAV_COMP_ID_CAMERA = 100 // Camera #1. -mavlink10.MAV_COMP_ID_CAMERA2 = 101 // Camera #2. -mavlink10.MAV_COMP_ID_CAMERA3 = 102 // Camera #3. -mavlink10.MAV_COMP_ID_CAMERA4 = 103 // Camera #4. -mavlink10.MAV_COMP_ID_CAMERA5 = 104 // Camera #5. -mavlink10.MAV_COMP_ID_CAMERA6 = 105 // Camera #6. -mavlink10.MAV_COMP_ID_SERVO1 = 140 // Servo #1. -mavlink10.MAV_COMP_ID_SERVO2 = 141 // Servo #2. -mavlink10.MAV_COMP_ID_SERVO3 = 142 // Servo #3. -mavlink10.MAV_COMP_ID_SERVO4 = 143 // Servo #4. -mavlink10.MAV_COMP_ID_SERVO5 = 144 // Servo #5. -mavlink10.MAV_COMP_ID_SERVO6 = 145 // Servo #6. -mavlink10.MAV_COMP_ID_SERVO7 = 146 // Servo #7. -mavlink10.MAV_COMP_ID_SERVO8 = 147 // Servo #8. -mavlink10.MAV_COMP_ID_SERVO9 = 148 // Servo #9. -mavlink10.MAV_COMP_ID_SERVO10 = 149 // Servo #10. -mavlink10.MAV_COMP_ID_SERVO11 = 150 // Servo #11. -mavlink10.MAV_COMP_ID_SERVO12 = 151 // Servo #12. -mavlink10.MAV_COMP_ID_SERVO13 = 152 // Servo #13. -mavlink10.MAV_COMP_ID_SERVO14 = 153 // Servo #14. -mavlink10.MAV_COMP_ID_GIMBAL = 154 // Gimbal #1. -mavlink10.MAV_COMP_ID_LOG = 155 // Logging component. -mavlink10.MAV_COMP_ID_ADSB = 156 // Automatic Dependent Surveillance-Broadcast (ADS-B) component. -mavlink10.MAV_COMP_ID_OSD = 157 // On Screen Display (OSD) devices for video links. -mavlink10.MAV_COMP_ID_PERIPHERAL = 158 // Generic autopilot peripheral component ID. Meant for devices that do - // not implement the parameter microservice. -mavlink10.MAV_COMP_ID_QX1_GIMBAL = 159 // Gimbal ID for QX1. -mavlink10.MAV_COMP_ID_FLARM = 160 // FLARM collision alert component. -mavlink10.MAV_COMP_ID_GIMBAL2 = 171 // Gimbal #2. -mavlink10.MAV_COMP_ID_GIMBAL3 = 172 // Gimbal #3. -mavlink10.MAV_COMP_ID_GIMBAL4 = 173 // Gimbal #4 -mavlink10.MAV_COMP_ID_GIMBAL5 = 174 // Gimbal #5. -mavlink10.MAV_COMP_ID_GIMBAL6 = 175 // Gimbal #6. -mavlink10.MAV_COMP_ID_MISSIONPLANNER = 190 // Component that can generate/supply a mission flight plan (e.g. GCS or - // developer API). -mavlink10.MAV_COMP_ID_PATHPLANNER = 195 // Component that finds an optimal path between points based on a certain - // constraint (e.g. minimum snap, shortest - // path, cost, etc.). -mavlink10.MAV_COMP_ID_OBSTACLE_AVOIDANCE = 196 // Component that plans a collision free path between two points. -mavlink10.MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY = 197 // Component that provides position estimates using VIO techniques. -mavlink10.MAV_COMP_ID_IMU = 200 // Inertial Measurement Unit (IMU) #1. -mavlink10.MAV_COMP_ID_IMU_2 = 201 // Inertial Measurement Unit (IMU) #2. -mavlink10.MAV_COMP_ID_IMU_3 = 202 // Inertial Measurement Unit (IMU) #3. -mavlink10.MAV_COMP_ID_GPS = 220 // GPS #1. -mavlink10.MAV_COMP_ID_GPS2 = 221 // GPS #2. -mavlink10.MAV_COMP_ID_UDP_BRIDGE = 240 // Component to bridge MAVLink to UDP (i.e. from a UART). -mavlink10.MAV_COMP_ID_UART_BRIDGE = 241 // Component to bridge to UART (i.e. from UDP). -mavlink10.MAV_COMP_ID_SYSTEM_CONTROL = 250 // Component for handling system messages (e.g. to ARM, takeoff, etc.). -mavlink10.MAV_COMPONENT_ENUM_END = 251 // - -// MAV_SYS_STATUS_SENSOR -mavlink10.MAV_SYS_STATUS_SENSOR_3D_GYRO = 1 // 0x01 3D gyro -mavlink10.MAV_SYS_STATUS_SENSOR_3D_ACCEL = 2 // 0x02 3D accelerometer -mavlink10.MAV_SYS_STATUS_SENSOR_3D_MAG = 4 // 0x04 3D magnetometer -mavlink10.MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE = 8 // 0x08 absolute pressure -mavlink10.MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE = 16 // 0x10 differential pressure -mavlink10.MAV_SYS_STATUS_SENSOR_GPS = 32 // 0x20 GPS -mavlink10.MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW = 64 // 0x40 optical flow -mavlink10.MAV_SYS_STATUS_SENSOR_VISION_POSITION = 128 // 0x80 computer vision position -mavlink10.MAV_SYS_STATUS_SENSOR_LASER_POSITION = 256 // 0x100 laser based position -mavlink10.MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH = 512 // 0x200 external ground truth (Vicon or Leica) -mavlink10.MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL = 1024 // 0x400 3D angular rate control -mavlink10.MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION = 2048 // 0x800 attitude stabilization -mavlink10.MAV_SYS_STATUS_SENSOR_YAW_POSITION = 4096 // 0x1000 yaw position -mavlink10.MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL = 8192 // 0x2000 z/altitude control -mavlink10.MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL = 16384 // 0x4000 x/y position control -mavlink10.MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS = 32768 // 0x8000 motor outputs / control -mavlink10.MAV_SYS_STATUS_SENSOR_RC_RECEIVER = 65536 // 0x10000 rc receiver -mavlink10.MAV_SYS_STATUS_SENSOR_3D_GYRO2 = 131072 // 0x20000 2nd 3D gyro -mavlink10.MAV_SYS_STATUS_SENSOR_3D_ACCEL2 = 262144 // 0x40000 2nd 3D accelerometer -mavlink10.MAV_SYS_STATUS_SENSOR_3D_MAG2 = 524288 // 0x80000 2nd 3D magnetometer -mavlink10.MAV_SYS_STATUS_GEOFENCE = 1048576 // 0x100000 geofence -mavlink10.MAV_SYS_STATUS_AHRS = 2097152 // 0x200000 AHRS subsystem health -mavlink10.MAV_SYS_STATUS_TERRAIN = 4194304 // 0x400000 Terrain subsystem health -mavlink10.MAV_SYS_STATUS_REVERSE_MOTOR = 8388608 // 0x800000 Motors are reversed -mavlink10.MAV_SYS_STATUS_LOGGING = 16777216 // 0x1000000 Logging -mavlink10.MAV_SYS_STATUS_SENSOR_BATTERY = 33554432 // 0x2000000 Battery -mavlink10.MAV_SYS_STATUS_SENSOR_PROXIMITY = 67108864 // 0x4000000 Proximity -mavlink10.MAV_SYS_STATUS_SENSOR_SATCOM = 134217728 // 0x8000000 Satellite Communication -mavlink10.MAV_SYS_STATUS_PREARM_CHECK = 268435456 // 0x10000000 pre-arm check status. Always healthy when armed -mavlink10.MAV_SYS_STATUS_SENSOR_ENUM_END = 268435457 // +// MAV_SYS_STATUS_SENSOR +mavlink10.MAV_SYS_STATUS_SENSOR_3D_GYRO = 1 // 0x01 3D gyro +mavlink10.MAV_SYS_STATUS_SENSOR_3D_ACCEL = 2 // 0x02 3D accelerometer +mavlink10.MAV_SYS_STATUS_SENSOR_3D_MAG = 4 // 0x04 3D magnetometer +mavlink10.MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE = 8 // 0x08 absolute pressure +mavlink10.MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE = 16 // 0x10 differential pressure +mavlink10.MAV_SYS_STATUS_SENSOR_GPS = 32 // 0x20 GPS +mavlink10.MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW = 64 // 0x40 optical flow +mavlink10.MAV_SYS_STATUS_SENSOR_VISION_POSITION = 128 // 0x80 computer vision position +mavlink10.MAV_SYS_STATUS_SENSOR_LASER_POSITION = 256 // 0x100 laser based position +mavlink10.MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH = 512 // 0x200 external ground truth (Vicon or Leica) +mavlink10.MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL = 1024 // 0x400 3D angular rate control +mavlink10.MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION = 2048 // 0x800 attitude stabilization +mavlink10.MAV_SYS_STATUS_SENSOR_YAW_POSITION = 4096 // 0x1000 yaw position +mavlink10.MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL = 8192 // 0x2000 z/altitude control +mavlink10.MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL = 16384 // 0x4000 x/y position control +mavlink10.MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS = 32768 // 0x8000 motor outputs / control +mavlink10.MAV_SYS_STATUS_SENSOR_RC_RECEIVER = 65536 // 0x10000 rc receiver +mavlink10.MAV_SYS_STATUS_SENSOR_3D_GYRO2 = 131072 // 0x20000 2nd 3D gyro +mavlink10.MAV_SYS_STATUS_SENSOR_3D_ACCEL2 = 262144 // 0x40000 2nd 3D accelerometer +mavlink10.MAV_SYS_STATUS_SENSOR_3D_MAG2 = 524288 // 0x80000 2nd 3D magnetometer +mavlink10.MAV_SYS_STATUS_GEOFENCE = 1048576 // 0x100000 geofence +mavlink10.MAV_SYS_STATUS_AHRS = 2097152 // 0x200000 AHRS subsystem health +mavlink10.MAV_SYS_STATUS_TERRAIN = 4194304 // 0x400000 Terrain subsystem health +mavlink10.MAV_SYS_STATUS_REVERSE_MOTOR = 8388608 // 0x800000 Motors are reversed +mavlink10.MAV_SYS_STATUS_LOGGING = 16777216 // 0x1000000 Logging +mavlink10.MAV_SYS_STATUS_SENSOR_BATTERY = 33554432 // 0x2000000 Battery +mavlink10.MAV_SYS_STATUS_SENSOR_PROXIMITY = 67108864 // 0x4000000 Proximity +mavlink10.MAV_SYS_STATUS_SENSOR_SATCOM = 134217728 // 0x8000000 Satellite Communication +mavlink10.MAV_SYS_STATUS_PREARM_CHECK = 268435456 // 0x10000000 pre-arm check status. Always healthy when armed +mavlink10.MAV_SYS_STATUS_OBSTACLE_AVOIDANCE = 536870912 // 0x20000000 Avoidance/collision prevention +mavlink10.MAV_SYS_STATUS_SENSOR_PROPULSION = 1073741824 // 0x40000000 propulsion (actuator, esc, motor or propellor) +mavlink10.MAV_SYS_STATUS_SENSOR_ENUM_END = 1073741825 // // MAV_FRAME mavlink10.MAV_FRAME_GLOBAL = 0 // Global (WGS84) coordinate frame + MSL altitude. First value / x: // latitude, second value / y: longitude, // third value / z: positive altitude over // mean sea level (MSL). -mavlink10.MAV_FRAME_LOCAL_NED = 1 // Local coordinate frame, Z-down (x: north, y: east, z: down). +mavlink10.MAV_FRAME_LOCAL_NED = 1 // Local coordinate frame, Z-down (x: North, y: East, z: Down). mavlink10.MAV_FRAME_MISSION = 2 // NOT a coordinate frame, indicates a mission command. mavlink10.MAV_FRAME_GLOBAL_RELATIVE_ALT = 3 // Global (WGS84) coordinate frame + altitude relative 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. -mavlink10.MAV_FRAME_LOCAL_ENU = 4 // Local coordinate frame, Z-up (x: east, y: north, z: up). +mavlink10.MAV_FRAME_LOCAL_ENU = 4 // Local coordinate frame, Z-up (x: East, y: North, z: Up). mavlink10.MAV_FRAME_GLOBAL_INT = 5 // Global (WGS84) coordinate frame (scaled) + MSL altitude. First value / // x: latitude in degrees*1.0e-7, second value // / y: longitude in degrees*1.0e-7, third @@ -1408,24 +1195,27 @@ mavlink10.MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 // Global (WGS84) coordinate fra // y: longitude in degrees*10e-7, third value // / z: positive altitude in meters with 0 // being at ground level in terrain model. -mavlink10.MAV_FRAME_BODY_FRD = 12 // Body fixed frame of reference, Z-down (x: forward, y: right, z: down). -mavlink10.MAV_FRAME_BODY_FLU = 13 // Body fixed frame of reference, Z-up (x: forward, y: left, z: up). -mavlink10.MAV_FRAME_MOCAP_NED = 14 // Odometry local coordinate frame of data given by a motion capture - // system, Z-down (x: north, y: east, z: - // down). -mavlink10.MAV_FRAME_MOCAP_ENU = 15 // Odometry local coordinate frame of data given by a motion capture - // system, Z-up (x: east, y: north, z: up). -mavlink10.MAV_FRAME_VISION_NED = 16 // Odometry local coordinate frame of data given by a vision estimation - // system, Z-down (x: north, y: east, z: - // down). -mavlink10.MAV_FRAME_VISION_ENU = 17 // Odometry local coordinate frame of data given by a vision estimation - // system, Z-up (x: east, y: north, z: up). -mavlink10.MAV_FRAME_ESTIM_NED = 18 // Odometry local coordinate frame of data given by an estimator running - // onboard the vehicle, Z-down (x: north, y: - // east, z: down). -mavlink10.MAV_FRAME_ESTIM_ENU = 19 // Odometry local coordinate frame of data given by an estimator running - // onboard the vehicle, Z-up (x: east, y: - // noth, z: up). +mavlink10.MAV_FRAME_BODY_FRD = 12 // Body fixed frame of reference, Z-down (x: Forward, y: Right, z: Down). +mavlink10.MAV_FRAME_RESERVED_13 = 13 // MAV_FRAME_BODY_FLU - Body fixed frame of reference, Z-up (x: Forward, + // y: Left, z: Up). +mavlink10.MAV_FRAME_RESERVED_14 = 14 // MAV_FRAME_MOCAP_NED - Odometry local coordinate frame of data given by + // a motion capture system, Z-down (x: North, + // y: East, z: Down). +mavlink10.MAV_FRAME_RESERVED_15 = 15 // MAV_FRAME_MOCAP_ENU - Odometry local coordinate frame of data given by + // a motion capture system, Z-up (x: East, y: + // North, z: Up). +mavlink10.MAV_FRAME_RESERVED_16 = 16 // MAV_FRAME_VISION_NED - Odometry local coordinate frame of data given + // by a vision estimation system, Z-down (x: + // North, y: East, z: Down). +mavlink10.MAV_FRAME_RESERVED_17 = 17 // MAV_FRAME_VISION_ENU - Odometry local coordinate frame of data given + // by a vision estimation system, Z-up (x: + // East, y: North, z: Up). +mavlink10.MAV_FRAME_RESERVED_18 = 18 // MAV_FRAME_ESTIM_NED - Odometry local coordinate frame of data given by + // an estimator running onboard the vehicle, + // Z-down (x: North, y: East, z: Down). +mavlink10.MAV_FRAME_RESERVED_19 = 19 // MAV_FRAME_ESTIM_ENU - Odometry local coordinate frame of data given by + // an estimator running onboard the vehicle, + // Z-up (x: East, y: North, z: Up). mavlink10.MAV_FRAME_LOCAL_FRD = 20 // Forward, Right, Down coordinate frame. This is a local frame with // Z-down and arbitrary F/R alignment (i.e. // not aligned with NED/earth frame). @@ -1435,13 +1225,13 @@ mavlink10.MAV_FRAME_LOCAL_FLU = 21 // Forward, Left, Up coordinate frame. This i mavlink10.MAV_FRAME_ENUM_END = 22 // // MAVLINK_DATA_STREAM_TYPE -mavlink10.MAVLINK_DATA_STREAM_IMG_JPEG = 1 // -mavlink10.MAVLINK_DATA_STREAM_IMG_BMP = 2 // -mavlink10.MAVLINK_DATA_STREAM_IMG_RAW8U = 3 // -mavlink10.MAVLINK_DATA_STREAM_IMG_RAW32U = 4 // -mavlink10.MAVLINK_DATA_STREAM_IMG_PGM = 5 // -mavlink10.MAVLINK_DATA_STREAM_IMG_PNG = 6 // -mavlink10.MAVLINK_DATA_STREAM_TYPE_ENUM_END = 7 // +mavlink10.MAVLINK_DATA_STREAM_IMG_JPEG = 0 // +mavlink10.MAVLINK_DATA_STREAM_IMG_BMP = 1 // +mavlink10.MAVLINK_DATA_STREAM_IMG_RAW8U = 2 // +mavlink10.MAVLINK_DATA_STREAM_IMG_RAW32U = 3 // +mavlink10.MAVLINK_DATA_STREAM_IMG_PGM = 4 // +mavlink10.MAVLINK_DATA_STREAM_IMG_PNG = 5 // +mavlink10.MAVLINK_DATA_STREAM_TYPE_ENUM_END = 6 // // FENCE_ACTION mavlink10.FENCE_ACTION_NONE = 0 // Disable fenced mode @@ -1459,6 +1249,12 @@ mavlink10.FENCE_BREACH_MAXALT = 2 // Breached maximum altitude mavlink10.FENCE_BREACH_BOUNDARY = 3 // Breached fence boundary mavlink10.FENCE_BREACH_ENUM_END = 4 // +// FENCE_MITIGATE +mavlink10.FENCE_MITIGATE_UNKNOWN = 0 // Unknown +mavlink10.FENCE_MITIGATE_NONE = 1 // No actions being taken +mavlink10.FENCE_MITIGATE_VEL_LIMIT = 2 // Velocity limiting active to prevent breach +mavlink10.FENCE_MITIGATE_ENUM_END = 3 // + // MAV_MOUNT_MODE mavlink10.MAV_MOUNT_MODE_RETRACT = 0 // Load and keep safe position (Roll,Pitch,Yaw) from permant memory and // stop stabilization @@ -1469,7 +1265,99 @@ mavlink10.MAV_MOUNT_MODE_RC_TARGETING = 3 // Load neutral position and start RC // stabilization mavlink10.MAV_MOUNT_MODE_GPS_POINT = 4 // Load neutral position and start to point to Lat,Lon,Alt mavlink10.MAV_MOUNT_MODE_SYSID_TARGET = 5 // Gimbal tracks system with specified system ID -mavlink10.MAV_MOUNT_MODE_ENUM_END = 6 // +mavlink10.MAV_MOUNT_MODE_HOME_LOCATION = 6 // Gimbal tracks home location +mavlink10.MAV_MOUNT_MODE_ENUM_END = 7 // + +// GIMBAL_DEVICE_CAP_FLAGS +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_RETRACT = 1 // Gimbal device supports a retracted position +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_NEUTRAL = 2 // Gimbal device supports a horizontal, forward looking position, + // stabilized +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_AXIS = 4 // Gimbal device supports rotating around roll axis. +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_FOLLOW = 8 // Gimbal device supports to follow a roll angle relative to the vehicle +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_LOCK = 16 // Gimbal device supports locking to an roll angle (generally that's the + // default with roll stabilized) +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_AXIS = 32 // Gimbal device supports rotating around pitch axis. +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_FOLLOW = 64 // Gimbal device supports to follow a pitch angle relative to the vehicle +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_LOCK = 128 // Gimbal device supports locking to an pitch angle (generally that's the + // default with pitch stabilized) +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_AXIS = 256 // Gimbal device supports rotating around yaw axis. +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_FOLLOW = 512 // Gimbal device supports to follow a yaw angle relative to the vehicle + // (generally that's the default) +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_LOCK = 1024 // Gimbal device supports locking to an absolute heading (often this is + // an option available) +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_SUPPORTS_INFINITE_YAW = 2048 // Gimbal device supports yawing/panning infinetely (e.g. using slip + // disk). +mavlink10.GIMBAL_DEVICE_CAP_FLAGS_ENUM_END = 2049 // + +// GIMBAL_MANAGER_CAP_FLAGS +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_RETRACT = 1 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_RETRACT. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_NEUTRAL = 2 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_NEUTRAL. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_AXIS = 4 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_AXIS. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_FOLLOW = 8 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_FOLLOW. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_ROLL_LOCK = 16 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_ROLL_LOCK. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_AXIS = 32 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_AXIS. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_FOLLOW = 64 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_FOLLOW. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_PITCH_LOCK = 128 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_PITCH_LOCK. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_AXIS = 256 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_AXIS. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_FOLLOW = 512 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_FOLLOW. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_HAS_YAW_LOCK = 1024 // Based on GIMBAL_DEVICE_CAP_FLAGS_HAS_YAW_LOCK. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_SUPPORTS_INFINITE_YAW = 2048 // Based on GIMBAL_DEVICE_CAP_FLAGS_SUPPORTS_INFINITE_YAW. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_CAN_POINT_LOCATION_LOCAL = 65536 // Gimbal manager supports to point to a local position. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_CAN_POINT_LOCATION_GLOBAL = 131072 // Gimbal manager supports to point to a global latitude, longitude, + // altitude position. +mavlink10.GIMBAL_MANAGER_CAP_FLAGS_ENUM_END = 131073 // + +// GIMBAL_DEVICE_FLAGS +mavlink10.GIMBAL_DEVICE_FLAGS_RETRACT = 1 // Set to retracted safe position (no stabilization), takes presedence + // over all other flags. +mavlink10.GIMBAL_DEVICE_FLAGS_NEUTRAL = 2 // Set to neutral position (horizontal, forward looking, with + // stabiliziation), takes presedence over all + // other flags except RETRACT. +mavlink10.GIMBAL_DEVICE_FLAGS_ROLL_LOCK = 4 // Lock roll angle to absolute angle relative to horizon (not relative to + // drone). This is generally the default with + // a stabilizing gimbal. +mavlink10.GIMBAL_DEVICE_FLAGS_PITCH_LOCK = 8 // Lock pitch angle to absolute angle relative to horizon (not relative + // to drone). This is generally the default. +mavlink10.GIMBAL_DEVICE_FLAGS_YAW_LOCK = 16 // Lock yaw angle to absolute angle relative to North (not relative to + // drone). If this flag is set, the quaternion + // is in the Earth frame with the x-axis + // pointing North (yaw absolute). If this flag + // is not set, the quaternion frame is in the + // Earth frame rotated so that the x-axis is + // pointing forward (yaw relative to vehicle). +mavlink10.GIMBAL_DEVICE_FLAGS_ENUM_END = 17 // + +// GIMBAL_MANAGER_FLAGS +mavlink10.GIMBAL_MANAGER_FLAGS_RETRACT = 1 // Based on GIMBAL_DEVICE_FLAGS_RETRACT +mavlink10.GIMBAL_MANAGER_FLAGS_NEUTRAL = 2 // Based on GIMBAL_DEVICE_FLAGS_NEUTRAL +mavlink10.GIMBAL_MANAGER_FLAGS_ROLL_LOCK = 4 // Based on GIMBAL_DEVICE_FLAGS_ROLL_LOCK +mavlink10.GIMBAL_MANAGER_FLAGS_PITCH_LOCK = 8 // Based on GIMBAL_DEVICE_FLAGS_PITCH_LOCK +mavlink10.GIMBAL_MANAGER_FLAGS_YAW_LOCK = 16 // Based on GIMBAL_DEVICE_FLAGS_YAW_LOCK +mavlink10.GIMBAL_MANAGER_FLAGS_ENUM_END = 17 // + +// GIMBAL_DEVICE_ERROR_FLAGS +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_AT_ROLL_LIMIT = 1 // Gimbal device is limited by hardware roll limit. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_AT_PITCH_LIMIT = 2 // Gimbal device is limited by hardware pitch limit. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_AT_YAW_LIMIT = 4 // Gimbal device is limited by hardware yaw limit. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_ENCODER_ERROR = 8 // There is an error with the gimbal encoders. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_POWER_ERROR = 16 // There is an error with the gimbal power source. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_MOTOR_ERROR = 32 // There is an error with the gimbal motor's. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_SOFTWARE_ERROR = 64 // There is an error with the gimbal's software. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_COMMS_ERROR = 128 // There is an error with the gimbal's communication. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_CALIBRATION_RUNNING = 256 // Gimbal is currently calibrating. +mavlink10.GIMBAL_DEVICE_ERROR_FLAGS_ENUM_END = 257 // + +// GRIPPER_ACTIONS +mavlink10.GRIPPER_ACTION_RELEASE = 0 // Gripper release cargo. +mavlink10.GRIPPER_ACTION_GRAB = 1 // Gripper grab onto cargo. +mavlink10.GRIPPER_ACTIONS_ENUM_END = 2 // + +// WINCH_ACTIONS +mavlink10.WINCH_RELAXED = 0 // Relax winch. +mavlink10.WINCH_RELATIVE_LENGTH_CONTROL = 1 // Wind or unwind specified length of cable, optionally using specified + // rate. +mavlink10.WINCH_RATE_CONTROL = 2 // Wind or unwind cable at specified rate. +mavlink10.WINCH_ACTIONS_ENUM_END = 3 // // UAVCAN_NODE_HEALTH mavlink10.UAVCAN_NODE_HEALTH_OK = 0 // The node is functioning properly. @@ -1488,6 +1376,26 @@ mavlink10.UAVCAN_NODE_MODE_SOFTWARE_UPDATE = 3 // The node is in the process of mavlink10.UAVCAN_NODE_MODE_OFFLINE = 7 // The node is no longer available online. mavlink10.UAVCAN_NODE_MODE_ENUM_END = 8 // +// ESC_CONNECTION_TYPE +mavlink10.ESC_CONNECTION_TYPE_PPM = 0 // Traditional PPM ESC. +mavlink10.ESC_CONNECTION_TYPE_SERIAL = 1 // Serial Bus connected ESC. +mavlink10.ESC_CONNECTION_TYPE_ONESHOT = 2 // One Shot PPM ESC. +mavlink10.ESC_CONNECTION_TYPE_I2C = 3 // I2C ESC. +mavlink10.ESC_CONNECTION_TYPE_CAN = 4 // CAN-Bus ESC. +mavlink10.ESC_CONNECTION_TYPE_DSHOT = 5 // DShot ESC. +mavlink10.ESC_CONNECTION_TYPE_ENUM_END = 6 // + +// ESC_FAILURE_FLAGS +mavlink10.ESC_FAILURE_NONE = 0 // No ESC failure. +mavlink10.ESC_FAILURE_OVER_CURRENT = 1 // Over current failure. +mavlink10.ESC_FAILURE_OVER_VOLTAGE = 2 // Over voltage failure. +mavlink10.ESC_FAILURE_OVER_TEMPERATURE = 4 // Over temperature failure. +mavlink10.ESC_FAILURE_OVER_RPM = 8 // Over RPM failure. +mavlink10.ESC_FAILURE_INCONSISTENT_CMD = 16 // Inconsistent command failure i.e. out of bounds. +mavlink10.ESC_FAILURE_MOTOR_STUCK = 32 // Motor stuck failure. +mavlink10.ESC_FAILURE_GENERIC = 64 // Generic ESC failure. +mavlink10.ESC_FAILURE_FLAGS_ENUM_END = 65 // + // STORAGE_STATUS mavlink10.STORAGE_STATUS_EMPTY = 0 // Storage is missing (no microSD card loaded for example.) mavlink10.STORAGE_STATUS_UNFORMATTED = 1 // Storage present but unformatted. @@ -1497,6 +1405,74 @@ mavlink10.STORAGE_STATUS_NOT_SUPPORTED = 3 // Camera does not supply storage sta // will be ignored. mavlink10.STORAGE_STATUS_ENUM_END = 4 // +// STORAGE_TYPE +mavlink10.STORAGE_TYPE_UNKNOWN = 0 // Storage type is not known. +mavlink10.STORAGE_TYPE_USB_STICK = 1 // Storage type is USB device. +mavlink10.STORAGE_TYPE_SD = 2 // Storage type is SD card. +mavlink10.STORAGE_TYPE_MICROSD = 3 // Storage type is microSD card. +mavlink10.STORAGE_TYPE_CF = 4 // Storage type is CFast. +mavlink10.STORAGE_TYPE_CFE = 5 // Storage type is CFexpress. +mavlink10.STORAGE_TYPE_XQD = 6 // Storage type is XQD. +mavlink10.STORAGE_TYPE_HD = 7 // Storage type is HD mass storage type. +mavlink10.STORAGE_TYPE_OTHER = 254 // Storage type is other, not listed type. +mavlink10.STORAGE_TYPE_ENUM_END = 255 // + +// ORBIT_YAW_BEHAVIOUR +mavlink10.ORBIT_YAW_BEHAVIOUR_HOLD_FRONT_TO_CIRCLE_CENTER = 0 // Vehicle front points to the center (default). +mavlink10.ORBIT_YAW_BEHAVIOUR_HOLD_INITIAL_HEADING = 1 // Vehicle front holds heading when message received. +mavlink10.ORBIT_YAW_BEHAVIOUR_UNCONTROLLED = 2 // Yaw uncontrolled. +mavlink10.ORBIT_YAW_BEHAVIOUR_HOLD_FRONT_TANGENT_TO_CIRCLE = 3 // Vehicle front follows flight path (tangential to circle). +mavlink10.ORBIT_YAW_BEHAVIOUR_RC_CONTROLLED = 4 // Yaw controlled by RC input. +mavlink10.ORBIT_YAW_BEHAVIOUR_ENUM_END = 5 // + +// WIFI_CONFIG_AP_RESPONSE +mavlink10.WIFI_CONFIG_AP_RESPONSE_UNDEFINED = 0 // Undefined response. Likely an indicative of a system that doesn't + // support this request. +mavlink10.WIFI_CONFIG_AP_RESPONSE_ACCEPTED = 1 // Changes accepted. +mavlink10.WIFI_CONFIG_AP_RESPONSE_REJECTED = 2 // Changes rejected. +mavlink10.WIFI_CONFIG_AP_RESPONSE_MODE_ERROR = 3 // Invalid Mode. +mavlink10.WIFI_CONFIG_AP_RESPONSE_SSID_ERROR = 4 // Invalid SSID. +mavlink10.WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR = 5 // Invalid Password. +mavlink10.WIFI_CONFIG_AP_RESPONSE_ENUM_END = 6 // + +// CELLULAR_CONFIG_RESPONSE +mavlink10.CELLULAR_CONFIG_RESPONSE_ACCEPTED = 0 // Changes accepted. +mavlink10.CELLULAR_CONFIG_RESPONSE_APN_ERROR = 1 // Invalid APN. +mavlink10.CELLULAR_CONFIG_RESPONSE_PIN_ERROR = 2 // Invalid PIN. +mavlink10.CELLULAR_CONFIG_RESPONSE_REJECTED = 3 // Changes rejected. +mavlink10.CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED = 4 // PUK is required to unblock SIM card. +mavlink10.CELLULAR_CONFIG_RESPONSE_ENUM_END = 5 // + +// WIFI_CONFIG_AP_MODE +mavlink10.WIFI_CONFIG_AP_MODE_UNDEFINED = 0 // WiFi mode is undefined. +mavlink10.WIFI_CONFIG_AP_MODE_AP = 1 // WiFi configured as an access point. +mavlink10.WIFI_CONFIG_AP_MODE_STATION = 2 // WiFi configured as a station connected to an existing local WiFi + // network. +mavlink10.WIFI_CONFIG_AP_MODE_DISABLED = 3 // WiFi disabled. +mavlink10.WIFI_CONFIG_AP_MODE_ENUM_END = 4 // + +// COMP_METADATA_TYPE +mavlink10.COMP_METADATA_TYPE_GENERAL = 0 // General information which also includes information on other optional + // supported COMP_METADATA_TYPE's. Must be + // supported. Only downloadable from vehicle. +mavlink10.COMP_METADATA_TYPE_PARAMETER = 1 // Parameter meta data. +mavlink10.COMP_METADATA_TYPE_COMMANDS = 2 // Meta data which specifies the commands the vehicle supports. (WIP) +mavlink10.COMP_METADATA_TYPE_PERIPHERALS = 3 // Meta data which specifies potential external peripherals that do not + // talk MAVLink +mavlink10.COMP_METADATA_TYPE_EVENTS = 4 // Meta data for events interface +mavlink10.COMP_METADATA_TYPE_ENUM_END = 5 // + +// PARAM_TRANSACTION_TRANSPORT +mavlink10.PARAM_TRANSACTION_TRANSPORT_PARAM = 0 // Transaction over param transport. +mavlink10.PARAM_TRANSACTION_TRANSPORT_PARAM_EXT = 1 // Transaction over param_ext transport. +mavlink10.PARAM_TRANSACTION_TRANSPORT_ENUM_END = 2 // + +// PARAM_TRANSACTION_ACTION +mavlink10.PARAM_TRANSACTION_ACTION_START = 0 // Commit the current parameter transaction. +mavlink10.PARAM_TRANSACTION_ACTION_COMMIT = 1 // Commit the current parameter transaction. +mavlink10.PARAM_TRANSACTION_ACTION_CANCEL = 2 // Cancel the current parameter transaction. +mavlink10.PARAM_TRANSACTION_ACTION_ENUM_END = 3 // + // MAV_DATA_STREAM mavlink10.MAV_DATA_STREAM_ALL = 0 // Enable all data streams mavlink10.MAV_DATA_STREAM_RAW_SENSORS = 1 // Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. @@ -1519,23 +1495,23 @@ mavlink10.MAV_ROI_TARGET = 4 // Point toward of given id. mavlink10.MAV_ROI_ENUM_END = 5 // // MAV_CMD_ACK -mavlink10.MAV_CMD_ACK_OK = 1 // Command / mission item is ok. -mavlink10.MAV_CMD_ACK_ERR_FAIL = 2 // Generic error message if none of the other reasons fails or if no +mavlink10.MAV_CMD_ACK_OK = 0 // Command / mission item is ok. +mavlink10.MAV_CMD_ACK_ERR_FAIL = 1 // Generic error message if none of the other reasons fails or if no // detailed error reporting is implemented. -mavlink10.MAV_CMD_ACK_ERR_ACCESS_DENIED = 3 // The system is refusing to accept this command from this source / +mavlink10.MAV_CMD_ACK_ERR_ACCESS_DENIED = 2 // The system is refusing to accept this command from this source / // communication partner. -mavlink10.MAV_CMD_ACK_ERR_NOT_SUPPORTED = 4 // Command or mission item is not supported, other commands would be +mavlink10.MAV_CMD_ACK_ERR_NOT_SUPPORTED = 3 // Command or mission item is not supported, other commands would be // accepted. -mavlink10.MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED = 5 // The coordinate frame of this command / mission item is not supported. -mavlink10.MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE = 6 // The coordinate frame of this command is ok, but he coordinate values +mavlink10.MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED = 4 // The coordinate frame of this command / mission item is not supported. +mavlink10.MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE = 5 // 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. -mavlink10.MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE = 7 // The X or latitude value is out of range. -mavlink10.MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE = 8 // The Y or longitude value is out of range. -mavlink10.MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE = 9 // The Z or altitude value is out of range. -mavlink10.MAV_CMD_ACK_ENUM_END = 10 // +mavlink10.MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE = 6 // The X or latitude value is out of range. +mavlink10.MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE = 7 // The Y or longitude value is out of range. +mavlink10.MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE = 8 // The Z or altitude value is out of range. +mavlink10.MAV_CMD_ACK_ENUM_END = 9 // // MAV_PARAM_TYPE mavlink10.MAV_PARAM_TYPE_UINT8 = 1 // 8-bit unsigned integer @@ -1550,6 +1526,20 @@ mavlink10.MAV_PARAM_TYPE_REAL32 = 9 // 32-bit floating-point mavlink10.MAV_PARAM_TYPE_REAL64 = 10 // 64-bit floating-point mavlink10.MAV_PARAM_TYPE_ENUM_END = 11 // +// MAV_PARAM_EXT_TYPE +mavlink10.MAV_PARAM_EXT_TYPE_UINT8 = 1 // 8-bit unsigned integer +mavlink10.MAV_PARAM_EXT_TYPE_INT8 = 2 // 8-bit signed integer +mavlink10.MAV_PARAM_EXT_TYPE_UINT16 = 3 // 16-bit unsigned integer +mavlink10.MAV_PARAM_EXT_TYPE_INT16 = 4 // 16-bit signed integer +mavlink10.MAV_PARAM_EXT_TYPE_UINT32 = 5 // 32-bit unsigned integer +mavlink10.MAV_PARAM_EXT_TYPE_INT32 = 6 // 32-bit signed integer +mavlink10.MAV_PARAM_EXT_TYPE_UINT64 = 7 // 64-bit unsigned integer +mavlink10.MAV_PARAM_EXT_TYPE_INT64 = 8 // 64-bit signed integer +mavlink10.MAV_PARAM_EXT_TYPE_REAL32 = 9 // 32-bit floating-point +mavlink10.MAV_PARAM_EXT_TYPE_REAL64 = 10 // 64-bit floating-point +mavlink10.MAV_PARAM_EXT_TYPE_CUSTOM = 11 // Custom Type +mavlink10.MAV_PARAM_EXT_TYPE_ENUM_END = 12 // + // MAV_RESULT mavlink10.MAV_RESULT_ACCEPTED = 0 // Command is valid (is supported and has valid parameters), and was // executed. @@ -1577,19 +1567,16 @@ mavlink10.MAV_RESULT_IN_PROGRESS = 5 // Command is valid and is being executed. // message with final result of the operation. // The COMMAND_ACK.progress field can be used // to indicate the progress of the operation. - // There is no need for the sender to retry - // the command, but if done during execution, - // the component will return - // MAV_RESULT_IN_PROGRESS with an updated - // progress. -mavlink10.MAV_RESULT_ENUM_END = 6 // +mavlink10.MAV_RESULT_CANCELLED = 6 // Command has been cancelled (as a result of receiving a COMMAND_CANCEL + // message). +mavlink10.MAV_RESULT_ENUM_END = 7 // // MAV_MISSION_RESULT mavlink10.MAV_MISSION_ACCEPTED = 0 // mission accepted OK mavlink10.MAV_MISSION_ERROR = 1 // Generic error / not accepting mission commands at all right now. mavlink10.MAV_MISSION_UNSUPPORTED_FRAME = 2 // Coordinate frame is not supported. mavlink10.MAV_MISSION_UNSUPPORTED = 3 // Command is not supported. -mavlink10.MAV_MISSION_NO_SPACE = 4 // Mission item exceeds storage space. +mavlink10.MAV_MISSION_NO_SPACE = 4 // Mission items exceed storage space. mavlink10.MAV_MISSION_INVALID = 5 // One of the parameters has an invalid value. mavlink10.MAV_MISSION_INVALID_PARAM1 = 6 // param1 has an invalid value. mavlink10.MAV_MISSION_INVALID_PARAM2 = 7 // param2 has an invalid value. @@ -1718,7 +1705,7 @@ mavlink10.MAV_SENSOR_ORIENTATION_ENUM_END = 101 // // MAV_PROTOCOL_CAPABILITY mavlink10.MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT = 1 // Autopilot supports MISSION float message type. mavlink10.MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT = 2 // Autopilot supports the new param float message type. -mavlink10.MAV_PROTOCOL_CAPABILITY_MISSION_INT = 4 // Autopilot supports MISSION_INT scaled integer message type. +mavlink10.MAV_PROTOCOL_CAPABILITY_MISSION_INT = 4 // Autopilot supports MISSION_ITEM_INT scaled integer message type. mavlink10.MAV_PROTOCOL_CAPABILITY_COMMAND_INT = 8 // Autopilot supports COMMAND_INT scaled integer message type. mavlink10.MAV_PROTOCOL_CAPABILITY_PARAM_UNION = 16 // Autopilot supports the new param union message type. mavlink10.MAV_PROTOCOL_CAPABILITY_FTP = 32 // Autopilot supports the new FILE_TRANSFER_PROTOCOL message type. @@ -1782,12 +1769,72 @@ mavlink10.MAV_BATTERY_CHARGE_STATE_LOW = 2 // Battery state is low, warn and mon mavlink10.MAV_BATTERY_CHARGE_STATE_CRITICAL = 3 // Battery state is critical, return or abort immediately. mavlink10.MAV_BATTERY_CHARGE_STATE_EMERGENCY = 4 // Battery state is too low for ordinary abort sequence. Perform fastest // possible emergency stop to prevent damage. -mavlink10.MAV_BATTERY_CHARGE_STATE_FAILED = 5 // Battery failed, damage unavoidable. +mavlink10.MAV_BATTERY_CHARGE_STATE_FAILED = 5 // Battery failed, damage unavoidable. Possible causes (faults) are + // listed in MAV_BATTERY_FAULT. mavlink10.MAV_BATTERY_CHARGE_STATE_UNHEALTHY = 6 // Battery is diagnosed to be defective or an error occurred, usage is - // discouraged / prohibited. + // discouraged / prohibited. Possible causes + // (faults) are listed in MAV_BATTERY_FAULT. mavlink10.MAV_BATTERY_CHARGE_STATE_CHARGING = 7 // Battery is charging. mavlink10.MAV_BATTERY_CHARGE_STATE_ENUM_END = 8 // +// MAV_BATTERY_MODE +mavlink10.MAV_BATTERY_MODE_UNKNOWN = 0 // Battery mode not supported/unknown battery mode/normal operation. +mavlink10.MAV_BATTERY_MODE_AUTO_DISCHARGING = 1 // Battery is auto discharging (towards storage level). +mavlink10.MAV_BATTERY_MODE_HOT_SWAP = 2 // Battery in hot-swap mode (current limited to prevent spikes that might + // damage sensitive electrical circuits). +mavlink10.MAV_BATTERY_MODE_ENUM_END = 3 // + +// MAV_BATTERY_FAULT +mavlink10.MAV_BATTERY_FAULT_DEEP_DISCHARGE = 1 // Battery has deep discharged. +mavlink10.MAV_BATTERY_FAULT_SPIKES = 2 // Voltage spikes. +mavlink10.MAV_BATTERY_FAULT_CELL_FAIL = 4 // One or more cells have failed. Battery should also report + // MAV_BATTERY_CHARGE_STATE_FAILE (and should + // not be used). +mavlink10.MAV_BATTERY_FAULT_OVER_CURRENT = 8 // Over-current fault. +mavlink10.MAV_BATTERY_FAULT_OVER_TEMPERATURE = 16 // Over-temperature fault. +mavlink10.MAV_BATTERY_FAULT_UNDER_TEMPERATURE = 32 // Under-temperature fault. +mavlink10.MAV_BATTERY_FAULT_INCOMPATIBLE_VOLTAGE = 64 // Vehicle voltage is not compatible with this battery (batteries on same + // power rail should have similar voltage). +mavlink10.MAV_BATTERY_FAULT_INCOMPATIBLE_FIRMWARE = 128 // Battery firmware is not compatible with current autopilot firmware. +mavlink10.BATTERY_FAULT_INCOMPATIBLE_CELLS_CONFIGURATION = 256 // Battery is not compatible due to cell configuration (e.g. 5s1p when + // vehicle requires 6s). +mavlink10.MAV_BATTERY_FAULT_ENUM_END = 257 // + +// MAV_GENERATOR_STATUS_FLAG +mavlink10.MAV_GENERATOR_STATUS_FLAG_OFF = 1 // Generator is off. +mavlink10.MAV_GENERATOR_STATUS_FLAG_READY = 2 // Generator is ready to start generating power. +mavlink10.MAV_GENERATOR_STATUS_FLAG_GENERATING = 4 // Generator is generating power. +mavlink10.MAV_GENERATOR_STATUS_FLAG_CHARGING = 8 // Generator is charging the batteries (generating enough power to charge + // and provide the load). +mavlink10.MAV_GENERATOR_STATUS_FLAG_REDUCED_POWER = 16 // Generator is operating at a reduced maximum power. +mavlink10.MAV_GENERATOR_STATUS_FLAG_MAXPOWER = 32 // Generator is providing the maximum output. +mavlink10.MAV_GENERATOR_STATUS_FLAG_OVERTEMP_WARNING = 64 // Generator is near the maximum operating temperature, cooling is + // insufficient. +mavlink10.MAV_GENERATOR_STATUS_FLAG_OVERTEMP_FAULT = 128 // Generator hit the maximum operating temperature and shutdown. +mavlink10.MAV_GENERATOR_STATUS_FLAG_ELECTRONICS_OVERTEMP_WARNING = 256 // Power electronics are near the maximum operating temperature, cooling + // is insufficient. +mavlink10.MAV_GENERATOR_STATUS_FLAG_ELECTRONICS_OVERTEMP_FAULT = 512 // Power electronics hit the maximum operating temperature and shutdown. +mavlink10.MAV_GENERATOR_STATUS_FLAG_ELECTRONICS_FAULT = 1024 // Power electronics experienced a fault and shutdown. +mavlink10.MAV_GENERATOR_STATUS_FLAG_POWERSOURCE_FAULT = 2048 // The power source supplying the generator failed e.g. mechanical + // generator stopped, tether is no longer + // providing power, solar cell is in shade, + // hydrogen reaction no longer happening. +mavlink10.MAV_GENERATOR_STATUS_FLAG_COMMUNICATION_WARNING = 4096 // Generator controller having communication problems. +mavlink10.MAV_GENERATOR_STATUS_FLAG_COOLING_WARNING = 8192 // Power electronic or generator cooling system error. +mavlink10.MAV_GENERATOR_STATUS_FLAG_POWER_RAIL_FAULT = 16384 // Generator controller power rail experienced a fault. +mavlink10.MAV_GENERATOR_STATUS_FLAG_OVERCURRENT_FAULT = 32768 // Generator controller exceeded the overcurrent threshold and shutdown + // to prevent damage. +mavlink10.MAV_GENERATOR_STATUS_FLAG_BATTERY_OVERCHARGE_CURRENT_FAULT = 65536 // Generator controller detected a high current going into the batteries + // and shutdown to prevent battery damage. +mavlink10.MAV_GENERATOR_STATUS_FLAG_OVERVOLTAGE_FAULT = 131072 // Generator controller exceeded it's overvoltage threshold and shutdown + // to prevent it exceeding the voltage rating. +mavlink10.MAV_GENERATOR_STATUS_FLAG_BATTERY_UNDERVOLT_FAULT = 262144 // Batteries are under voltage (generator will not start). +mavlink10.MAV_GENERATOR_STATUS_FLAG_START_INHIBITED = 524288 // Generator start is inhibited by e.g. a safety switch. +mavlink10.MAV_GENERATOR_STATUS_FLAG_MAINTENANCE_REQUIRED = 1048576 // Generator requires maintenance. +mavlink10.MAV_GENERATOR_STATUS_FLAG_WARMING_UP = 2097152 // Generator is not ready to generate yet. +mavlink10.MAV_GENERATOR_STATUS_FLAG_IDLE = 4194304 // Generator is idle. +mavlink10.MAV_GENERATOR_STATUS_FLAG_ENUM_END = 4194305 // + // MAV_VTOL_STATE mavlink10.MAV_VTOL_STATE_UNDEFINED = 0 // MAV is not configured as VTOL mavlink10.MAV_VTOL_STATE_TRANSITION_TO_FW = 1 // VTOL is in transition from multicopter to fixed-wing @@ -1960,10 +2007,88 @@ mavlink10.CAMERA_CAP_FLAGS_CAN_CAPTURE_VIDEO_IN_IMAGE_MODE = 16 // Camera can ca mavlink10.CAMERA_CAP_FLAGS_HAS_IMAGE_SURVEY_MODE = 32 // Camera has image survey mode (MAV_CMD_SET_CAMERA_MODE) mavlink10.CAMERA_CAP_FLAGS_HAS_BASIC_ZOOM = 64 // Camera has basic zoom control (MAV_CMD_SET_CAMERA_ZOOM) mavlink10.CAMERA_CAP_FLAGS_HAS_BASIC_FOCUS = 128 // Camera has basic focus control (MAV_CMD_SET_CAMERA_FOCUS) -mavlink10.CAMERA_CAP_FLAGS_HAS_VIDEO_STREAM = 256 // Camera has video streaming capabilities (use - // MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION - // for video streaming info) -mavlink10.CAMERA_CAP_FLAGS_ENUM_END = 257 // +mavlink10.CAMERA_CAP_FLAGS_HAS_VIDEO_STREAM = 256 // Camera has video streaming capabilities (request + // VIDEO_STREAM_INFORMATION with + // MAV_CMD_REQUEST_MESSAGE for video streaming + // info) +mavlink10.CAMERA_CAP_FLAGS_HAS_TRACKING_POINT = 512 // Camera supports tracking of a point on the camera view. +mavlink10.CAMERA_CAP_FLAGS_HAS_TRACKING_RECTANGLE = 1024 // Camera supports tracking of a selection rectangle on the camera view. +mavlink10.CAMERA_CAP_FLAGS_HAS_TRACKING_GEO_STATUS = 2048 // Camera supports tracking geo status (CAMERA_TRACKING_GEO_STATUS). +mavlink10.CAMERA_CAP_FLAGS_ENUM_END = 2049 // + +// VIDEO_STREAM_STATUS_FLAGS +mavlink10.VIDEO_STREAM_STATUS_FLAGS_RUNNING = 1 // Stream is active (running) +mavlink10.VIDEO_STREAM_STATUS_FLAGS_THERMAL = 2 // Stream is thermal imaging +mavlink10.VIDEO_STREAM_STATUS_FLAGS_ENUM_END = 3 // + +// VIDEO_STREAM_TYPE +mavlink10.VIDEO_STREAM_TYPE_RTSP = 0 // Stream is RTSP +mavlink10.VIDEO_STREAM_TYPE_RTPUDP = 1 // Stream is RTP UDP (URI gives the port number) +mavlink10.VIDEO_STREAM_TYPE_TCP_MPEG = 2 // Stream is MPEG on TCP +mavlink10.VIDEO_STREAM_TYPE_MPEG_TS_H264 = 3 // Stream is h.264 on MPEG TS (URI gives the port number) +mavlink10.VIDEO_STREAM_TYPE_ENUM_END = 4 // + +// CAMERA_TRACKING_STATUS_FLAGS +mavlink10.CAMERA_TRACKING_STATUS_FLAGS_IDLE = 0 // Camera is not tracking +mavlink10.CAMERA_TRACKING_STATUS_FLAGS_ACTIVE = 1 // Camera is tracking +mavlink10.CAMERA_TRACKING_STATUS_FLAGS_ERROR = 2 // Camera tracking in error state +mavlink10.CAMERA_TRACKING_STATUS_FLAGS_ENUM_END = 3 // + +// CAMERA_TRACKING_MODE +mavlink10.CAMERA_TRACKING_MODE_NONE = 0 // Not tracking +mavlink10.CAMERA_TRACKING_MODE_POINT = 1 // Target is a point +mavlink10.CAMERA_TRACKING_MODE_RECTANGLE = 2 // Target is a rectangle +mavlink10.CAMERA_TRACKING_MODE_ENUM_END = 3 // + +// CAMERA_TRACKING_TARGET_DATA +mavlink10.CAMERA_TRACKING_TARGET_DATA_NONE = 0 // No target data +mavlink10.CAMERA_TRACKING_TARGET_DATA_EMBEDDED = 1 // Target data embedded in image data (proprietary) +mavlink10.CAMERA_TRACKING_TARGET_DATA_RENDERED = 2 // Target data rendered in image +mavlink10.CAMERA_TRACKING_TARGET_DATA_IN_STATUS = 4 // Target data within status message (Point or Rectangle) +mavlink10.CAMERA_TRACKING_TARGET_DATA_ENUM_END = 5 // + +// CAMERA_ZOOM_TYPE +mavlink10.ZOOM_TYPE_STEP = 0 // Zoom one step increment (-1 for wide, 1 for tele) +mavlink10.ZOOM_TYPE_CONTINUOUS = 1 // Continuous zoom up/down until stopped (-1 for wide, 1 for tele, 0 to + // stop zooming) +mavlink10.ZOOM_TYPE_RANGE = 2 // Zoom value as proportion of full camera range (a value between 0.0 and + // 100.0) +mavlink10.ZOOM_TYPE_FOCAL_LENGTH = 3 // Zoom value/variable focal length in milimetres. Note that there is no + // message to get the valid zoom range of the + // camera, so this can type can only be used + // for cameras where the zoom range is known + // (implying that this cannot reliably be used + // in a GCS for an arbitrary camera) +mavlink10.CAMERA_ZOOM_TYPE_ENUM_END = 4 // + +// SET_FOCUS_TYPE +mavlink10.FOCUS_TYPE_STEP = 0 // Focus one step increment (-1 for focusing in, 1 for focusing out + // towards infinity). +mavlink10.FOCUS_TYPE_CONTINUOUS = 1 // Continuous focus up/down until stopped (-1 for focusing in, 1 for + // focusing out towards infinity, 0 to stop + // focusing) +mavlink10.FOCUS_TYPE_RANGE = 2 // Focus value as proportion of full camera focus range (a value between + // 0.0 and 100.0) +mavlink10.FOCUS_TYPE_METERS = 3 // Focus value in metres. Note that there is no message to get the valid + // focus range of the camera, so this can type + // can only be used for cameras where the + // range is known (implying that this cannot + // reliably be used in a GCS for an arbitrary + // camera). +mavlink10.SET_FOCUS_TYPE_ENUM_END = 4 // + +// PARAM_ACK +mavlink10.PARAM_ACK_ACCEPTED = 0 // Parameter value ACCEPTED and SET +mavlink10.PARAM_ACK_VALUE_UNSUPPORTED = 1 // Parameter value UNKNOWN/UNSUPPORTED +mavlink10.PARAM_ACK_FAILED = 2 // Parameter failed to set +mavlink10.PARAM_ACK_IN_PROGRESS = 3 // Parameter value received but not yet set/accepted. A subsequent + // PARAM_ACK_TRANSACTION or PARAM_EXT_ACK with + // the final result will follow once operation + // is completed. This is returned immediately + // for parameters that take longer to set, + // indicating taht the the parameter was + // recieved and does not need to be resent. +mavlink10.PARAM_ACK_ENUM_END = 4 // // CAMERA_MODE mavlink10.CAMERA_MODE_IMAGE = 0 // Camera is in image/photo capture mode. @@ -2004,6 +2129,77 @@ mavlink10.POSITION_TARGET_TYPEMASK_YAW_IGNORE = 1024 // Ignore yaw mavlink10.POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE = 2048 // Ignore yaw rate mavlink10.POSITION_TARGET_TYPEMASK_ENUM_END = 2049 // +// ATTITUDE_TARGET_TYPEMASK +mavlink10.ATTITUDE_TARGET_TYPEMASK_BODY_ROLL_RATE_IGNORE = 1 // Ignore body roll rate +mavlink10.ATTITUDE_TARGET_TYPEMASK_BODY_PITCH_RATE_IGNORE = 2 // Ignore body pitch rate +mavlink10.ATTITUDE_TARGET_TYPEMASK_BODY_YAW_RATE_IGNORE = 4 // Ignore body yaw rate +mavlink10.ATTITUDE_TARGET_TYPEMASK_THRUST_BODY_SET = 32 // Use 3D body thrust setpoint instead of throttle +mavlink10.ATTITUDE_TARGET_TYPEMASK_THROTTLE_IGNORE = 64 // Ignore throttle +mavlink10.ATTITUDE_TARGET_TYPEMASK_ATTITUDE_IGNORE = 128 // Ignore attitude +mavlink10.ATTITUDE_TARGET_TYPEMASK_ENUM_END = 129 // + +// UTM_FLIGHT_STATE +mavlink10.UTM_FLIGHT_STATE_UNKNOWN = 1 // The flight state can't be determined. +mavlink10.UTM_FLIGHT_STATE_GROUND = 2 // UAS on ground. +mavlink10.UTM_FLIGHT_STATE_AIRBORNE = 3 // UAS airborne. +mavlink10.UTM_FLIGHT_STATE_EMERGENCY = 16 // UAS is in an emergency flight state. +mavlink10.UTM_FLIGHT_STATE_NOCTRL = 32 // UAS has no active controls. +mavlink10.UTM_FLIGHT_STATE_ENUM_END = 33 // + +// UTM_DATA_AVAIL_FLAGS +mavlink10.UTM_DATA_AVAIL_FLAGS_TIME_VALID = 1 // The field time contains valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_UAS_ID_AVAILABLE = 2 // The field uas_id contains valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_POSITION_AVAILABLE = 4 // The fields lat, lon and h_acc contain valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_ALTITUDE_AVAILABLE = 8 // The fields alt and v_acc contain valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_RELATIVE_ALTITUDE_AVAILABLE = 16 // The field relative_alt contains valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_HORIZONTAL_VELO_AVAILABLE = 32 // The fields vx and vy contain valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_VERTICAL_VELO_AVAILABLE = 64 // The field vz contains valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_NEXT_WAYPOINT_AVAILABLE = 128 // The fields next_lat, next_lon and next_alt contain valid data. +mavlink10.UTM_DATA_AVAIL_FLAGS_ENUM_END = 129 // + +// CELLULAR_NETWORK_RADIO_TYPE +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_NONE = 0 // +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_GSM = 1 // +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_CDMA = 2 // +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_WCDMA = 3 // +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_LTE = 4 // +mavlink10.CELLULAR_NETWORK_RADIO_TYPE_ENUM_END = 5 // + +// CELLULAR_STATUS_FLAG +mavlink10.CELLULAR_STATUS_FLAG_UNKNOWN = 0 // State unknown or not reportable. +mavlink10.CELLULAR_STATUS_FLAG_FAILED = 1 // Modem is unusable +mavlink10.CELLULAR_STATUS_FLAG_INITIALIZING = 2 // Modem is being initialized +mavlink10.CELLULAR_STATUS_FLAG_LOCKED = 3 // Modem is locked +mavlink10.CELLULAR_STATUS_FLAG_DISABLED = 4 // Modem is not enabled and is powered down +mavlink10.CELLULAR_STATUS_FLAG_DISABLING = 5 // Modem is currently transitioning to the CELLULAR_STATUS_FLAG_DISABLED + // state +mavlink10.CELLULAR_STATUS_FLAG_ENABLING = 6 // Modem is currently transitioning to the CELLULAR_STATUS_FLAG_ENABLED + // state +mavlink10.CELLULAR_STATUS_FLAG_ENABLED = 7 // Modem is enabled and powered on but not registered with a network + // provider and not available for data + // connections +mavlink10.CELLULAR_STATUS_FLAG_SEARCHING = 8 // Modem is searching for a network provider to register +mavlink10.CELLULAR_STATUS_FLAG_REGISTERED = 9 // Modem is registered with a network provider, and data connections and + // messaging may be available for use +mavlink10.CELLULAR_STATUS_FLAG_DISCONNECTING = 10 // Modem is disconnecting and deactivating the last active packet data + // bearer. This state will not be entered if + // more than one packet data bearer is active + // and one of the active bearers is + // deactivated +mavlink10.CELLULAR_STATUS_FLAG_CONNECTING = 11 // Modem is activating and connecting the first packet data bearer. + // Subsequent bearer activations when another + // bearer is already active do not cause this + // state to be entered +mavlink10.CELLULAR_STATUS_FLAG_CONNECTED = 12 // One or more packet data bearers is active and connected +mavlink10.CELLULAR_STATUS_FLAG_ENUM_END = 13 // + +// CELLULAR_NETWORK_FAILED_REASON +mavlink10.CELLULAR_NETWORK_FAILED_REASON_NONE = 0 // No error +mavlink10.CELLULAR_NETWORK_FAILED_REASON_UNKNOWN = 1 // Error state is unknown +mavlink10.CELLULAR_NETWORK_FAILED_REASON_SIM_MISSING = 2 // SIM is required for the modem but missing +mavlink10.CELLULAR_NETWORK_FAILED_REASON_SIM_ERROR = 3 // SIM is available, but not usuable for connection +mavlink10.CELLULAR_NETWORK_FAILED_REASON_ENUM_END = 4 // + // PRECISION_LAND_MODE mavlink10.PRECISION_LAND_MODE_DISABLED = 0 // Normal (non-precision) landing. mavlink10.PRECISION_LAND_MODE_OPPORTUNISTIC = 1 // Use precision landing if beacon detected when land command accepted, @@ -2014,11 +2210,381 @@ mavlink10.PRECISION_LAND_MODE_REQUIRED = 2 // Use precision landing, searching f mavlink10.PRECISION_LAND_MODE_ENUM_END = 3 // // PARACHUTE_ACTION -mavlink10.PARACHUTE_DISABLE = 0 // Disable parachute release. -mavlink10.PARACHUTE_ENABLE = 1 // Enable parachute release. -mavlink10.PARACHUTE_RELEASE = 2 // Release parachute. +mavlink10.PARACHUTE_DISABLE = 0 // Disable auto-release of parachute (i.e. release triggered by crash + // detectors). +mavlink10.PARACHUTE_ENABLE = 1 // Enable auto-release of parachute. +mavlink10.PARACHUTE_RELEASE = 2 // Release parachute and kill motors. mavlink10.PARACHUTE_ACTION_ENUM_END = 3 // +// MAV_TUNNEL_PAYLOAD_TYPE +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_UNKNOWN = 0 // Encoding of payload unknown. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED0 = 200 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED1 = 201 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED2 = 202 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED3 = 203 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED4 = 204 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED5 = 205 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED6 = 206 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED7 = 207 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED8 = 208 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_STORM32_RESERVED9 = 209 // Registered for STorM32 gimbal controller. +mavlink10.MAV_TUNNEL_PAYLOAD_TYPE_ENUM_END = 210 // + +// MAV_ODID_ID_TYPE +mavlink10.MAV_ODID_ID_TYPE_NONE = 0 // No type defined. +mavlink10.MAV_ODID_ID_TYPE_SERIAL_NUMBER = 1 // Manufacturer Serial Number (ANSI/CTA-2063 format). +mavlink10.MAV_ODID_ID_TYPE_CAA_REGISTRATION_ID = 2 // CAA (Civil Aviation Authority) registered ID. Format: [ICAO Country + // Code].[CAA Assigned ID]. +mavlink10.MAV_ODID_ID_TYPE_UTM_ASSIGNED_UUID = 3 // UTM (Unmanned Traffic Management) assigned UUID (RFC4122). +mavlink10.MAV_ODID_ID_TYPE_ENUM_END = 4 // + +// MAV_ODID_UA_TYPE +mavlink10.MAV_ODID_UA_TYPE_NONE = 0 // No UA (Unmanned Aircraft) type defined. +mavlink10.MAV_ODID_UA_TYPE_AEROPLANE = 1 // Aeroplane/Airplane. Fixed wing. +mavlink10.MAV_ODID_UA_TYPE_HELICOPTER_OR_MULTIROTOR = 2 // Helicopter or multirotor. +mavlink10.MAV_ODID_UA_TYPE_GYROPLANE = 3 // Gyroplane. +mavlink10.MAV_ODID_UA_TYPE_HYBRID_LIFT = 4 // VTOL (Vertical Take-Off and Landing). Fixed wing aircraft that can + // take off vertically. +mavlink10.MAV_ODID_UA_TYPE_ORNITHOPTER = 5 // Ornithopter. +mavlink10.MAV_ODID_UA_TYPE_GLIDER = 6 // Glider. +mavlink10.MAV_ODID_UA_TYPE_KITE = 7 // Kite. +mavlink10.MAV_ODID_UA_TYPE_FREE_BALLOON = 8 // Free Balloon. +mavlink10.MAV_ODID_UA_TYPE_CAPTIVE_BALLOON = 9 // Captive Balloon. +mavlink10.MAV_ODID_UA_TYPE_AIRSHIP = 10 // Airship. E.g. a blimp. +mavlink10.MAV_ODID_UA_TYPE_FREE_FALL_PARACHUTE = 11 // Free Fall/Parachute (unpowered). +mavlink10.MAV_ODID_UA_TYPE_ROCKET = 12 // Rocket. +mavlink10.MAV_ODID_UA_TYPE_TETHERED_POWERED_AIRCRAFT = 13 // Tethered powered aircraft. +mavlink10.MAV_ODID_UA_TYPE_GROUND_OBSTACLE = 14 // Ground Obstacle. +mavlink10.MAV_ODID_UA_TYPE_OTHER = 15 // Other type of aircraft not listed earlier. +mavlink10.MAV_ODID_UA_TYPE_ENUM_END = 16 // + +// MAV_ODID_STATUS +mavlink10.MAV_ODID_STATUS_UNDECLARED = 0 // The status of the (UA) Unmanned Aircraft is undefined. +mavlink10.MAV_ODID_STATUS_GROUND = 1 // The UA is on the ground. +mavlink10.MAV_ODID_STATUS_AIRBORNE = 2 // The UA is in the air. +mavlink10.MAV_ODID_STATUS_EMERGENCY = 3 // The UA is having an emergency. +mavlink10.MAV_ODID_STATUS_ENUM_END = 4 // + +// MAV_ODID_HEIGHT_REF +mavlink10.MAV_ODID_HEIGHT_REF_OVER_TAKEOFF = 0 // The height field is relative to the take-off location. +mavlink10.MAV_ODID_HEIGHT_REF_OVER_GROUND = 1 // The height field is relative to ground. +mavlink10.MAV_ODID_HEIGHT_REF_ENUM_END = 2 // + +// MAV_ODID_HOR_ACC +mavlink10.MAV_ODID_HOR_ACC_UNKNOWN = 0 // The horizontal accuracy is unknown. +mavlink10.MAV_ODID_HOR_ACC_10NM = 1 // The horizontal accuracy is smaller than 10 Nautical Miles. 18.52 km. +mavlink10.MAV_ODID_HOR_ACC_4NM = 2 // The horizontal accuracy is smaller than 4 Nautical Miles. 7.408 km. +mavlink10.MAV_ODID_HOR_ACC_2NM = 3 // The horizontal accuracy is smaller than 2 Nautical Miles. 3.704 km. +mavlink10.MAV_ODID_HOR_ACC_1NM = 4 // The horizontal accuracy is smaller than 1 Nautical Miles. 1.852 km. +mavlink10.MAV_ODID_HOR_ACC_0_5NM = 5 // The horizontal accuracy is smaller than 0.5 Nautical Miles. 926 m. +mavlink10.MAV_ODID_HOR_ACC_0_3NM = 6 // The horizontal accuracy is smaller than 0.3 Nautical Miles. 555.6 m. +mavlink10.MAV_ODID_HOR_ACC_0_1NM = 7 // The horizontal accuracy is smaller than 0.1 Nautical Miles. 185.2 m. +mavlink10.MAV_ODID_HOR_ACC_0_05NM = 8 // The horizontal accuracy is smaller than 0.05 Nautical Miles. 92.6 m. +mavlink10.MAV_ODID_HOR_ACC_30_METER = 9 // The horizontal accuracy is smaller than 30 meter. +mavlink10.MAV_ODID_HOR_ACC_10_METER = 10 // The horizontal accuracy is smaller than 10 meter. +mavlink10.MAV_ODID_HOR_ACC_3_METER = 11 // The horizontal accuracy is smaller than 3 meter. +mavlink10.MAV_ODID_HOR_ACC_1_METER = 12 // The horizontal accuracy is smaller than 1 meter. +mavlink10.MAV_ODID_HOR_ACC_ENUM_END = 13 // + +// MAV_ODID_VER_ACC +mavlink10.MAV_ODID_VER_ACC_UNKNOWN = 0 // The vertical accuracy is unknown. +mavlink10.MAV_ODID_VER_ACC_150_METER = 1 // The vertical accuracy is smaller than 150 meter. +mavlink10.MAV_ODID_VER_ACC_45_METER = 2 // The vertical accuracy is smaller than 45 meter. +mavlink10.MAV_ODID_VER_ACC_25_METER = 3 // The vertical accuracy is smaller than 25 meter. +mavlink10.MAV_ODID_VER_ACC_10_METER = 4 // The vertical accuracy is smaller than 10 meter. +mavlink10.MAV_ODID_VER_ACC_3_METER = 5 // The vertical accuracy is smaller than 3 meter. +mavlink10.MAV_ODID_VER_ACC_1_METER = 6 // The vertical accuracy is smaller than 1 meter. +mavlink10.MAV_ODID_VER_ACC_ENUM_END = 7 // + +// MAV_ODID_SPEED_ACC +mavlink10.MAV_ODID_SPEED_ACC_UNKNOWN = 0 // The speed accuracy is unknown. +mavlink10.MAV_ODID_SPEED_ACC_10_METERS_PER_SECOND = 1 // The speed accuracy is smaller than 10 meters per second. +mavlink10.MAV_ODID_SPEED_ACC_3_METERS_PER_SECOND = 2 // The speed accuracy is smaller than 3 meters per second. +mavlink10.MAV_ODID_SPEED_ACC_1_METERS_PER_SECOND = 3 // The speed accuracy is smaller than 1 meters per second. +mavlink10.MAV_ODID_SPEED_ACC_0_3_METERS_PER_SECOND = 4 // The speed accuracy is smaller than 0.3 meters per second. +mavlink10.MAV_ODID_SPEED_ACC_ENUM_END = 5 // + +// MAV_ODID_TIME_ACC +mavlink10.MAV_ODID_TIME_ACC_UNKNOWN = 0 // The timestamp accuracy is unknown. +mavlink10.MAV_ODID_TIME_ACC_0_1_SECOND = 1 // The timestamp accuracy is smaller than or equal to 0.1 second. +mavlink10.MAV_ODID_TIME_ACC_0_2_SECOND = 2 // The timestamp accuracy is smaller than or equal to 0.2 second. +mavlink10.MAV_ODID_TIME_ACC_0_3_SECOND = 3 // The timestamp accuracy is smaller than or equal to 0.3 second. +mavlink10.MAV_ODID_TIME_ACC_0_4_SECOND = 4 // The timestamp accuracy is smaller than or equal to 0.4 second. +mavlink10.MAV_ODID_TIME_ACC_0_5_SECOND = 5 // The timestamp accuracy is smaller than or equal to 0.5 second. +mavlink10.MAV_ODID_TIME_ACC_0_6_SECOND = 6 // The timestamp accuracy is smaller than or equal to 0.6 second. +mavlink10.MAV_ODID_TIME_ACC_0_7_SECOND = 7 // The timestamp accuracy is smaller than or equal to 0.7 second. +mavlink10.MAV_ODID_TIME_ACC_0_8_SECOND = 8 // The timestamp accuracy is smaller than or equal to 0.8 second. +mavlink10.MAV_ODID_TIME_ACC_0_9_SECOND = 9 // The timestamp accuracy is smaller than or equal to 0.9 second. +mavlink10.MAV_ODID_TIME_ACC_1_0_SECOND = 10 // The timestamp accuracy is smaller than or equal to 1.0 second. +mavlink10.MAV_ODID_TIME_ACC_1_1_SECOND = 11 // The timestamp accuracy is smaller than or equal to 1.1 second. +mavlink10.MAV_ODID_TIME_ACC_1_2_SECOND = 12 // The timestamp accuracy is smaller than or equal to 1.2 second. +mavlink10.MAV_ODID_TIME_ACC_1_3_SECOND = 13 // The timestamp accuracy is smaller than or equal to 1.3 second. +mavlink10.MAV_ODID_TIME_ACC_1_4_SECOND = 14 // The timestamp accuracy is smaller than or equal to 1.4 second. +mavlink10.MAV_ODID_TIME_ACC_1_5_SECOND = 15 // The timestamp accuracy is smaller than or equal to 1.5 second. +mavlink10.MAV_ODID_TIME_ACC_ENUM_END = 16 // + +// MAV_ODID_AUTH_TYPE +mavlink10.MAV_ODID_AUTH_TYPE_NONE = 0 // No authentication type is specified. +mavlink10.MAV_ODID_AUTH_TYPE_UAS_ID_SIGNATURE = 1 // Signature for the UAS (Unmanned Aircraft System) ID. +mavlink10.MAV_ODID_AUTH_TYPE_OPERATOR_ID_SIGNATURE = 2 // Signature for the Operator ID. +mavlink10.MAV_ODID_AUTH_TYPE_MESSAGE_SET_SIGNATURE = 3 // Signature for the entire message set. +mavlink10.MAV_ODID_AUTH_TYPE_NETWORK_REMOTE_ID = 4 // Authentication is provided by Network Remote ID. +mavlink10.MAV_ODID_AUTH_TYPE_ENUM_END = 5 // + +// MAV_ODID_DESC_TYPE +mavlink10.MAV_ODID_DESC_TYPE_TEXT = 0 // Free-form text description of the purpose of the flight. +mavlink10.MAV_ODID_DESC_TYPE_ENUM_END = 1 // + +// MAV_ODID_OPERATOR_LOCATION_TYPE +mavlink10.MAV_ODID_OPERATOR_LOCATION_TYPE_TAKEOFF = 0 // The location of the operator is the same as the take-off location. +mavlink10.MAV_ODID_OPERATOR_LOCATION_TYPE_LIVE_GNSS = 1 // The location of the operator is based on live GNSS data. +mavlink10.MAV_ODID_OPERATOR_LOCATION_TYPE_FIXED = 2 // The location of the operator is a fixed location. +mavlink10.MAV_ODID_OPERATOR_LOCATION_TYPE_ENUM_END = 3 // + +// MAV_ODID_CLASSIFICATION_TYPE +mavlink10.MAV_ODID_CLASSIFICATION_TYPE_UNDECLARED = 0 // The classification type for the UA is undeclared. +mavlink10.MAV_ODID_CLASSIFICATION_TYPE_EU = 1 // The classification type for the UA follows EU (European Union) + // specifications. +mavlink10.MAV_ODID_CLASSIFICATION_TYPE_ENUM_END = 2 // + +// MAV_ODID_CATEGORY_EU +mavlink10.MAV_ODID_CATEGORY_EU_UNDECLARED = 0 // The category for the UA, according to the EU specification, is + // undeclared. +mavlink10.MAV_ODID_CATEGORY_EU_OPEN = 1 // The category for the UA, according to the EU specification, is the + // Open category. +mavlink10.MAV_ODID_CATEGORY_EU_SPECIFIC = 2 // The category for the UA, according to the EU specification, is the + // Specific category. +mavlink10.MAV_ODID_CATEGORY_EU_CERTIFIED = 3 // The category for the UA, according to the EU specification, is the + // Certified category. +mavlink10.MAV_ODID_CATEGORY_EU_ENUM_END = 4 // + +// MAV_ODID_CLASS_EU +mavlink10.MAV_ODID_CLASS_EU_UNDECLARED = 0 // The class for the UA, according to the EU specification, is + // undeclared. +mavlink10.MAV_ODID_CLASS_EU_CLASS_0 = 1 // The class for the UA, according to the EU specification, is Class 0. +mavlink10.MAV_ODID_CLASS_EU_CLASS_1 = 2 // The class for the UA, according to the EU specification, is Class 1. +mavlink10.MAV_ODID_CLASS_EU_CLASS_2 = 3 // The class for the UA, according to the EU specification, is Class 2. +mavlink10.MAV_ODID_CLASS_EU_CLASS_3 = 4 // The class for the UA, according to the EU specification, is Class 3. +mavlink10.MAV_ODID_CLASS_EU_CLASS_4 = 5 // The class for the UA, according to the EU specification, is Class 4. +mavlink10.MAV_ODID_CLASS_EU_CLASS_5 = 6 // The class for the UA, according to the EU specification, is Class 5. +mavlink10.MAV_ODID_CLASS_EU_CLASS_6 = 7 // The class for the UA, according to the EU specification, is Class 6. +mavlink10.MAV_ODID_CLASS_EU_ENUM_END = 8 // + +// MAV_ODID_OPERATOR_ID_TYPE +mavlink10.MAV_ODID_OPERATOR_ID_TYPE_CAA = 0 // CAA (Civil Aviation Authority) registered operator ID. +mavlink10.MAV_ODID_OPERATOR_ID_TYPE_ENUM_END = 1 // + +// TUNE_FORMAT +mavlink10.TUNE_FORMAT_QBASIC1_1 = 1 // Format is QBasic 1.1 Play: + // https://www.qbasic.net/en/reference/qb11/St + // atement/PLAY-006.htm. +mavlink10.TUNE_FORMAT_MML_MODERN = 2 // Format is Modern Music Markup Language (MML): + // https://en.wikipedia.org/wiki/Music_Macro_L + // anguage#Modern_MML. +mavlink10.TUNE_FORMAT_ENUM_END = 3 // + +// COMPONENT_CAP_FLAGS +mavlink10.COMPONENT_CAP_FLAGS_PARAM = 1 // Component has parameters, and supports the parameter protocol (PARAM + // messages). +mavlink10.COMPONENT_CAP_FLAGS_PARAM_EXT = 2 // Component has parameters, and supports the extended parameter protocol + // (PARAM_EXT messages). +mavlink10.COMPONENT_CAP_FLAGS_ENUM_END = 3 // + +// AIS_TYPE +mavlink10.AIS_TYPE_UNKNOWN = 0 // Not available (default). +mavlink10.AIS_TYPE_RESERVED_1 = 1 // +mavlink10.AIS_TYPE_RESERVED_2 = 2 // +mavlink10.AIS_TYPE_RESERVED_3 = 3 // +mavlink10.AIS_TYPE_RESERVED_4 = 4 // +mavlink10.AIS_TYPE_RESERVED_5 = 5 // +mavlink10.AIS_TYPE_RESERVED_6 = 6 // +mavlink10.AIS_TYPE_RESERVED_7 = 7 // +mavlink10.AIS_TYPE_RESERVED_8 = 8 // +mavlink10.AIS_TYPE_RESERVED_9 = 9 // +mavlink10.AIS_TYPE_RESERVED_10 = 10 // +mavlink10.AIS_TYPE_RESERVED_11 = 11 // +mavlink10.AIS_TYPE_RESERVED_12 = 12 // +mavlink10.AIS_TYPE_RESERVED_13 = 13 // +mavlink10.AIS_TYPE_RESERVED_14 = 14 // +mavlink10.AIS_TYPE_RESERVED_15 = 15 // +mavlink10.AIS_TYPE_RESERVED_16 = 16 // +mavlink10.AIS_TYPE_RESERVED_17 = 17 // +mavlink10.AIS_TYPE_RESERVED_18 = 18 // +mavlink10.AIS_TYPE_RESERVED_19 = 19 // +mavlink10.AIS_TYPE_WIG = 20 // Wing In Ground effect. +mavlink10.AIS_TYPE_WIG_HAZARDOUS_A = 21 // +mavlink10.AIS_TYPE_WIG_HAZARDOUS_B = 22 // +mavlink10.AIS_TYPE_WIG_HAZARDOUS_C = 23 // +mavlink10.AIS_TYPE_WIG_HAZARDOUS_D = 24 // +mavlink10.AIS_TYPE_WIG_RESERVED_1 = 25 // +mavlink10.AIS_TYPE_WIG_RESERVED_2 = 26 // +mavlink10.AIS_TYPE_WIG_RESERVED_3 = 27 // +mavlink10.AIS_TYPE_WIG_RESERVED_4 = 28 // +mavlink10.AIS_TYPE_WIG_RESERVED_5 = 29 // +mavlink10.AIS_TYPE_FISHING = 30 // +mavlink10.AIS_TYPE_TOWING = 31 // +mavlink10.AIS_TYPE_TOWING_LARGE = 32 // Towing: length exceeds 200m or breadth exceeds 25m. +mavlink10.AIS_TYPE_DREDGING = 33 // Dredging or other underwater ops. +mavlink10.AIS_TYPE_DIVING = 34 // +mavlink10.AIS_TYPE_MILITARY = 35 // +mavlink10.AIS_TYPE_SAILING = 36 // +mavlink10.AIS_TYPE_PLEASURE = 37 // +mavlink10.AIS_TYPE_RESERVED_20 = 38 // +mavlink10.AIS_TYPE_RESERVED_21 = 39 // +mavlink10.AIS_TYPE_HSC = 40 // High Speed Craft. +mavlink10.AIS_TYPE_HSC_HAZARDOUS_A = 41 // +mavlink10.AIS_TYPE_HSC_HAZARDOUS_B = 42 // +mavlink10.AIS_TYPE_HSC_HAZARDOUS_C = 43 // +mavlink10.AIS_TYPE_HSC_HAZARDOUS_D = 44 // +mavlink10.AIS_TYPE_HSC_RESERVED_1 = 45 // +mavlink10.AIS_TYPE_HSC_RESERVED_2 = 46 // +mavlink10.AIS_TYPE_HSC_RESERVED_3 = 47 // +mavlink10.AIS_TYPE_HSC_RESERVED_4 = 48 // +mavlink10.AIS_TYPE_HSC_UNKNOWN = 49 // +mavlink10.AIS_TYPE_PILOT = 50 // +mavlink10.AIS_TYPE_SAR = 51 // Search And Rescue vessel. +mavlink10.AIS_TYPE_TUG = 52 // +mavlink10.AIS_TYPE_PORT_TENDER = 53 // +mavlink10.AIS_TYPE_ANTI_POLLUTION = 54 // Anti-pollution equipment. +mavlink10.AIS_TYPE_LAW_ENFORCEMENT = 55 // +mavlink10.AIS_TYPE_SPARE_LOCAL_1 = 56 // +mavlink10.AIS_TYPE_SPARE_LOCAL_2 = 57 // +mavlink10.AIS_TYPE_MEDICAL_TRANSPORT = 58 // +mavlink10.AIS_TYPE_NONECOMBATANT = 59 // Noncombatant ship according to RR Resolution No. 18. +mavlink10.AIS_TYPE_PASSENGER = 60 // +mavlink10.AIS_TYPE_PASSENGER_HAZARDOUS_A = 61 // +mavlink10.AIS_TYPE_PASSENGER_HAZARDOUS_B = 62 // +mavlink10.AIS_TYPE_AIS_TYPE_PASSENGER_HAZARDOUS_C = 63 // +mavlink10.AIS_TYPE_PASSENGER_HAZARDOUS_D = 64 // +mavlink10.AIS_TYPE_PASSENGER_RESERVED_1 = 65 // +mavlink10.AIS_TYPE_PASSENGER_RESERVED_2 = 66 // +mavlink10.AIS_TYPE_PASSENGER_RESERVED_3 = 67 // +mavlink10.AIS_TYPE_AIS_TYPE_PASSENGER_RESERVED_4 = 68 // +mavlink10.AIS_TYPE_PASSENGER_UNKNOWN = 69 // +mavlink10.AIS_TYPE_CARGO = 70 // +mavlink10.AIS_TYPE_CARGO_HAZARDOUS_A = 71 // +mavlink10.AIS_TYPE_CARGO_HAZARDOUS_B = 72 // +mavlink10.AIS_TYPE_CARGO_HAZARDOUS_C = 73 // +mavlink10.AIS_TYPE_CARGO_HAZARDOUS_D = 74 // +mavlink10.AIS_TYPE_CARGO_RESERVED_1 = 75 // +mavlink10.AIS_TYPE_CARGO_RESERVED_2 = 76 // +mavlink10.AIS_TYPE_CARGO_RESERVED_3 = 77 // +mavlink10.AIS_TYPE_CARGO_RESERVED_4 = 78 // +mavlink10.AIS_TYPE_CARGO_UNKNOWN = 79 // +mavlink10.AIS_TYPE_TANKER = 80 // +mavlink10.AIS_TYPE_TANKER_HAZARDOUS_A = 81 // +mavlink10.AIS_TYPE_TANKER_HAZARDOUS_B = 82 // +mavlink10.AIS_TYPE_TANKER_HAZARDOUS_C = 83 // +mavlink10.AIS_TYPE_TANKER_HAZARDOUS_D = 84 // +mavlink10.AIS_TYPE_TANKER_RESERVED_1 = 85 // +mavlink10.AIS_TYPE_TANKER_RESERVED_2 = 86 // +mavlink10.AIS_TYPE_TANKER_RESERVED_3 = 87 // +mavlink10.AIS_TYPE_TANKER_RESERVED_4 = 88 // +mavlink10.AIS_TYPE_TANKER_UNKNOWN = 89 // +mavlink10.AIS_TYPE_OTHER = 90 // +mavlink10.AIS_TYPE_OTHER_HAZARDOUS_A = 91 // +mavlink10.AIS_TYPE_OTHER_HAZARDOUS_B = 92 // +mavlink10.AIS_TYPE_OTHER_HAZARDOUS_C = 93 // +mavlink10.AIS_TYPE_OTHER_HAZARDOUS_D = 94 // +mavlink10.AIS_TYPE_OTHER_RESERVED_1 = 95 // +mavlink10.AIS_TYPE_OTHER_RESERVED_2 = 96 // +mavlink10.AIS_TYPE_OTHER_RESERVED_3 = 97 // +mavlink10.AIS_TYPE_OTHER_RESERVED_4 = 98 // +mavlink10.AIS_TYPE_OTHER_UNKNOWN = 99 // +mavlink10.AIS_TYPE_ENUM_END = 100 // + +// AIS_NAV_STATUS +mavlink10.UNDER_WAY = 0 // Under way using engine. +mavlink10.AIS_NAV_ANCHORED = 1 // +mavlink10.AIS_NAV_UN_COMMANDED = 2 // +mavlink10.AIS_NAV_RESTRICTED_MANOEUVERABILITY = 3 // +mavlink10.AIS_NAV_DRAUGHT_CONSTRAINED = 4 // +mavlink10.AIS_NAV_MOORED = 5 // +mavlink10.AIS_NAV_AGROUND = 6 // +mavlink10.AIS_NAV_FISHING = 7 // +mavlink10.AIS_NAV_SAILING = 8 // +mavlink10.AIS_NAV_RESERVED_HSC = 9 // +mavlink10.AIS_NAV_RESERVED_WIG = 10 // +mavlink10.AIS_NAV_RESERVED_1 = 11 // +mavlink10.AIS_NAV_RESERVED_2 = 12 // +mavlink10.AIS_NAV_RESERVED_3 = 13 // +mavlink10.AIS_NAV_AIS_SART = 14 // Search And Rescue Transponder. +mavlink10.AIS_NAV_UNKNOWN = 15 // Not available (default). +mavlink10.AIS_NAV_STATUS_ENUM_END = 16 // + +// AIS_FLAGS +mavlink10.AIS_FLAGS_POSITION_ACCURACY = 1 // 1 = Position accuracy less than 10m, 0 = position accuracy greater + // than 10m. +mavlink10.AIS_FLAGS_VALID_COG = 2 // +mavlink10.AIS_FLAGS_VALID_VELOCITY = 4 // +mavlink10.AIS_FLAGS_HIGH_VELOCITY = 8 // 1 = Velocity over 52.5765m/s (102.2 knots) +mavlink10.AIS_FLAGS_VALID_TURN_RATE = 16 // +mavlink10.AIS_FLAGS_TURN_RATE_SIGN_ONLY = 32 // Only the sign of the returned turn rate value is valid, either greater + // than 5deg/30s or less than -5deg/30s +mavlink10.AIS_FLAGS_VALID_DIMENSIONS = 64 // +mavlink10.AIS_FLAGS_LARGE_BOW_DIMENSION = 128 // Distance to bow is larger than 511m +mavlink10.AIS_FLAGS_LARGE_STERN_DIMENSION = 256 // Distance to stern is larger than 511m +mavlink10.AIS_FLAGS_LARGE_PORT_DIMENSION = 512 // Distance to port side is larger than 63m +mavlink10.AIS_FLAGS_LARGE_STARBOARD_DIMENSION = 1024 // Distance to starboard side is larger than 63m +mavlink10.AIS_FLAGS_VALID_CALLSIGN = 2048 // +mavlink10.AIS_FLAGS_VALID_NAME = 4096 // +mavlink10.AIS_FLAGS_ENUM_END = 4097 // + +// FAILURE_UNIT +mavlink10.FAILURE_UNIT_SENSOR_GYRO = 0 // +mavlink10.FAILURE_UNIT_SENSOR_ACCEL = 1 // +mavlink10.FAILURE_UNIT_SENSOR_MAG = 2 // +mavlink10.FAILURE_UNIT_SENSOR_BARO = 3 // +mavlink10.FAILURE_UNIT_SENSOR_GPS = 4 // +mavlink10.FAILURE_UNIT_SENSOR_OPTICAL_FLOW = 5 // +mavlink10.FAILURE_UNIT_SENSOR_VIO = 6 // +mavlink10.FAILURE_UNIT_SENSOR_DISTANCE_SENSOR = 7 // +mavlink10.FAILURE_UNIT_SENSOR_AIRSPEED = 8 // +mavlink10.FAILURE_UNIT_SYSTEM_BATTERY = 100 // +mavlink10.FAILURE_UNIT_SYSTEM_MOTOR = 101 // +mavlink10.FAILURE_UNIT_SYSTEM_SERVO = 102 // +mavlink10.FAILURE_UNIT_SYSTEM_AVOIDANCE = 103 // +mavlink10.FAILURE_UNIT_SYSTEM_RC_SIGNAL = 104 // +mavlink10.FAILURE_UNIT_SYSTEM_MAVLINK_SIGNAL = 105 // +mavlink10.FAILURE_UNIT_ENUM_END = 106 // + +// FAILURE_TYPE +mavlink10.FAILURE_TYPE_OK = 0 // No failure injected, used to reset a previous failure. +mavlink10.FAILURE_TYPE_OFF = 1 // Sets unit off, so completely non-responsive. +mavlink10.FAILURE_TYPE_STUCK = 2 // Unit is stuck e.g. keeps reporting the same value. +mavlink10.FAILURE_TYPE_GARBAGE = 3 // Unit is reporting complete garbage. +mavlink10.FAILURE_TYPE_WRONG = 4 // Unit is consistently wrong. +mavlink10.FAILURE_TYPE_SLOW = 5 // Unit is slow, so e.g. reporting at slower than expected rate. +mavlink10.FAILURE_TYPE_DELAYED = 6 // Data of unit is delayed in time. +mavlink10.FAILURE_TYPE_INTERMITTENT = 7 // Unit is sometimes working, sometimes not. +mavlink10.FAILURE_TYPE_ENUM_END = 8 // + +// MAV_WINCH_STATUS_FLAG +mavlink10.MAV_WINCH_STATUS_HEALTHY = 1 // Winch is healthy +mavlink10.MAV_WINCH_STATUS_FULLY_RETRACTED = 2 // Winch thread is fully retracted +mavlink10.MAV_WINCH_STATUS_MOVING = 4 // Winch motor is moving +mavlink10.MAV_WINCH_STATUS_CLUTCH_ENGAGED = 8 // Winch clutch is engaged allowing motor to move freely +mavlink10.MAV_WINCH_STATUS_FLAG_ENUM_END = 9 // + +// MAG_CAL_STATUS +mavlink10.MAG_CAL_NOT_STARTED = 0 // +mavlink10.MAG_CAL_WAITING_TO_START = 1 // +mavlink10.MAG_CAL_RUNNING_STEP_ONE = 2 // +mavlink10.MAG_CAL_RUNNING_STEP_TWO = 3 // +mavlink10.MAG_CAL_SUCCESS = 4 // +mavlink10.MAG_CAL_FAILED = 5 // +mavlink10.MAG_CAL_BAD_ORIENTATION = 6 // +mavlink10.MAG_CAL_BAD_RADIUS = 7 // +mavlink10.MAG_CAL_STATUS_ENUM_END = 8 // + +// MAV_EVENT_ERROR_REASON +mavlink10.MAV_EVENT_ERROR_REASON_UNAVAILABLE = 0 // The requested event is not available (anymore). +mavlink10.MAV_EVENT_ERROR_REASON_ENUM_END = 1 // + +// MAV_EVENT_CURRENT_SEQUENCE_FLAGS +mavlink10.MAV_EVENT_CURRENT_SEQUENCE_FLAGS_RESET = 1 // A sequence reset has happened (e.g. vehicle reboot). +mavlink10.MAV_EVENT_CURRENT_SEQUENCE_FLAGS_ENUM_END = 2 // + // UAVIONIX_ADSB_OUT_DYNAMIC_STATE mavlink10.UAVIONIX_ADSB_OUT_DYNAMIC_STATE_INTENT_CHANGE = 1 // mavlink10.UAVIONIX_ADSB_OUT_DYNAMIC_STATE_AUTOPILOT_ENABLED = 2 // @@ -2110,6 +2676,420 @@ mavlink10.ICAROUS_FMS_STATE_APPROACH = 4 // mavlink10.ICAROUS_FMS_STATE_LAND = 5 // mavlink10.ICAROUS_FMS_STATE_ENUM_END = 6 // +// MAV_AUTOPILOT +mavlink10.MAV_AUTOPILOT_GENERIC = 0 // Generic autopilot, full support for everything +mavlink10.MAV_AUTOPILOT_RESERVED = 1 // Reserved for future use. +mavlink10.MAV_AUTOPILOT_SLUGS = 2 // SLUGS autopilot, http://slugsuav.soe.ucsc.edu +mavlink10.MAV_AUTOPILOT_ARDUPILOTMEGA = 3 // ArduPilot - Plane/Copter/Rover/Sub/Tracker, https://ardupilot.org +mavlink10.MAV_AUTOPILOT_OPENPILOT = 4 // OpenPilot, http://openpilot.org +mavlink10.MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5 // Generic autopilot only supporting simple waypoints +mavlink10.MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6 // Generic autopilot supporting waypoints and other simple navigation + // commands +mavlink10.MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7 // Generic autopilot supporting the full mission command set +mavlink10.MAV_AUTOPILOT_INVALID = 8 // No valid autopilot, e.g. a GCS or other MAVLink component +mavlink10.MAV_AUTOPILOT_PPZ = 9 // PPZ UAV - http://nongnu.org/paparazzi +mavlink10.MAV_AUTOPILOT_UDB = 10 // UAV Dev Board +mavlink10.MAV_AUTOPILOT_FP = 11 // FlexiPilot +mavlink10.MAV_AUTOPILOT_PX4 = 12 // PX4 Autopilot - http://px4.io/ +mavlink10.MAV_AUTOPILOT_SMACCMPILOT = 13 // SMACCMPilot - http://smaccmpilot.org +mavlink10.MAV_AUTOPILOT_AUTOQUAD = 14 // AutoQuad -- http://autoquad.org +mavlink10.MAV_AUTOPILOT_ARMAZILA = 15 // Armazila -- http://armazila.com +mavlink10.MAV_AUTOPILOT_AEROB = 16 // Aerob -- http://aerob.ru +mavlink10.MAV_AUTOPILOT_ASLUAV = 17 // ASLUAV autopilot -- http://www.asl.ethz.ch +mavlink10.MAV_AUTOPILOT_SMARTAP = 18 // SmartAP Autopilot - http://sky-drones.com +mavlink10.MAV_AUTOPILOT_AIRRAILS = 19 // AirRails - http://uaventure.com +mavlink10.MAV_AUTOPILOT_ENUM_END = 20 // + +// MAV_TYPE +mavlink10.MAV_TYPE_GENERIC = 0 // Generic micro air vehicle +mavlink10.MAV_TYPE_FIXED_WING = 1 // Fixed wing aircraft. +mavlink10.MAV_TYPE_QUADROTOR = 2 // Quadrotor +mavlink10.MAV_TYPE_COAXIAL = 3 // Coaxial helicopter +mavlink10.MAV_TYPE_HELICOPTER = 4 // Normal helicopter with tail rotor. +mavlink10.MAV_TYPE_ANTENNA_TRACKER = 5 // Ground installation +mavlink10.MAV_TYPE_GCS = 6 // Operator control unit / ground control station +mavlink10.MAV_TYPE_AIRSHIP = 7 // Airship, controlled +mavlink10.MAV_TYPE_FREE_BALLOON = 8 // Free balloon, uncontrolled +mavlink10.MAV_TYPE_ROCKET = 9 // Rocket +mavlink10.MAV_TYPE_GROUND_ROVER = 10 // Ground rover +mavlink10.MAV_TYPE_SURFACE_BOAT = 11 // Surface vessel, boat, ship +mavlink10.MAV_TYPE_SUBMARINE = 12 // Submarine +mavlink10.MAV_TYPE_HEXAROTOR = 13 // Hexarotor +mavlink10.MAV_TYPE_OCTOROTOR = 14 // Octorotor +mavlink10.MAV_TYPE_TRICOPTER = 15 // Tricopter +mavlink10.MAV_TYPE_FLAPPING_WING = 16 // Flapping wing +mavlink10.MAV_TYPE_KITE = 17 // Kite +mavlink10.MAV_TYPE_ONBOARD_CONTROLLER = 18 // Onboard companion controller +mavlink10.MAV_TYPE_VTOL_DUOROTOR = 19 // Two-rotor VTOL using control surfaces in vertical operation in + // addition. Tailsitter. +mavlink10.MAV_TYPE_VTOL_QUADROTOR = 20 // Quad-rotor VTOL using a V-shaped quad config in vertical operation. + // Tailsitter. +mavlink10.MAV_TYPE_VTOL_TILTROTOR = 21 // Tiltrotor VTOL +mavlink10.MAV_TYPE_VTOL_RESERVED2 = 22 // VTOL reserved 2 +mavlink10.MAV_TYPE_VTOL_RESERVED3 = 23 // VTOL reserved 3 +mavlink10.MAV_TYPE_VTOL_RESERVED4 = 24 // VTOL reserved 4 +mavlink10.MAV_TYPE_VTOL_RESERVED5 = 25 // VTOL reserved 5 +mavlink10.MAV_TYPE_GIMBAL = 26 // Gimbal +mavlink10.MAV_TYPE_ADSB = 27 // ADSB system +mavlink10.MAV_TYPE_PARAFOIL = 28 // Steerable, nonrigid airfoil +mavlink10.MAV_TYPE_DODECAROTOR = 29 // Dodecarotor +mavlink10.MAV_TYPE_CAMERA = 30 // Camera +mavlink10.MAV_TYPE_CHARGING_STATION = 31 // Charging station +mavlink10.MAV_TYPE_FLARM = 32 // FLARM collision avoidance system +mavlink10.MAV_TYPE_SERVO = 33 // Servo +mavlink10.MAV_TYPE_ODID = 34 // Open Drone ID. See https://mavlink.io/en/services/opendroneid.html. +mavlink10.MAV_TYPE_DECAROTOR = 35 // Decarotor +mavlink10.MAV_TYPE_BATTERY = 36 // Battery +mavlink10.MAV_TYPE_ENUM_END = 37 // + +// MAV_MODE_FLAG +mavlink10.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1 // 0b00000001 Reserved for future use. +mavlink10.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. +mavlink10.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. +mavlink10.MAV_MODE_FLAG_GUIDED_ENABLED = 8 // 0b00001000 guided mode enabled, system flies waypoints / mission + // items. +mavlink10.MAV_MODE_FLAG_STABILIZE_ENABLED = 16 // 0b00010000 system stabilizes electronically its attitude (and + // optionally position). It needs however + // further control inputs to move around. +mavlink10.MAV_MODE_FLAG_HIL_ENABLED = 32 // 0b00100000 hardware in the loop simulation. All motors / actuators are + // blocked, but internal software is full + // operational. +mavlink10.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64 // 0b01000000 remote control input is enabled. +mavlink10.MAV_MODE_FLAG_SAFETY_ARMED = 128 // 0b10000000 MAV safety set to armed. Motors are enabled / running / can + // start. Ready to fly. Additional note: this + // flag is to be ignore when sent in the + // command MAV_CMD_DO_SET_MODE and + // MAV_CMD_COMPONENT_ARM_DISARM shall be used + // instead. The flag can still be used to + // report the armed state. +mavlink10.MAV_MODE_FLAG_ENUM_END = 129 // + +// MAV_MODE_FLAG_DECODE_POSITION +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1 // Eighth bit: 00000001 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_TEST = 2 // Seventh bit: 00000010 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4 // Sixth bit: 00000100 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8 // Fifth bit: 00001000 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16 // Fourth bit: 00010000 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_HIL = 32 // Third bit: 00100000 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64 // Second bit: 01000000 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128 // First bit: 10000000 +mavlink10.MAV_MODE_FLAG_DECODE_POSITION_ENUM_END = 129 // + +// MAV_STATE +mavlink10.MAV_STATE_UNINIT = 0 // Uninitialized system, state is unknown. +mavlink10.MAV_STATE_BOOT = 1 // System is booting up. +mavlink10.MAV_STATE_CALIBRATING = 2 // System is calibrating and not flight-ready. +mavlink10.MAV_STATE_STANDBY = 3 // System is grounded and on standby. It can be launched any time. +mavlink10.MAV_STATE_ACTIVE = 4 // System is active and might be already airborne. Motors are engaged. +mavlink10.MAV_STATE_CRITICAL = 5 // System is in a non-normal flight mode. It can however still navigate. +mavlink10.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. +mavlink10.MAV_STATE_POWEROFF = 7 // System just initialized its power-down sequence, will shut down now. +mavlink10.MAV_STATE_FLIGHT_TERMINATION = 8 // System is terminating itself. +mavlink10.MAV_STATE_ENUM_END = 9 // + +// MAV_COMPONENT +mavlink10.MAV_COMP_ID_ALL = 0 // Target id (target_component) used to broadcast messages to all + // components of the receiving system. + // Components should attempt to process + // messages with this component ID and forward + // to components on any other interfaces. + // Note: This is not a valid *source* + // component id for a message. +mavlink10.MAV_COMP_ID_AUTOPILOT1 = 1 // System flight controller component ("autopilot"). Only one autopilot + // is expected in a particular system. +mavlink10.MAV_COMP_ID_USER1 = 25 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER2 = 26 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER3 = 27 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER4 = 28 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER5 = 29 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER6 = 30 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER7 = 31 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER8 = 32 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER9 = 33 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER10 = 34 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER11 = 35 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER12 = 36 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER13 = 37 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER14 = 38 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER15 = 39 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER16 = 40 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER17 = 41 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER18 = 42 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER19 = 43 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER20 = 44 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER21 = 45 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER22 = 46 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER23 = 47 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER24 = 48 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER25 = 49 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER26 = 50 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER27 = 51 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER28 = 52 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER29 = 53 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER30 = 54 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER31 = 55 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER32 = 56 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER33 = 57 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER34 = 58 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER35 = 59 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER36 = 60 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER37 = 61 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER38 = 62 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER39 = 63 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER40 = 64 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER41 = 65 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER42 = 66 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER43 = 67 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_TELEMETRY_RADIO = 68 // Telemetry radio (e.g. SiK radio, or other component that emits + // RADIO_STATUS messages). +mavlink10.MAV_COMP_ID_USER45 = 69 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER46 = 70 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER47 = 71 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER48 = 72 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER49 = 73 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER50 = 74 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER51 = 75 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER52 = 76 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER53 = 77 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER54 = 78 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER55 = 79 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER56 = 80 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER57 = 81 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER58 = 82 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER59 = 83 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER60 = 84 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER61 = 85 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER62 = 86 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER63 = 87 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER64 = 88 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER65 = 89 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER66 = 90 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER67 = 91 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER68 = 92 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER69 = 93 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER70 = 94 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER71 = 95 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER72 = 96 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER73 = 97 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER74 = 98 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_USER75 = 99 // Id for a component on privately managed MAVLink network. Can be used + // for any purpose but may not be published by + // components outside of the private network. +mavlink10.MAV_COMP_ID_CAMERA = 100 // Camera #1. +mavlink10.MAV_COMP_ID_CAMERA2 = 101 // Camera #2. +mavlink10.MAV_COMP_ID_CAMERA3 = 102 // Camera #3. +mavlink10.MAV_COMP_ID_CAMERA4 = 103 // Camera #4. +mavlink10.MAV_COMP_ID_CAMERA5 = 104 // Camera #5. +mavlink10.MAV_COMP_ID_CAMERA6 = 105 // Camera #6. +mavlink10.MAV_COMP_ID_SERVO1 = 140 // Servo #1. +mavlink10.MAV_COMP_ID_SERVO2 = 141 // Servo #2. +mavlink10.MAV_COMP_ID_SERVO3 = 142 // Servo #3. +mavlink10.MAV_COMP_ID_SERVO4 = 143 // Servo #4. +mavlink10.MAV_COMP_ID_SERVO5 = 144 // Servo #5. +mavlink10.MAV_COMP_ID_SERVO6 = 145 // Servo #6. +mavlink10.MAV_COMP_ID_SERVO7 = 146 // Servo #7. +mavlink10.MAV_COMP_ID_SERVO8 = 147 // Servo #8. +mavlink10.MAV_COMP_ID_SERVO9 = 148 // Servo #9. +mavlink10.MAV_COMP_ID_SERVO10 = 149 // Servo #10. +mavlink10.MAV_COMP_ID_SERVO11 = 150 // Servo #11. +mavlink10.MAV_COMP_ID_SERVO12 = 151 // Servo #12. +mavlink10.MAV_COMP_ID_SERVO13 = 152 // Servo #13. +mavlink10.MAV_COMP_ID_SERVO14 = 153 // Servo #14. +mavlink10.MAV_COMP_ID_GIMBAL = 154 // Gimbal #1. +mavlink10.MAV_COMP_ID_LOG = 155 // Logging component. +mavlink10.MAV_COMP_ID_ADSB = 156 // Automatic Dependent Surveillance-Broadcast (ADS-B) component. +mavlink10.MAV_COMP_ID_OSD = 157 // On Screen Display (OSD) devices for video links. +mavlink10.MAV_COMP_ID_PERIPHERAL = 158 // Generic autopilot peripheral component ID. Meant for devices that do + // not implement the parameter microservice. +mavlink10.MAV_COMP_ID_QX1_GIMBAL = 159 // Gimbal ID for QX1. +mavlink10.MAV_COMP_ID_FLARM = 160 // FLARM collision alert component. +mavlink10.MAV_COMP_ID_GIMBAL2 = 171 // Gimbal #2. +mavlink10.MAV_COMP_ID_GIMBAL3 = 172 // Gimbal #3. +mavlink10.MAV_COMP_ID_GIMBAL4 = 173 // Gimbal #4 +mavlink10.MAV_COMP_ID_GIMBAL5 = 174 // Gimbal #5. +mavlink10.MAV_COMP_ID_GIMBAL6 = 175 // Gimbal #6. +mavlink10.MAV_COMP_ID_BATTERY = 180 // Battery #1. +mavlink10.MAV_COMP_ID_BATTERY2 = 181 // Battery #2. +mavlink10.MAV_COMP_ID_MISSIONPLANNER = 190 // Component that can generate/supply a mission flight plan (e.g. GCS or + // developer API). +mavlink10.MAV_COMP_ID_ONBOARD_COMPUTER = 191 // Component that lives on the onboard computer (companion computer) and + // has some generic functionalities, such as + // settings system parameters and monitoring + // the status of some processes that don't + // directly speak mavlink and so on. +mavlink10.MAV_COMP_ID_PATHPLANNER = 195 // Component that finds an optimal path between points based on a certain + // constraint (e.g. minimum snap, shortest + // path, cost, etc.). +mavlink10.MAV_COMP_ID_OBSTACLE_AVOIDANCE = 196 // Component that plans a collision free path between two points. +mavlink10.MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY = 197 // Component that provides position estimates using VIO techniques. +mavlink10.MAV_COMP_ID_PAIRING_MANAGER = 198 // Component that manages pairing of vehicle and GCS. +mavlink10.MAV_COMP_ID_IMU = 200 // Inertial Measurement Unit (IMU) #1. +mavlink10.MAV_COMP_ID_IMU_2 = 201 // Inertial Measurement Unit (IMU) #2. +mavlink10.MAV_COMP_ID_IMU_3 = 202 // Inertial Measurement Unit (IMU) #3. +mavlink10.MAV_COMP_ID_GPS = 220 // GPS #1. +mavlink10.MAV_COMP_ID_GPS2 = 221 // GPS #2. +mavlink10.MAV_COMP_ID_ODID_TXRX_1 = 236 // Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). +mavlink10.MAV_COMP_ID_ODID_TXRX_2 = 237 // Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). +mavlink10.MAV_COMP_ID_ODID_TXRX_3 = 238 // Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet). +mavlink10.MAV_COMP_ID_UDP_BRIDGE = 240 // Component to bridge MAVLink to UDP (i.e. from a UART). +mavlink10.MAV_COMP_ID_UART_BRIDGE = 241 // Component to bridge to UART (i.e. from UDP). +mavlink10.MAV_COMP_ID_TUNNEL_NODE = 242 // Component handling TUNNEL messages (e.g. vendor specific GUI of a + // component). +mavlink10.MAV_COMP_ID_SYSTEM_CONTROL = 250 // Component for handling system messages (e.g. to ARM, takeoff, etc.). +mavlink10.MAV_COMPONENT_ENUM_END = 251 // + // message IDs mavlink10.MAVLINK_MSG_ID_BAD_DATA = -1 mavlink10.MAVLINK_MSG_ID_SENSOR_OFFSETS = 150 @@ -2148,7 +3128,6 @@ mavlink10.MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK = 184 mavlink10.MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS = 185 mavlink10.MAVLINK_MSG_ID_LED_CONTROL = 186 mavlink10.MAVLINK_MSG_ID_MAG_CAL_PROGRESS = 191 -mavlink10.MAVLINK_MSG_ID_MAG_CAL_REPORT = 192 mavlink10.MAVLINK_MSG_ID_EKF_STATUS_REPORT = 193 mavlink10.MAVLINK_MSG_ID_PID_TUNING = 194 mavlink10.MAVLINK_MSG_ID_DEEPSTALL = 195 @@ -2160,16 +3139,16 @@ mavlink10.MAVLINK_MSG_ID_GOPRO_GET_REQUEST = 216 mavlink10.MAVLINK_MSG_ID_GOPRO_GET_RESPONSE = 217 mavlink10.MAVLINK_MSG_ID_GOPRO_SET_REQUEST = 218 mavlink10.MAVLINK_MSG_ID_GOPRO_SET_RESPONSE = 219 -mavlink10.MAVLINK_MSG_ID_EFI_STATUS = 225 mavlink10.MAVLINK_MSG_ID_RPM = 226 -mavlink10.MAVLINK_MSG_ID_HEARTBEAT = 0 mavlink10.MAVLINK_MSG_ID_SYS_STATUS = 1 mavlink10.MAVLINK_MSG_ID_SYSTEM_TIME = 2 mavlink10.MAVLINK_MSG_ID_PING = 4 mavlink10.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL = 5 mavlink10.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK = 6 mavlink10.MAVLINK_MSG_ID_AUTH_KEY = 7 +mavlink10.MAVLINK_MSG_ID_LINK_NODE_STATUS = 8 mavlink10.MAVLINK_MSG_ID_SET_MODE = 11 +mavlink10.MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION = 19 mavlink10.MAVLINK_MSG_ID_PARAM_REQUEST_READ = 20 mavlink10.MAVLINK_MSG_ID_PARAM_REQUEST_LIST = 21 mavlink10.MAVLINK_MSG_ID_PARAM_VALUE = 22 @@ -2202,6 +3181,7 @@ mavlink10.MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN = 48 mavlink10.MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN = 49 mavlink10.MAVLINK_MSG_ID_PARAM_MAP_RC = 50 mavlink10.MAVLINK_MSG_ID_MISSION_REQUEST_INT = 51 +mavlink10.MAVLINK_MSG_ID_MISSION_CHANGED = 52 mavlink10.MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 54 mavlink10.MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 55 mavlink10.MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV = 61 @@ -2218,6 +3198,7 @@ mavlink10.MAVLINK_MSG_ID_VFR_HUD = 74 mavlink10.MAVLINK_MSG_ID_COMMAND_INT = 75 mavlink10.MAVLINK_MSG_ID_COMMAND_LONG = 76 mavlink10.MAVLINK_MSG_ID_COMMAND_ACK = 77 +mavlink10.MAVLINK_MSG_ID_COMMAND_CANCEL = 80 mavlink10.MAVLINK_MSG_ID_MANUAL_SETPOINT = 81 mavlink10.MAVLINK_MSG_ID_SET_ATTITUDE_TARGET = 82 mavlink10.MAVLINK_MSG_ID_ATTITUDE_TARGET = 83 @@ -2280,11 +3261,14 @@ mavlink10.MAVLINK_MSG_ID_BATTERY_STATUS = 147 mavlink10.MAVLINK_MSG_ID_AUTOPILOT_VERSION = 148 mavlink10.MAVLINK_MSG_ID_LANDING_TARGET = 149 mavlink10.MAVLINK_MSG_ID_FENCE_STATUS = 162 +mavlink10.MAVLINK_MSG_ID_MAG_CAL_REPORT = 192 +mavlink10.MAVLINK_MSG_ID_EFI_STATUS = 225 mavlink10.MAVLINK_MSG_ID_ESTIMATOR_STATUS = 230 mavlink10.MAVLINK_MSG_ID_WIND_COV = 231 mavlink10.MAVLINK_MSG_ID_GPS_INPUT = 232 mavlink10.MAVLINK_MSG_ID_GPS_RTCM_DATA = 233 mavlink10.MAVLINK_MSG_ID_HIGH_LATENCY = 234 +mavlink10.MAVLINK_MSG_ID_HIGH_LATENCY2 = 235 mavlink10.MAVLINK_MSG_ID_VIBRATION = 241 mavlink10.MAVLINK_MSG_ID_HOME_POSITION = 242 mavlink10.MAVLINK_MSG_ID_SET_HOME_POSITION = 243 @@ -2299,6 +3283,7 @@ mavlink10.MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 251 mavlink10.MAVLINK_MSG_ID_NAMED_VALUE_INT = 252 mavlink10.MAVLINK_MSG_ID_STATUSTEXT = 253 mavlink10.MAVLINK_MSG_ID_DEBUG = 254 +mavlink10.MAVLINK_MSG_ID_HEARTBEAT = 0 mavlink10.messages = {}; /* @@ -3369,67 +4354,28 @@ Reports progress of compass calibration. attempt : Attempt number. (uint8_t) completion_pct : Completion percentage. (uint8_t) completion_mask : Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid). (uint8_t) - direction_x : Body frame direction vector for display. (float) - direction_y : Body frame direction vector for display. (float) - direction_z : Body frame direction vector for display. (float) - -*/ -mavlink10.messages.mag_cal_progress = function(compass_id, cal_mask, cal_status, attempt, completion_pct, completion_mask, direction_x, direction_y, direction_z) { - - this.format = ' value[float]. @@ -4172,13 +5111,17 @@ mavlink10.messages.param_value.prototype.pack = function(mav) { /* Set a parameter value (write new value to permanent storage). -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. The parameter microservice is documented at -https://mavlink.io/en/services/parameter.html +The receiving component should acknowledge the new parameter value by +broadcasting a PARAM_VALUE message (broadcasting ensures that multiple +GCS all have an up-to-date list of all parameters). If the sending GCS +did not receive a PARAM_VALUE within its timeout time, it should re- +send the PARAM_SET message. The parameter microservice is documented +at https://mavlink.io/en/services/parameter.html. PARAM_SET +may also be called within the context of a transaction (started with +MAV_CMD_PARAM_TRANSACTION). Within a transaction the receiving +component should respond with PARAM_ACK_TRANSACTION to the setter +component (instead of broadcasting PARAM_VALUE), and PARAM_SET should +be re-sent if this is ACK not received. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) @@ -4212,13 +5155,13 @@ The global position, as returned by the Global Positioning System system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. - time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. (uint64_t) + time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. (uint64_t) fix_type : GPS fix type. (uint8_t) lat : Latitude (WGS84, EGM96 ellipsoid) (int32_t) lon : Longitude (WGS84, EGM96 ellipsoid) (int32_t) alt : Altitude (MSL). Positive for up. Note that virtually all GPS modules provide the MSL altitude in addition to the WGS84 altitude. (int32_t) - eph : GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) - epv : GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX (uint16_t) + eph : GPS HDOP horizontal dilution of position (unitless * 100). If unknown, set to: UINT16_MAX (uint16_t) + epv : GPS VDOP vertical dilution of position (unitless * 100). If unknown, set to: UINT16_MAX (uint16_t) vel : GPS ground speed. 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) @@ -4317,7 +5260,7 @@ The RAW IMU readings for a 9DOF sensor, which is identified by the id (default IMU1). This message should always contain the true raw values without any scaling to allow data capture and system debugging. - time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. (uint64_t) + time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. (uint64_t) xacc : X acceleration (raw) (int16_t) yacc : Y acceleration (raw) (int16_t) zacc : Z acceleration (raw) (int16_t) @@ -4353,7 +5296,7 @@ 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 (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. (uint64_t) + time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. (uint64_t) press_abs : Absolute pressure (raw) (int16_t) press_diff1 : Differential pressure 1 (raw, 0 if nonexistent) (int16_t) press_diff2 : Differential pressure 2 (raw, 0 if nonexistent) (int16_t) @@ -4387,7 +5330,7 @@ field. time_boot_ms : Timestamp (time since system boot). (uint32_t) press_abs : Absolute pressure (float) press_diff : Differential pressure 1 (float) - temperature : Temperature (int16_t) + temperature : Absolute pressure temperature (int16_t) */ mavlink10.messages.scaled_pressure = function(time_boot_ms, press_abs, press_diff, temperature) { @@ -4624,7 +5567,7 @@ 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 (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number. (uint32_t) + time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. (uint32_t) port : Servo output port (set of 8 outputs = 1 port). Flight stacks running on Pixhawk should use: 0 = MAIN, 1 = AUX. (uint8_t) servo1_raw : Servo output 1 value (uint16_t) servo2_raw : Servo output 2 value (uint16_t) @@ -4721,7 +5664,9 @@ 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 +(NED), global frame is Z-up, right handed (ENU). NaN may be used to +indicate an optional/default value (e.g. to use the system's current +latitude or yaw rather than a specific value). See also https://mavlink.io/en/services/mission.html. target_system : System ID (uint8_t) @@ -5106,6 +6051,36 @@ mavlink10.messages.mission_request_int.prototype.pack = function(mav) { return mavlink10.message.prototype.pack.call(this, mav, this.crc_extra, jspack.Pack(this.format, [ this.seq, this.target_system, this.target_component])); } +/* +A broadcast message to notify any ground station or SDK if a mission, +geofence or safe points have changed on the vehicle. + + start_index : Start index for partial mission change (-1 for all items). (int16_t) + end_index : End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1. (int16_t) + origin_sysid : System ID of the author of the new mission. (uint8_t) + origin_compid : Compnent ID of the author of the new mission. (uint8_t) + mission_type : Mission type. (uint8_t) + +*/ +mavlink10.messages.mission_changed = function(start_index, end_index, origin_sysid, origin_compid, mission_type) { + + this.format = ' MAV. Also used to +return a point from MAV -> GCS. + + target_system : System ID. (uint8_t) + target_component : Component ID. (uint8_t) + idx : Point index (first point is 1, 0 is for return point). (uint8_t) + count : Total number of points (for sanity checking). (uint8_t) + lat : Latitude of point. (float) + lng : Longitude of point. (float) + +*/ +mavlink20.messages.fence_point = function(target_system, target_component, idx, count, lat, lng) { + + this.format = ' MAV. Also used to +return a point from MAV -> GCS. + + target_system : System ID. (uint8_t) + target_component : Component ID. (uint8_t) + idx : Point index (first point is 0). (uint8_t) + count : Total number of points (for sanity checking). (uint8_t) + lat : Latitude of point. (int32_t) + lng : Longitude of point. (int32_t) + alt : Transit / loiter altitude relative to home. (int16_t) + break_alt : Break altitude relative to home. (int16_t) + land_dir : Heading to aim for when landing. (uint16_t) + flags : Configuration flags. (uint8_t) + +*/ +mavlink20.messages.rally_point = function(target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags) { + + this.format = ' MAV. Also used to -return a point from MAV -> GCS. +Request to control this MAV - target_system : System ID. (uint8_t) - target_component : Component ID. (uint8_t) - idx : Point index (first point is 1, 0 is for return point). (uint8_t) - count : Total number of points (for sanity checking). (uint8_t) - lat : Latitude of point. (float) - lng : Longitude of point. (float) + 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) */ -mavlink20.messages.fence_point = function(target_system, target_component, idx, count, lat, lng) { +mavlink20.messages.change_operator_control = function(target_system, control_request, version, passkey) { - this.format = ' 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 https://mavlink.io/en/services/parameter.html for +a full documentation of QGroundControl and IMU code. - limits_state : State of AP_Limits. (uint8_t) - last_trigger : Time (since boot) of last breach. (uint32_t) - last_action : Time (since boot) of last recovery action. (uint32_t) - last_recovery : Time (since boot) of last successful recovery. (uint32_t) - last_clear : Time (since boot) of last all-clear. (uint32_t) - breach_count : Number of fence breaches. (uint16_t) - mods_enabled : AP_Limit_Module bitfield of enabled modules. (uint8_t) - mods_required : AP_Limit_Module bitfield of required modules. (uint8_t) - mods_triggered : AP_Limit_Module bitfield of triggered modules. (uint8_t) + 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) */ -mavlink20.messages.limits_status = function(limits_state, last_trigger, last_action, last_recovery, last_clear, breach_count, mods_enabled, mods_required, mods_triggered) { +mavlink20.messages.param_request_read = function(target_system, target_component, param_id, param_index) { - this.format = ' MAV. Also used to -return a point from MAV -> GCS. +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. - target_system : System ID. (uint8_t) - target_component : Component ID. (uint8_t) - idx : Point index (first point is 0). (uint8_t) - count : Total number of points (for sanity checking). (uint8_t) - lat : Latitude of point. (int32_t) - lng : Longitude of point. (int32_t) - alt : Transit / loiter altitude relative to home. (int16_t) - break_alt : Break altitude relative to home. (int16_t) - land_dir : Heading to aim for when landing. (uint16_t) - flags : Configuration flags. (uint8_t) + time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number. (uint64_t) + press_abs : Absolute pressure (raw) (int16_t) + press_diff1 : Differential pressure 1 (raw, 0 if nonexistent) (int16_t) + press_diff2 : Differential pressure 2 (raw, 0 if nonexistent) (int16_t) + temperature : Raw Temperature measurement (raw) (int16_t) */ -mavlink20.messages.rally_point = function(target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags) { +mavlink20.messages.raw_pressure = function(time_usec, press_abs, press_diff1, press_diff2, temperature) { - this.format = ' 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 https://mavlink.io/en/services/parameter.html for -a full documentation of QGroundControl and IMU code. +Sets a desired vehicle position in a local north-east-down coordinate +frame. Used by an external controller to command the vehicle (manual +controller or other system). + time_boot_ms : Timestamp (time since system boot). (uint32_t) 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) + 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 : Bitmap to indicate which dimensions should be ignored by the vehicle. (uint16_t) + x : X Position in NED frame (float) + y : Y Position in NED frame (float) + z : Z Position in NED frame (note, altitude is negative in NED) (float) + vx : X velocity in NED frame (float) + vy : Y velocity in NED frame (float) + vz : Z velocity in NED frame (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 (float) + yaw_rate : yaw rate setpoint (float) */ -mavlink20.messages.param_request_read = function(target_system, target_component, param_id, param_index) { +mavlink20.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 = ' 0 indicates the interval at which it is sent. (int32_t) */ -mavlink20.messages.file_transfer_protocol = function(target_network, target_system, target_component, payload) { +mavlink20.messages.message_interval = function(message_id, interval_us) { - this.format = ' 0 indicates the interval at which it is sent. (int32_t) + param_id : 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 : Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise) (char) + param_type : Parameter type. (uint8_t) + param_result : Result code. (uint8_t) */ -mavlink20.messages.message_interval = function(message_id, interval_us) { +mavlink20.messages.param_ext_ack = function(param_id, param_value, param_type, param_result) { - this.format = '> 8) ^ (tmp << 8) ^ (tmp << 3) ^ (tmp >> 4); + crcOUT = crcOUT & 0xffff; + }); + return crcOUT; + +} + +mavlink20.WIRE_PROTOCOL_VERSION = "2.0"; +mavlink20.HEADER_LEN = 10; + +mavlink20.MAVLINK_TYPE_CHAR = 0 +mavlink20.MAVLINK_TYPE_UINT8_T = 1 +mavlink20.MAVLINK_TYPE_INT8_T = 2 +mavlink20.MAVLINK_TYPE_UINT16_T = 3 +mavlink20.MAVLINK_TYPE_INT16_T = 4 +mavlink20.MAVLINK_TYPE_UINT32_T = 5 +mavlink20.MAVLINK_TYPE_INT32_T = 6 +mavlink20.MAVLINK_TYPE_UINT64_T = 7 +mavlink20.MAVLINK_TYPE_INT64_T = 8 +mavlink20.MAVLINK_TYPE_FLOAT = 9 +mavlink20.MAVLINK_TYPE_DOUBLE = 10 + +mavlink20.MAVLINK_IFLAG_SIGNED = 0x01 + +// Mavlink headers incorporate sequence, source system (platform) and source component. +mavlink20.header = function(msgId, mlen, seq, srcSystem, srcComponent, incompat_flags=0, compat_flags=0,) { + + 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 + this.incompat_flags = incompat_flags + this.compat_flags = compat_flags + +} +mavlink20.header.prototype.pack = function() { + return jspack.Pack('BBBBBBBHB', [253, this.mlen, this.incompat_flags, this.compat_flags, this.seq, this.srcSystem, this.srcComponent, ((this.msgId & 0xFF) << 8) | ((this.msgId >> 8) & 0xFF), this.msgId>>16]); +} + +// Base class declaration: mavlink.message will be the parent class for each +// concrete implementation in mavlink.messages. +mavlink20.message = function() {}; + +// Convenience setter to facilitate turning the unpacked array of data into member properties +mavlink20.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. +mavlink20.message.prototype.pack = function(mav, crc_extra, payload) { + + this.payload = payload; + var plen = this.payload.length; + //in MAVLink2 we can strip trailing zeros off payloads. This allows for simple + // variable length arrays and smaller packets + while (plen > 1 && this.payload[plen-1] == 0) { + plen = plen - 1; + } + this.payload = this.payload.slice(0, plen); + var incompat_flags = 0; + this.header = new mavlink20.header(this.id, this.payload.length, mav.seq, mav.srcSystem, mav.srcComponent, incompat_flags, 0,); + this.msgbuf = this.header.pack().concat(this.payload); + var crc = mavlink20.x25Crc(this.msgbuf.slice(1)); + + // For now, assume always using crc_extra = True. TODO: check/fix this. + crc = mavlink20.x25Crc([crc_extra], crc); + this.msgbuf = this.msgbuf.concat(jspack.Pack(' MAV. Also used to +return a point from MAV -> GCS. + + target_system : System ID. (uint8_t) + target_component : Component ID. (uint8_t) + idx : Point index (first point is 1, 0 is for return point). (uint8_t) + count : Total number of points (for sanity checking). (uint8_t) + lat : Latitude of point. (float) + lng : Longitude of point. (float) + +*/ +mavlink20.messages.fence_point = function(target_system, target_component, idx, count, lat, lng) { + + this.format = ' MAV. Also used to +return a point from MAV -> GCS. + + target_system : System ID. (uint8_t) + target_component : Component ID. (uint8_t) + idx : Point index (first point is 0). (uint8_t) + count : Total number of points (for sanity checking). (uint8_t) + lat : Latitude of point. (int32_t) + lng : Longitude of point. (int32_t) + alt : Transit / loiter altitude relative to home. (int16_t) + break_alt : Break altitude relative to home. (int16_t) + land_dir : Heading to aim for when landing. (uint16_t) + flags : Configuration flags. (uint8_t) + +*/ +mavlink20.messages.rally_point = function(target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags) { + + this.format = ' 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 https://mavlink.io/en/services/parameter.html 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) + +*/ +mavlink20.messages.param_request_read = function(target_system, target_component, param_id, param_index) { + + this.format = ' 0 indicates the interval at which it is sent. (int32_t) + +*/ +mavlink20.messages.message_interval = function(message_id, interval_us) { + + this.format = '= 1 && this.buf[0] != this.protocol_marker ) { + + // 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 = mavlink20.HEADER_LEN; + + // 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] == this.protocol_marker ) { + // this.have_prefix_error = false; + //} + +} + +// Determine the length. Leaves buffer untouched. +MAVLink20Processor.prototype.parseLength = function() { + + if( this.buf.length >= 2 ) { + var unpacked = jspack.Unpack('BB', this.buf.slice(0, 2)); + this.expected_length = unpacked[1] + mavlink20.HEADER_LEN + 2 // length of message + header + CRC + } + +} + +// input some data bytes, possibly returning a new message +MAVLink20Processor.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 mavlink20.messages.bad_data(this.bufInError, e.message); + this.bufInError = new Buffer.from([]); + + } + + if(null != m) { + this.emit(m.name, m); + this.emit('message', m); + } + + return m; + +} + +MAVLink20Processor.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 +MAVLink20Processor.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); + } + +} + +/* decode a buffer as a MAVLink message */ +MAVLink20Processor.prototype.decode = function(msgbuf) { + + var magic, incompat_flags, compat_flags, mlen, seq, srcSystem, srcComponent, unpacked, msgId; + + // decode the header + try { + unpacked = jspack.Unpack('cBBBBBBHB', msgbuf.slice(0, 10)); + magic = unpacked[0]; + mlen = unpacked[1]; + incompat_flags = unpacked[2]; + compat_flags = unpacked[3]; + seq = unpacked[4]; + srcSystem = unpacked[5]; + srcComponent = unpacked[6]; + var msgIDlow = ((unpacked[7] & 0xFF) << 8) | ((unpacked[7] >> 8) & 0xFF); + var msgIDhigh = unpacked[8]; + msgId = msgIDlow | (msgIDhigh<<16); + } + catch(e) { + throw new Error('Unable to unpack MAVLink header: ' + e.message); + } + + if (magic.charCodeAt(0) != this.protocol_marker) { + throw new Error("Invalid MAVLink prefix ("+magic.charCodeAt(0)+")"); + } + + if( mlen != msgbuf.length - (mavlink20.HEADER_LEN + 2)) { + throw new Error("Invalid MAVLink message length. Got " + (msgbuf.length - (mavlink20.HEADER_LEN + 2)) + " expected " + mlen + ", msgId=" + msgId); + } + + if( false === _.has(mavlink20.map, msgId) ) { + throw new Error("Unknown MAVLink message ID (" + msgId + ")"); + } + + // decode the payload + // refs: (fmt, type, order_map, crc_extra) = mavlink20.map[msgId] + var decoder = mavlink20.map[msgId]; + + // decode the checksum + try { + var receivedChecksum = jspack.Unpack(' payload.length) { + payload = Buffer.concat([payload, Buffer.alloc(paylen - payload.length)]); + } + // Decode the payload and reorder the fields to match the order map. + try { + var t = jspack.Unpack(decoder.format, payload); + } + catch (e) { + throw new Error('Unable to unpack MAVLink payload type='+decoder.type+' format='+decoder.format+' payloadLength='+ payload +': '+ 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 = payload + m.crc = receivedChecksum; + m.header = new mavlink20.header(msgId, mlen, seq, srcSystem, srcComponent, incompat_flags, compat_flags); + this.log(m); + return m; +} + + +// Expose this code as a module +module.exports = {mavlink20, MAVLink20Processor}; + diff --git a/mavudp_to_ws_server.js b/mavudp_to_ws_server.js index feb632f..09e53da 100644 --- a/mavudp_to_ws_server.js +++ b/mavudp_to_ws_server.js @@ -140,19 +140,19 @@ const udpserver = dgram.createSocket('udp4'); // after INCOMiNG MAVLINK goes thru the mavlink parser in the browser, it dispatches them to here where we save the source ip/port for each sysid var mavlink_ip_and_port_handler = function(message,ip,port,mavlinktype) { - if (typeof message.header == 'undefined'){ - console.log('message.header UNDEFINED, skipping packet:'); + if (typeof message._header == 'undefined'){ + console.log('message._header UNDEFINED, skipping packet:'); console.log(message); return; } // it's been parsed, and must be a valid mavlink packet, and thus must have a sysid available now.. - if ( sysid_to_ip_address[message.header.srcSystem] == null ) { - console.log(`Got first PARSED MSG from sysid:${message.header.srcSystem} src:${ip}:${port}, mav-proto:${mavlinktype}. Not repeating this. `); + if ( sysid_to_ip_address[message._header.srcSystem] == null ) { + console.log(`Got first PARSED MSG from sysid:${message._header.srcSystem} src:${ip}:${port}, mav-proto:${mavlinktype}. Not repeating this. `); } // by having this inside the above if() the source port and ip can't change without a page reload, having it below, it keeps uptodate. - sysid_to_ip_address[message.header.srcSystem] = {'ip':ip, 'port':port}; - sysid_to_mavlink_type[message.header.srcSystem] = mavlinktype; // 1 or 2 + sysid_to_ip_address[message._header.srcSystem] = {'ip':ip, 'port':port}; + sysid_to_mavlink_type[message._header.srcSystem] = mavlinktype; // 1 or 2 } @@ -215,12 +215,12 @@ var generic_message_handler = function(message) { 'NAV_CONTROLLER_OUTPUT', 'STATUSTEXT' , 'COMMAND_ACK' , 'MISSION_ITEM', 'MISSION_ITEM_INT','MISSION_COUNT','MISSION_REQUEST', 'MISSION_ACK', 'AIRSPEED_AUTOCAL', 'MISSION_ITEM_REACHED' , 'STAT_FLTTIME' ,'AUTOPILOT_VERSION' , - 'FENCE_STATUS' , 'AOA_SSA' , 'GPS_GLOBAL_ORIGIN', ].includes(message.name) ) { + 'FENCE_STATUS' , 'AOA_SSA' , 'GPS_GLOBAL_ORIGIN', ].includes(message._name) ) { console.log(message); } // log PARAM_VALUE differently to exclude common ones like where param_id starts with 'STAT_RUNTIME' etc - if ( ['PARAM_VALUE' ].includes(message.name) ) { + if ( ['PARAM_VALUE' ].includes(message._name) ) { if ( message.param_id.startsWith('STAT_RUNTIME') || message.param_id.startsWith('STAT_FLTTIME') || message.param_id.startsWith('COMPASS_') || @@ -233,39 +233,39 @@ var generic_message_handler = function(message) { } // display STATUSTEXT as simple console.log - if ( ['STATUSTEXT' ].includes(message.name) ) { + if ( ['STATUSTEXT' ].includes(message._name) ) { //console.log(`STATUSTEXT: ${message.text}`); } - if ( ['COMMAND_ACK' ].includes(message.name) ) { + if ( ['COMMAND_ACK' ].includes(message._name) ) { console.log(`COMMAND_ACK command= ${message.command} result= ${message.result} `); } - if ( ['MISSION_ITEM' ].includes(message.name) ) { + if ( ['MISSION_ITEM' ].includes(message._name) ) { // console.log(`MISSION_ITEM command= ${message.command} x= ${message.x} y= ${message.y} z= ${message.z} `); } - if ( ['MISSION_ITEM_INT' ].includes(message.name) ) { + if ( ['MISSION_ITEM_INT' ].includes(message._name) ) { console.log(`MISSION_ITEM_INT seq= ${message.seq} command= ${message.command} x= ${message.x} y= ${message.y} z= ${message.z} `); //console.log(message); } - if ( ['MISSION_COUNT' ].includes(message.name) ) { + if ( ['MISSION_COUNT' ].includes(message._name) ) { // console.log(`MISSION_COUNT number of mission items:= ${message.count} `); moved to mavMission.js } - if ( ['MISSION_ACK' ].includes(message.name) ) { + if ( ['MISSION_ACK' ].includes(message._name) ) { console.log(`MISSION_ACK recieved `); } - if ( ['MISSION_ITEM_REACHED' ].includes(message.name) ) { + if ( ['MISSION_ITEM_REACHED' ].includes(message._name) ) { console.log(`MISSION_ITEM_REACHED recieved num:= ${message.seq} `); } - if ( ['PARAM_VALUE' ].includes(message.name) && message.param_id.startsWith('STAT_FLTTIME')){ + if ( ['PARAM_VALUE' ].includes(message._name) && message.param_id.startsWith('STAT_FLTTIME')){ mins = parseInt(message.param_value/60,10); secs = parseInt(message.param_value%60,10); console.log(`TIME IN AIR: ${mins}min:${secs}secs `); @@ -411,7 +411,7 @@ In simple terms, it adds properties from other objects (source) on to a target o // these change/s are vehicle specific events, and so are bound to a specific vehicle in the collection, not the whole collection. -// We pull the Vehicle from the Collection by its sysid "current_vehicle = AllVehicles.get(message.header.srcSystem); " +// We pull the Vehicle from the Collection by its sysid "current_vehicle = AllVehicles.get(message._header.srcSystem); " //------------------------------------------------------------- @@ -428,8 +428,8 @@ In simple terms, it adds properties from other objects (source) on to a target o var heartbeat_handler = function(message) { //console.log(`Got a HEARTBEAT message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); //console.log(message); - //console.log(`got HEARTBEAT with ID: ${message.header.srcSystem}`); - var tmp_sysid = message.header.srcSystem; + //console.log(`got HEARTBEAT with ID: ${message._header.srcSystem}`); + var tmp_sysid = message._header.srcSystem; var current_vehicle = AllVehicles.get(tmp_sysid); // returns the entire vehicle object // if we already have the vehicle in the collection: if ( current_vehicle) { @@ -457,7 +457,7 @@ var heartbeat_handler = function(message) { //console.log("UPDATE:"+JSON.stringify(AllVehicles)); // we only CREATE new vehicle object/s when we successfully see a HEARTBEAT from them: } else { - var tmpVehicle = new VehicleClass({id:message.header.srcSystem}); + var tmpVehicle = new VehicleClass({id:message._header.srcSystem}); // put the modified temporary object back onto the collection AllVehicles.add(tmpVehicle, {merge: true}); // 'add' can do "update" when merge=true, in case theres 2 of them somehow. //console.log("ADD:"+JSON.stringify(AllVehicles)); @@ -500,7 +500,7 @@ mavlinkParser2.on('HEARTBEAT', heartbeat_handler); var gpi_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { //console.log(`Got a GLOBAL_POSITION_INT message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); @@ -530,7 +530,7 @@ mavlinkParser2.on('GLOBAL_POSITION_INT', gpi_handler); var sysstatus_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { //console.log(`Got a SYS_STATUS message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); @@ -557,7 +557,7 @@ mavlinkParser2.on('SYS_STATUS', sysstatus_handler); // there are specific status-text messages that help us know if we really are armed/disarmed , and the rest are sent as 'message' for the web-console. var statustext_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { @@ -575,7 +575,7 @@ var statustext_handler = function(message) { } // everything else is just pushed into the 'messages' display box by this event... - io.of(IONameSpace).emit('status_text', { "sysid": message.header.srcSystem, "text": _message}); + io.of(IONameSpace).emit('status_text', { "sysid": message._header.srcSystem, "text": _message}); //io.of(IONameSpace).emit('message', { "sysid": current_vehicle.get('id'), "message": _message}); } } @@ -584,7 +584,7 @@ mavlinkParser2.on('STATUSTEXT', statustext_handler); var att_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { //console.log(`Got a ATTITUDE message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); @@ -611,7 +611,7 @@ mavlinkParser2.on('ATTITUDE', att_handler); var vfrhud_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { //console.log(`Got a VFR_HUD message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); @@ -638,7 +638,7 @@ mavlinkParser2.on('VFR_HUD', vfrhud_handler); var gpsrawint_handler = function(message) { - var current_vehicle = AllVehicles.get(message.header.srcSystem); + var current_vehicle = AllVehicles.get(message._header.srcSystem); // if we already have the vehicle in the collection: if ( current_vehicle) { //console.log(`Got a GPS_RAW_INT message from ${udpserver.last_ip_address.address}:${udpserver.last_ip_address.port} `); diff --git a/node_index.html b/node_index.html index 0fb431c..244337d 100644 --- a/node_index.html +++ b/node_index.html @@ -317,7 +317,7 @@
Pitch: degrees
-
+
Vehicle Type:
Yaw: degrees
diff --git a/static/img/copter.svg b/static/img/copter.svg new file mode 100644 index 0000000..8b0f38c --- /dev/null +++ b/static/img/copter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/img/copter_black.png b/static/img/copter_black.png new file mode 100644 index 0000000..4d9c588 Binary files /dev/null and b/static/img/copter_black.png differ diff --git a/static/img/copter_blue.png b/static/img/copter_blue.png new file mode 100644 index 0000000..362b05c Binary files /dev/null and b/static/img/copter_blue.png differ diff --git a/static/img/copter_green.png b/static/img/copter_green.png new file mode 100644 index 0000000..cf67f17 Binary files /dev/null and b/static/img/copter_green.png differ diff --git a/static/img/copter_indigo.png b/static/img/copter_indigo.png new file mode 100644 index 0000000..c5c07ea Binary files /dev/null and b/static/img/copter_indigo.png differ diff --git a/static/img/copter_orange.png b/static/img/copter_orange.png new file mode 100644 index 0000000..f6f4a0e Binary files /dev/null and b/static/img/copter_orange.png differ diff --git a/static/img/copter_purple.png b/static/img/copter_purple.png new file mode 100644 index 0000000..93a066e Binary files /dev/null and b/static/img/copter_purple.png differ diff --git a/static/img/copter_red.png b/static/img/copter_red.png new file mode 100644 index 0000000..7d30d06 Binary files /dev/null and b/static/img/copter_red.png differ diff --git a/static/img/copter_red_a.png b/static/img/copter_red_a.png new file mode 100644 index 0000000..b5f4b88 Binary files /dev/null and b/static/img/copter_red_a.png differ diff --git a/static/js/leaflet-stuff.js b/static/js/leaflet-stuff.js index b0c0335..f8e3bae 100644 --- a/static/js/leaflet-stuff.js +++ b/static/js/leaflet-stuff.js @@ -23,16 +23,29 @@ var myIcons = L.Icon.extend({ } }); -// build icon list -blackIcon = new myIcons({iconUrl: '/static/img/plane_black.png'}), -greenIcon = new myIcons({iconUrl: '/static/img/plane_green.png'}), +// build icon list for planes +blackIcon = new myIcons({iconUrl: '/static/img/plane_black.png'}), +greenIcon = new myIcons({iconUrl: '/static/img/plane_green.png'}), indigoIcon = new myIcons({iconUrl: '/static/img/plane_indigo.png'}), orangeIcon = new myIcons({iconUrl: '/static/img/plane_orange.png'}), -blueIcon = new myIcons({iconUrl: '/static/img/plane.png'}), +blueIcon = new myIcons({iconUrl: '/static/img/plane.png'}), purpleIcon = new myIcons({iconUrl: '/static/img/plane_purple.png'}), -redIcon = new myIcons({iconUrl: '/static/img/plane_red.png'}); +redIcon = new myIcons({iconUrl: '/static/img/plane_red.png'}); iconlist = []; + + +// and copters +blackIcon2 = new myIcons({iconUrl: '/static/img/copter_black.png'}), +greenIcon2 = new myIcons({iconUrl: '/static/img/copter_green.png'}), +indigoIcon2 = new myIcons({iconUrl: '/static/img/copter_indigo.png'}), +orangeIcon2 = new myIcons({iconUrl: '/static/img/copter_orange.png'}), +blueIcon2 = new myIcons({iconUrl: '/static/img/copter_blue.png'}), +purpleIcon2 = new myIcons({iconUrl: '/static/img/copter_purple.png'}), +redIcon2 = new myIcons({iconUrl: '/static/img/copter_red.png'}); +iconlist2 = []; + iconlist.push(redIcon,blackIcon,blueIcon,greenIcon,indigoIcon,orangeIcon,purpleIcon); // so sysid0 is red, sysid1 is black, sysid2 is blue etc +iconlist2.push(redIcon2,blackIcon2,blueIcon2,greenIcon2,indigoIcon2,orangeIcon2,purpleIcon2); // so sysid0 is red, sysid1 is black, sysid2 is blue et // redefine standard L.i to point to my L.I ( case important ) L.icon = function (options) { diff --git a/static/js/main.js b/static/js/main.js index cc8ce66..bb15a09 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -198,8 +198,10 @@ $(document).ready(function () { // we instead / ALSO returns the array-of-chars as an array of mavlink packets, possibly 'none', [ p] single packet , or [p,p,p] packets. // here's where we store the sorce ip and port with each packet we just made, AFTER the now-useless 'emit' which can't easily do this.. - for (msg of packetlist){ - mavlink_incoming_parser_message_handler(msg,message[1],message[2],mavlinktype ); // [1] = ip and [2] = port + if (packetlist ) { + for (msg of packetlist){ + mavlink_incoming_parser_message_handler(msg,message[1],message[2],mavlinktype ); // [1] = ip and [2] = port + } } }); @@ -267,7 +269,7 @@ $(document).ready(function () { // store data from packet states[message.sysid].cs.mode = message.mode; // states already has human-readable mode, so just display it. - states[message.sysid].cs.vehicle_type = message.vehicle_type; + states[message.sysid].cs.vehicle_type = message.type; // 'Copter' or 'Plane' // redraw current_vehicle that's onscreen document.getElementById('status_mode').innerText = states[current_vehicle].cs.mode; document.getElementById('floating-mode-text').innerText = states[current_vehicle].cs.mode; @@ -383,7 +385,7 @@ $(document).ready(function () { states[message.sysid].cs.altitude_agl = parseFloat(message.altitude_agl).toFixed(2); - // create an initial marker with very little going on, in a default place. + // create an initial marker or 2 with very little going on, in a default place. if (!( "planeMarker" in states[message.sysid] )){ x = message.sysid%7; // pick a color from the 7 avail states[message.sysid].planeMarker = L.marker(defaultMapLocation, { @@ -391,6 +393,13 @@ $(document).ready(function () { title: "id:"+message.sysid //minimal mouse-over to start with, updated later elsewhere }).addTo(leafletmap); } + if (!( "copterMarker" in states[message.sysid] )){ + x = message.sysid%7; // pick a color from the 7 avail + states[message.sysid].copterMarker = L.marker(defaultMapLocation, { + icon: iconlist2[x], rotationOrigin: "center center", + title: "id:"+message.sysid //minimal mouse-over to start with, updated later elsewhere + }).addTo(leafletmap); + } // create an empty polygon for the flightpath to be filled later.. if (!( "flightPath" in states[message.sysid] )){ states[message.sysid].flightPath = L.polyline([], {color: 'red'}).addTo(leafletmap); @@ -616,19 +625,36 @@ $(document).ready(function () { states[current_vehicle].locationHistory.pop(); } - // Set our rotation - states[current_vehicle].planeMarker.setRotationAngle(states[current_vehicle].cs.heading); - - // Set our location - states[current_vehicle].planeMarker.setLatLng(states[current_vehicle].cs.location); - - // update the little bubble of text on the on-mouse-over of the planemarker. - states[current_vehicle].planeMarker.options.title = - String(Math.round(states[current_vehicle].cs.altitude_agl))+"m | " - +String(Math.round(states[current_vehicle].cs.airspeed))+"m/s | id: "+current_vehicle; - // a remove-and-add is required to get the options.title to re-render the planemarker - states[current_vehicle].planeMarker.remove(); - states[current_vehicle].planeMarker.addTo(leafletmap); + if ( states[current_vehicle].cs.vehicle_type == "Plane") { + // Set our rotation + states[current_vehicle].planeMarker.setRotationAngle(states[current_vehicle].cs.heading); + // Set our location + states[current_vehicle].planeMarker.setLatLng(states[current_vehicle].cs.location); + // update the little bubble of text on the on-mouse-over of the planemarker. + states[current_vehicle].planeMarker.options.title = + String(Math.round(states[current_vehicle].cs.altitude_agl))+"m | " + +String(Math.round(states[current_vehicle].cs.airspeed))+"m/s | id: "+current_vehicle; + // a remove-and-add is required to get the options.title to re-render the planemarker + states[current_vehicle].planeMarker.remove(); + states[current_vehicle].planeMarker.addTo(leafletmap); + // if the current vehicle type has changed from plane to copter etc, remove the other marker too + states[current_vehicle].copterMarker.remove(); + } + if ( states[current_vehicle].cs.vehicle_type == "Copter") { + // Set our rotation + states[current_vehicle].copterMarker.setRotationAngle(states[current_vehicle].cs.heading); + // Set our location + states[current_vehicle].copterMarker.setLatLng(states[current_vehicle].cs.location); + // update the little bubble of text on the on-mouse-over of the planemarker. + states[current_vehicle].copterMarker.options.title = + String(Math.round(states[current_vehicle].cs.altitude_agl))+"m | " + +String(Math.round(states[current_vehicle].cs.airspeed))+"m/s | id: "+current_vehicle; + // a remove-and-add is required to get the options.title to re-render the planemarker + states[current_vehicle].copterMarker.remove(); + states[current_vehicle].copterMarker.addTo(leafletmap); + // if the current vehicle type has changed from plane to copter etc, remove the other marker too + states[current_vehicle].planeMarker.remove(); + } // which plane is the center of our focus etc? initial_sysid = document.getElementById("update_connection_settings_sysid").value; @@ -675,6 +701,7 @@ $(document).ready(function () { document.getElementById('status_roll').innerText = String(states[current_vehicle].cs.attitude.roll); document.getElementById('status_yaw').innerText = String(states[current_vehicle].cs.attitude.yaw); document.getElementById('status_ap_type').innerText = String(states[current_vehicle].cs.ap_type); + document.getElementById('status_veh_type').innerText = String(states[current_vehicle].cs.vehicle_type); } setTimeout(updateStatusTab, 500); diff --git a/static/js/mav-stuff.js b/static/js/mav-stuff.js index fd21542..6f719c2 100644 --- a/static/js/mav-stuff.js +++ b/static/js/mav-stuff.js @@ -82,15 +82,17 @@ var mavlink_incoming_parser_message_handler = function(message,ip,port,mavlinkty if ( ! [ 'VFR_HUD','GPS_RAW_INT', 'ATTITUDE', 'SYS_STATUS', 'GLOBAL_POSITION_INT', 'HEARTBEAT','VIBRATION', 'BATTERY_STATUS', 'TERRAIN_REPORT', 'WIND', 'HWSTATUS', 'AHRS', 'AHRS2', 'AHRS3', 'SIMSTATE', 'RC_CHANNELS','RC_CHANNELS_RAW', 'SERVO_OUTPUT_RAW', 'LOCAL_POSITION_NED', - 'MEMINFO', 'POWER_STATUS', 'SCALED_PRESSURE', 'SCALED_IMU','SCALED_IMU2','SCALED_IMU3', 'RAW_IMU', + 'MEMINFO', 'POWER_STATUS', 'SCALED_PRESSURE', 'SCALED_PRESSURE2','SCALED_IMU','SCALED_IMU2','SCALED_IMU3', 'RAW_IMU', 'EKF_STATUS_REPORT', 'SYSTEM_TIME', 'MISSION_CURRENT' , 'SENSOR_OFFSETS', 'TIMESYNC', 'PARAM_VALUE', 'HOME_POSITION', 'POSITION_TARGET_GLOBAL_INT', 'NAV_CONTROLLER_OUTPUT', 'STATUSTEXT' , 'COMMAND_ACK' , 'MISSION_ITEM', 'MISSION_ITEM_INT','MISSION_COUNT','MISSION_REQUEST', 'MISSION_ACK', 'AIRSPEED_AUTOCAL', 'MISSION_ITEM_REACHED' , 'STAT_FLTTIME' ,'AUTOPILOT_VERSION' , - 'FENCE_STATUS' , 'AOA_SSA' , 'GPS_GLOBAL_ORIGIN', ].includes(message.name) ) { + 'FENCE_STATUS' , 'AOA_SSA' , 'GPS_GLOBAL_ORIGIN', 'SET_MODE', 'FILE_TRANSFER_PROTOCOL', + 'MISSION_REQUEST_INT' , 'MISSION_REQUEST_LIST', + 'PARAM_SET', ].includes(message.name) ) { - console.log("unhandled mavlink packet"+message); + console.log("unhandled mavlink packet"+JSON.stringify(message)); } @@ -171,8 +173,21 @@ var mavlink_incoming_parser_message_handler = function(message,ip,port,mavlinkty // this ensures the GUI render/s the current vehicle mode on-screen // arduplane uses heartbeatpacket.custom_mode to index into mode_mapping_apm - TODO copter uses acm - var _mode = mode_mapping_apm[message.custom_mode]; - var vehicle_type = 'Plane'; // todo handle non-plane things too. + var _mode = 'unknown-mode';// = mode_mapping_apm[message.custom_mode]; + var vehicle_type = 'unknown-type';// = 'Plane'; // todo handle non-plane things too. + + //copter or plane or something else? + if (message.type == mavlink20.MAV_TYPE_FIXED_WING ) { + // arduplane uses packet.custom_mode to index into mode_mapping_apm + _mode = mode_mapping_apm[message.custom_mode]; + vehicle_type = 'Plane'; + } + if (message.type == mavlink20.MAV_TYPE_QUADROTOR ) { + // arducopter uses packet.custom_mode to index into mode_mapping_acm + _mode = mode_mapping_acm[message.custom_mode]; + vehicle_type = 'Copter'; + } + //this matches the json format sent by the non-mavlink backend server/s: msghandler.emit('mode', { "sysid": message.header.srcSystem, "mode": _mode, diff --git a/update_mavlink.sh b/update_mavlink.sh new file mode 100755 index 0000000..5730d4d --- /dev/null +++ b/update_mavlink.sh @@ -0,0 +1 @@ +cp ~/GCS/mavlink/pymavlink/generator/javascript/implementations/mavlink_ardupilotmega_v2.0/mavlink.js ./mav_v2.js