├── .github └── workflows │ └── test_and_deploy.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── CONTRIBUTING.md ├── COPYING ├── README.md ├── cmake ├── .gitignore ├── WELCOME.txt ├── arkcmake │ ├── DefineCMakeDefaults.cmake │ ├── DefineCompilerFlags.cmake │ ├── ExternalProjectWithFilename.cmake │ ├── MacroCheckCCompilerFlagSSP.cmake │ ├── MacroEnsureOutOfSourceBuild.cmake │ └── updateArkcmake.py ├── mavlink.bmp └── mavlink.png ├── component_information ├── actuators.example.json ├── actuators.schema.json ├── general.schema.json ├── parameter.schema.json └── peripherals.schema.json ├── config.h.in ├── doc ├── Doxyfile ├── MAVLink2.md ├── README.md ├── mavlink.css ├── mavlink.php ├── mavlink_gitbook.py ├── mavlink_to_html_table.xsl └── mavlink_to_html_table_gitbook.xsl ├── examples └── linux │ ├── .gitignore │ ├── README.md │ └── mavlink_udp.c ├── mavgenerate.py ├── message_definitions └── v1.0 │ ├── ASLUAV.xml │ ├── AVSSUAS.xml │ ├── all.xml │ ├── ardupilotmega.xml │ ├── common.xml │ ├── csAirLink.xml │ ├── cubepilot.xml │ ├── development.xml │ ├── icarous.xml │ ├── loweheiser.xml │ ├── matrixpilot.xml │ ├── minimal.xml │ ├── paparazzi.xml │ ├── python_array_test.xml │ ├── standard.xml │ ├── storm32.xml │ ├── test.xml │ ├── uAvionix.xml │ └── ualberta.xml ├── pc.in └── scripts ├── format_xml.sh ├── test.sh ├── update_c_library.sh └── update_generated_repos.sh /.github/workflows/test_and_deploy.yml: -------------------------------------------------------------------------------- 1 | name: Test and deploy 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | # paths: 12 | # - "*" 13 | # - "!README.md" <-- don't rebuild on doc change 14 | 15 | jobs: 16 | format: 17 | name: Formatting check 18 | runs-on: ubuntu-22.04 19 | steps: 20 | - uses: actions/checkout@v2 21 | with: 22 | submodules: 'recursive' 23 | - run: | 24 | sudo apt update 25 | sudo apt install -y libxml2-dev libxml2-utils 26 | - name: Check formatting 27 | run: | 28 | ./scripts/test.sh format 29 | 30 | python-tests: 31 | name: Python ${{ matrix.python-version }} tests 32 | runs-on: ubuntu-22.04 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | python-version: [3.7, 3.8, 3.9, "3.10", 3.11] 37 | steps: 38 | - uses: actions/checkout@v2 39 | with: 40 | submodules: 'recursive' 41 | - name: Set up Python ${{ matrix.python-version }} 42 | uses: actions/setup-python@v2 43 | with: 44 | python-version: ${{ matrix.python-version }} 45 | - name: Install dependencies 46 | run: | 47 | pip install future lxml 48 | - name : Test Python generator 49 | run: | 50 | ./scripts/test.sh py 51 | 52 | node-tests: 53 | name: Node ${{ matrix.node-version }} test 54 | runs-on: ubuntu-22.04 55 | strategy: 56 | fail-fast: false 57 | matrix: 58 | node-version: ['12', '14'] # 15 fails for some weird reason 59 | steps: 60 | - uses: actions/checkout@v2 61 | with: 62 | submodules: 'recursive' 63 | - name: Set up Python 3.8 64 | uses: actions/setup-python@v2 65 | with: 66 | python-version: 3.8 67 | - name: Install dependencies 68 | run: | 69 | pip install future lxml 70 | - uses: actions/setup-node@v2 71 | with: 72 | node-version: ${{ matrix.node-version }} 73 | - run: npm install 74 | - name : Test mavlink 75 | run: | 76 | ./scripts/test.sh node 77 | 78 | deploy: 79 | name: Generate and push C headers 80 | needs: [format, python-tests, node-tests] 81 | runs-on: ubuntu-22.04 82 | if: github.ref == 'refs/heads/master' 83 | env: 84 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 85 | steps: 86 | - uses: actions/checkout@v2 87 | with: 88 | submodules: 'recursive' 89 | - name: Set up Python 3.8 90 | uses: actions/setup-python@v2 91 | with: 92 | python-version: 3.8 93 | - name: Install dependencies 94 | run: | 95 | pip install future lxml 96 | # - name: Run deploy script 97 | # run: | 98 | # ./scripts/update_generated_repos.sh 99 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | tags 3 | doc/html 4 | doc/messages 5 | doc/*.log 6 | .DS_Store 7 | build* 8 | .nfs* 9 | share/ 10 | __pycache__ 11 | pymavlink/generator/C/ 12 | pymavlink/generator/C/ 13 | pymavlink/generator/python/ 14 | pymavlink/generator/python/ 15 | apidocs/ 16 | pymavlink/generator/message_definitions 17 | *.swp 18 | pymavlink/dialects/ 19 | pymavlink/MANIFEST 20 | pymavlink/dist 21 | pymavlink.egg-info/ 22 | .pydevproject 23 | .project 24 | .ropeproject 25 | *.cproject 26 | include/ 27 | .tags* 28 | *.pyc 29 | include/mavlink/v1.0 30 | .idea 31 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pymavlink"] 2 | path = pymavlink 3 | url = https://github.com/ArduPilot/pymavlink.git 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (mavlink) 2 | 3 | if (NOT DEFINED MAVLINK_SOURCE_DIR) 4 | set(MAVLINK_SOURCE_DIR ${PROJECT_SOURCE_DIR}) 5 | endif () 6 | 7 | # settings 8 | cmake_minimum_required (VERSION 2.8.2) 9 | set(PROJECT_VERSION_MAJOR "1") 10 | set(PROJECT_VERSION_MINOR "0") 11 | set(PROJECT_VERSION_PATCH "9") 12 | set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") 13 | set(PROJECT_CONTACT_EMAIL http://groups.google.com/group/mavlink) 14 | set(PROJECT_CONTACT_VENDOR mavlink) 15 | set(LIBRARY_VERSION ${PROJECT_VERSION}) 16 | set(LIBRARY_SOVERSION "0.0.0") 17 | 18 | # third party 19 | # none required 20 | 21 | # options 22 | option(USE_SYSTEM_PYMAVLINK "Generate mavlink files with system-wide installed mavgen" OFF) 23 | option(WITH_TESTS "Build test programs." OFF) 24 | option(WITH_BUILD_DEPS "Build dependencies." OFF) # no deps currently to build 25 | option(WITH_BUILD_STATIC "Build preferring static linking." ON) 26 | 27 | # variables 28 | set(ROOT_THREAD TRUE CACHE INTERNAL "Is this the top level of the recursion?") 29 | 30 | # modules 31 | list(APPEND CMAKE_MODULE_PATH ${MAVLINK_SOURCE_DIR}/cmake ${MAVLINK_SOURCE_DIR}/cmake/arkcmake) 32 | include(DefineCMakeDefaults) 33 | include(CheckIncludeFiles) 34 | include(CheckFunctionExists) 35 | include(CheckSymbolExists) 36 | include(CheckLibraryExists) 37 | #include(CheckTypeSize) 38 | #include(CheckPrototypeExists) 39 | #include(CheckCXXSourceCompiles) 40 | #include(CheckCSourceCompiles) 41 | include(ExternalProjectWithFilename) 42 | 43 | if (UNIX) 44 | include(GNUInstallDirs) 45 | set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries") 46 | endif () 47 | 48 | 49 | # spawn new cmake to build deps 50 | if (WITH_BUILD_DEPS AND ROOT_THREAD) 51 | execute_process(COMMAND ${CMAKE_COMMAND} "${MAVLINK_SOURCE_DIR}" 52 | "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" 53 | "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" 54 | "-DWITH_BUILD_DEPS=${WITH_BUILD_DEPS}" 55 | "-DWITH_BUILD_STATIC=${WITH_BUILD_STATIC}" 56 | "-DWITH_TESTS=${WITH_TESTS}" 57 | "-DROOT_THREAD=FALSE" 58 | RESULT_VARIABLE ERROR) 59 | if (ERROR) 60 | message(FATAL_ERROR "error, recursing loop returned error code: ${ERROR}") 61 | endif() 62 | message("** Making dependencies") 63 | execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} "-j4" "-f${CMAKE_BINARY_DIR}/Makefile") 64 | message("** Configuring ${PROJECT_NAME}") 65 | endif() 66 | 67 | # external projects find path 68 | if(NOT EP_BASE_DIR) 69 | set(EP_BASE_DIR "${CMAKE_BINARY_DIR}/CMakeExternals") 70 | endif() 71 | set_property(DIRECTORY PROPERTY EP_BASE ${EP_BASE_DIR}) 72 | set(EP_INSTALL_DIR "${EP_BASE_DIR}/Install") 73 | list(APPEND CMAKE_FIND_ROOT_PATH ${EP_BASE_DIR}) 74 | 75 | # prefer static packages if building static library 76 | message("** Finding libraries") 77 | if (WITH_BUILD_STATIC) 78 | # prefer static libs 79 | if(WIN32) 80 | set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) 81 | else() 82 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) 83 | endif() 84 | endif() 85 | 86 | # find libraries with cmake modules 87 | if(${CMAKE_VERSION} VERSION_LESS 3.12) 88 | option(USE_PYTHON3 "Use python3 to build MAVLink" OFF) 89 | else() 90 | option(USE_PYTHON3 "Use python3 to build MAVLink" ON) 91 | endif() 92 | 93 | if(USE_PYTHON3) 94 | find_package(Python3 COMPONENTS Interpreter Development REQUIRED) 95 | set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) 96 | set(PYTHON_SITELIB ${Python3_SITELIB}) 97 | else() 98 | find_package(PythonInterp) 99 | set(PYTHON_SITELIB ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) 100 | endif() 101 | 102 | # enable languages 103 | if (WITH_TESTS) 104 | enable_language(C) 105 | enable_language(CXX) 106 | include(DefineCompilerFlags) 107 | endif() 108 | 109 | # build dependencies 110 | if (WITH_BUILD_DEPS AND (NOT ROOT_THREAD) ) 111 | message("** Configuring dependencies") 112 | 113 | # add external projects 114 | 115 | # none required currently 116 | 117 | set(CMAKE_DEFAULT_ARGS 118 | -DEP_BASE_DIR=${EP_BASE_DIR} 119 | -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} 120 | -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} 121 | ) 122 | 123 | # terminate non root cmake thread 124 | return() 125 | endif() 126 | 127 | # configure 128 | #check_include_files(string.h HAVE_STRING_H) 129 | #check_function_exists(memcopy HAVE_MEMCOPY) 130 | #check_symbol_exists(LC_MESSAGES "locale.h" HAVE_LC_MESSAGES) 131 | #check_library_exists(pthread attachNode "" HAVE_PTHREAD) 132 | 133 | # config files 134 | configure_file(config.h.in config.h) 135 | install(FILES ${CMAKE_BINARY_DIR}/config.h DESTINATION include/${PROJECT_NAME} COMPONENT Dev) 136 | 137 | # mavgen location for mavlink generation 138 | set(mavgen_EXECUTABLE_WITH_PYTHON_INVOCATION ${CMAKE_COMMAND} -E env "PYTHONPATH=$ENV{PYTHONPATH}:${CMAKE_CURRENT_SOURCE_DIR}" ${PYTHON_EXECUTABLE} -m pymavlink.tools.mavgen) 139 | if(USE_SYSTEM_PYMAVLINK) 140 | find_program ( 141 | mavgen_EXECUTABLE 142 | NAMES mavgen mavgen.py 143 | ) 144 | 145 | # Fallback to Python invocation, if not found. 146 | if (mavgen_EXECUTABLE-NOTFOUND) 147 | set(mavgen_EXECUTABLE ${mavgen_EXECUTABLE_WITH_PYTHON_INVOCATION}) 148 | endif() 149 | else() 150 | set(mavgen_EXECUTABLE ${mavgen_EXECUTABLE_WITH_PYTHON_INVOCATION}) 151 | endif() 152 | message(STATUS "mavgen_EXECUTABLE: ${mavgen_EXECUTABLE}") 153 | 154 | macro(generateMavlink version definitions) 155 | foreach(definition ${definitions}) 156 | set(targetName ${definition}-v${version}) 157 | set(definitionAbsPath ${MAVLINK_SOURCE_DIR}/message_definitions/v1.0/${definition}) 158 | message(STATUS "processing: ${definitionAbsPath}") 159 | add_custom_command( 160 | OUTPUT ${targetName}-stamp 161 | COMMAND ${mavgen_EXECUTABLE} --lang=C 162 | --wire-protocol=${version} 163 | --output=include/v${version} 164 | ${definitionAbsPath} 165 | COMMAND touch ${targetName}-stamp 166 | ) 167 | add_custom_target(${targetName} ALL DEPENDS ${targetName}-stamp) 168 | endforeach() 169 | endmacro() 170 | 171 | # build 172 | set(v1.0Definitions 173 | ASLUAV.xml 174 | ardupilotmega.xml 175 | common.xml 176 | matrixpilot.xml 177 | minimal.xml 178 | paparazzi.xml 179 | python_array_test.xml 180 | test.xml 181 | ualberta.xml 182 | ) 183 | generateMavlink("1.0" "${v1.0Definitions}") 184 | generateMavlink("2.0" "${v1.0Definitions}") 185 | 186 | # testing 187 | if (BUILD_TEST) 188 | if (UNIX) 189 | include_directories(${CMAKE_BINARY_DIR}/include/v1.0/common) 190 | # TODO fix udp example 191 | #add_executable(mavlink_udp examples/linux/mavlink_udp.c) 192 | endif() 193 | endif() 194 | 195 | # install files 196 | install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/${PROJECT_NAME} COMPONENT Dev FILES_MATCHING PATTERN "*.h*") 197 | install(DIRECTORY ${CMAKE_BINARY_DIR}/src/ DESTINATION share/${PROJECT_NAME} COMPONENT Dev FILES_MATCHING PATTERN "*.c*") 198 | install(DIRECTORY ${MAVLINK_SOURCE_DIR}/share/${PROJECT_NAME} DESTINATION share COMPONENT Dev FILES_MATCHING PATTERN "*.c*") 199 | if (UNIX) 200 | install(DIRECTORY ${MAVLINK_SOURCE_DIR}/pymavlink DESTINATION ${PYTHON_SITELIB} COMPONENT Dev) 201 | else () 202 | install(DIRECTORY ${MAVLINK_SOURCE_DIR}/pymavlink DESTINATION "share/pyshared" COMPONENT Dev) 203 | endif () 204 | 205 | configure_file(pc.in ${PROJECT_NAME}.pc) 206 | install(FILES 207 | ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc 208 | DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT Dev 209 | ) 210 | 211 | ### packaging 212 | 213 | # apple bundle icon 214 | if (APPLE) 215 | # set how it shows up in Info.plist 216 | set(MACOSX_BUNDLE_ICON_FILE mavlink.icns) 217 | # set where in the bundle to put the icns file 218 | set_source_files_properties(cmake/mavlink.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 219 | # include the icns file in the target 220 | #list(APPEND MAVLINKGUI_SRCS cmake/mavlink.icns) 221 | endif() 222 | 223 | # set NSIS image 224 | if (WIN32) 225 | set(CPACK_PACKAGE_ICON "${MAVLINK_SOURCE_DIR}/cmake/mavlink.bmp") 226 | endif() 227 | 228 | # add file extensions and set resource files 229 | configure_file("COPYING" "COPYING.txt" COPYONLY) 230 | configure_file("README.md" "README.md" COPYONLY) 231 | set(CPACK_RESOURCE_FILE_LICENSE "${MAVLINK_SOURCE_DIR}/COPYING") 232 | set(CPACK_RESOURCE_FILE_README "${MAVLINK_SOURCE_DIR}/README.md") 233 | set(CPACK_PACKAGE_DESCRIPTION_FILE "${CPACK_RESOURCE_FILE_README}") 234 | set(CPACK_RESOURCE_FILE_WELCOME "${MAVLINK_SOURCE_DIR}/cmake/WELCOME.txt") 235 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mavlink message marshalling library") 236 | set(CPACK_PACKAGE_VENDOR ${PROJECT_CONTACT_VENDOR}) 237 | set(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT_EMAIL}") 238 | set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) 239 | set(CPACK_SET_DESTDIR TRUE) 240 | set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") 241 | set(CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE") 242 | include(CPack) 243 | 244 | 245 | # vim:sw=4:ts=4:expandtab 246 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to MAVLink 2 | 3 | See [Contributing](https://mavlink.io/en/contributing/contributing.html) (MAVLink Developer Guide). 4 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | This repository contains the generator for the MAVLink protocol. The generator itself is 2 | (L)GPL v3 licensed, while the generated code is subject to different licenses: 3 | 4 | 5 | ======================================================================================== 6 | 7 | Exception to the (L)GPL v.3: 8 | 9 | As an exception, if you use this Software to compile your source code and 10 | portions of this Software, including messages ("the generator output"), are embedded 11 | into the binary product as a result, you may redistribute such product and such 12 | product is hereby licensed under the following MIT license: 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of the generated software (the "Generated Software"), to deal 16 | in the Generated Software without restriction, including without limitation the 17 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Generated Software, and to permit persons to whom the Generated 19 | Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Generated Software. 23 | 24 | THE GENERATED SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 25 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE GENERATED SOFTWARE OR THE USE OR OTHER DEALINGS 30 | IN THE GENERATED SOFTWARE. 31 | 32 | ========================================================================================= 33 | 34 | 35 | 36 | GNU LESSER GENERAL PUBLIC LICENSE 37 | Version 3, 29 June 2007 38 | 39 | Copyright (C) 2007 Free Software Foundation, Inc. 40 | Everyone is permitted to copy and distribute verbatim copies 41 | of this license document, but changing it is not allowed. 42 | 43 | 44 | This version of the GNU Lesser General Public License incorporates 45 | the terms and conditions of version 3 of the GNU General Public 46 | License, supplemented by the additional permissions listed below. 47 | 48 | 0. Additional Definitions. 49 | 50 | As used herein, "this License" refers to version 3 of the GNU Lesser 51 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 52 | General Public License. 53 | 54 | "The Library" refers to a covered work governed by this License, 55 | other than an Application or a Combined Work as defined below. 56 | 57 | An "Application" is any work that makes use of an interface provided 58 | by the Library, but which is not otherwise based on the Library. 59 | Defining a subclass of a class defined by the Library is deemed a mode 60 | of using an interface provided by the Library. 61 | 62 | A "Combined Work" is a work produced by combining or linking an 63 | Application with the Library. The particular version of the Library 64 | with which the Combined Work was made is also called the "Linked 65 | Version". 66 | 67 | The "Minimal Corresponding Source" for a Combined Work means the 68 | Corresponding Source for the Combined Work, excluding any source code 69 | for portions of the Combined Work that, considered in isolation, are 70 | based on the Application, and not on the Linked Version. 71 | 72 | The "Corresponding Application Code" for a Combined Work means the 73 | object code and/or source code for the Application, including any data 74 | and utility programs needed for reproducing the Combined Work from the 75 | Application, but excluding the System Libraries of the Combined Work. 76 | 77 | 1. Exception to Section 3 of the GNU GPL. 78 | 79 | You may convey a covered work under sections 3 and 4 of this License 80 | without being bound by section 3 of the GNU GPL. 81 | 82 | 2. Conveying Modified Versions. 83 | 84 | If you modify a copy of the Library, and, in your modifications, a 85 | facility refers to a function or data to be supplied by an Application 86 | that uses the facility (other than as an argument passed when the 87 | facility is invoked), then you may convey a copy of the modified 88 | version: 89 | 90 | a) under this License, provided that you make a good faith effort to 91 | ensure that, in the event an Application does not supply the 92 | function or data, the facility still operates, and performs 93 | whatever part of its purpose remains meaningful, or 94 | 95 | b) under the GNU GPL, with none of the additional permissions of 96 | this License applicable to that copy. 97 | 98 | 3. Object Code Incorporating Material from Library Header Files. 99 | 100 | The object code form of an Application may incorporate material from 101 | a header file that is part of the Library. You may convey such object 102 | code under terms of your choice, provided that, if the incorporated 103 | material is not limited to numerical parameters, data structure 104 | layouts and accessors, or small macros, inline functions and templates 105 | (ten or fewer lines in length), you do both of the following: 106 | 107 | a) Give prominent notice with each copy of the object code that the 108 | Library is used in it and that the Library and its use are 109 | covered by this License. 110 | 111 | b) Accompany the object code with a copy of the GNU GPL and this license 112 | document. 113 | 114 | 4. Combined Works. 115 | 116 | You may convey a Combined Work under terms of your choice that, 117 | taken together, effectively do not restrict modification of the 118 | portions of the Library contained in the Combined Work and reverse 119 | engineering for debugging such modifications, if you also do each of 120 | the following: 121 | 122 | a) Give prominent notice with each copy of the Combined Work that 123 | the Library is used in it and that the Library and its use are 124 | covered by this License. 125 | 126 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 127 | document. 128 | 129 | c) For a Combined Work that displays copyright notices during 130 | execution, include the copyright notice for the Library among 131 | these notices, as well as a reference directing the user to the 132 | copies of the GNU GPL and this license document. 133 | 134 | d) Do one of the following: 135 | 136 | 0) Convey the Minimal Corresponding Source under the terms of this 137 | License, and the Corresponding Application Code in a form 138 | suitable for, and under terms that permit, the user to 139 | recombine or relink the Application with a modified version of 140 | the Linked Version to produce a modified Combined Work, in the 141 | manner specified by section 6 of the GNU GPL for conveying 142 | Corresponding Source. 143 | 144 | 1) Use a suitable shared library mechanism for linking with the 145 | Library. A suitable mechanism is one that (a) uses at run time 146 | a copy of the Library already present on the user's computer 147 | system, and (b) will operate properly with a modified version 148 | of the Library that is interface-compatible with the Linked 149 | Version. 150 | 151 | e) Provide Installation Information, but only if you would otherwise 152 | be required to provide such information under section 6 of the 153 | GNU GPL, and only to the extent that such information is 154 | necessary to install and execute a modified version of the 155 | Combined Work produced by recombining or relinking the 156 | Application with a modified version of the Linked Version. (If 157 | you use option 4d0, the Installation Information must accompany 158 | the Minimal Corresponding Source and Corresponding Application 159 | Code. If you use option 4d1, you must provide the Installation 160 | Information in the manner specified by section 6 of the GNU GPL 161 | for conveying Corresponding Source.) 162 | 163 | 5. Combined Libraries. 164 | 165 | You may place library facilities that are a work based on the 166 | Library side by side in a single library together with other library 167 | facilities that are not Applications and are not covered by this 168 | License, and convey such a combined library under terms of your 169 | choice, if you do both of the following: 170 | 171 | a) Accompany the combined library with a copy of the same work based 172 | on the Library, uncombined with any other library facilities, 173 | conveyed under the terms of this License. 174 | 175 | b) Give prominent notice with the combined library that part of it 176 | is a work based on the Library, and explaining where to find the 177 | accompanying uncombined form of the same work. 178 | 179 | 6. Revised Versions of the GNU Lesser General Public License. 180 | 181 | The Free Software Foundation may publish revised and/or new versions 182 | of the GNU Lesser General Public License from time to time. Such new 183 | versions will be similar in spirit to the present version, but may 184 | differ in detail to address new problems or concerns. 185 | 186 | Each version is given a distinguishing version number. If the 187 | Library as you received it specifies that a certain numbered version 188 | of the GNU Lesser General Public License "or any later version" 189 | applies to it, you have the option of following the terms and 190 | conditions either of that published version or of any later version 191 | published by the Free Software Foundation. If the Library as you 192 | received it does not specify a version number of the GNU Lesser 193 | General Public License, you may choose any version of the GNU Lesser 194 | General Public License ever published by the Free Software Foundation. 195 | 196 | If the Library as you received it specifies that a proxy can decide 197 | whether future versions of the GNU Lesser General Public License shall 198 | apply, that proxy's public statement of acceptance of any version is 199 | permanent authorization for you to choose that version for the 200 | Library. 201 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://github.com/ArduPilot/mavlink/workflows/Test%20and%20deploy/badge.svg)](https://github.com/ArduPilot/mavlink/actions?query=branch%3Amaster) 2 | 3 | ## MAVLink ## 4 | 5 | MAVLink -- Micro Air Vehicle Message Marshalling Library. 6 | 7 | MAVLink is a very lightweight, header-only message library for communication between drones and/or ground control stations. It consists primarily of message-set specifications for different systems ("dialects") defined in XML files, and Python tools that convert these into appropriate source code for [supported languages](https://mavlink.io/en/#supported_languages). There are additional Python scripts providing examples and utilities for working with MAVLink data. 8 | 9 | > **Tip** MAVLink is very well suited for applications with very limited communication bandwidth. Its reference implementation in C is highly optimized for resource-constrained systems with limited RAM and flash memory. It is field-proven and deployed in many products where it serves as interoperability interface between components of different manufacturers. 10 | 11 | Key Links: 12 | * Development Website: https://ardupilot.org/dev/ 13 | * Source: [Mavlink Generator](https://github.com/ArduPilot/pymavlink) 14 | * Discussion: [Discord Mavlink Channel](https://discord.com/channels/674039678562861068/728017546313466047) 15 | * Discussion: [Discord pymavlink Channel](https://discord.com/channels/674039678562861068/930641827592306718) 16 | * [Documentation/Website](https://mavlink.io/en/) (mavlink.io/en/) 17 | * [Discussion/Support](https://mavlink.io/en/#support) (Slack) 18 | * [Contributing](https://mavlink.io/en/contributing/contributing.html) 19 | 20 | ### License ### 21 | 22 | MAVLink is licensed under the terms of the Lesser General Public License (version 3) of the Free Software Foundation (LGPLv3). The C-language version of MAVLink is a header-only library which is generated as MIT-licensed code. MAVLink can therefore be used without limits in any closed-source application without publishing the source code of the closed-source application. 23 | 24 | See the *COPYING* file for more info. 25 | -------------------------------------------------------------------------------- /cmake/.gitignore: -------------------------------------------------------------------------------- 1 | # only keep relevant arkcmake files 2 | arkcmake/* 3 | !arkcmake/updateArkcmake.py 4 | !arkcmake/DefineCMakeDefaults.cmake 5 | !arkcmake/DefineCompilerFlags.cmake 6 | !arkcmake/MacroCheckCCompilerFlagSSP.cmake 7 | !arkcmake/MacroEnsureOutOfSourceBuild.cmake 8 | !arkcmake/ExternalProjectWithFilename.cmake 9 | -------------------------------------------------------------------------------- /cmake/WELCOME.txt: -------------------------------------------------------------------------------- 1 | Welcome to installation. This program will guide you through the installation of this software. 2 | -------------------------------------------------------------------------------- /cmake/arkcmake/DefineCMakeDefaults.cmake: -------------------------------------------------------------------------------- 1 | # Always include srcdir and builddir in include path 2 | # This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in 3 | # about every subdir 4 | # since cmake 2.4.0 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | 7 | # Put the include dirs which are in the source or build tree 8 | # before all other include dirs, so the headers in the sources 9 | # are prefered over the already installed ones 10 | # since cmake 2.4.1 11 | set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) 12 | 13 | # Use colored output 14 | # since cmake 2.4.0 15 | set(CMAKE_COLOR_MAKEFILE ON) 16 | 17 | # Define the generic version of the libraries here 18 | set(GENERIC_LIB_VERSION "0.1.0") 19 | set(GENERIC_LIB_SOVERSION "0") 20 | 21 | # Set the default build type to release with debug info 22 | if (NOT CMAKE_BUILD_TYPE) 23 | set(CMAKE_BUILD_TYPE RelWithDebInfo 24 | CACHE STRING 25 | "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." 26 | ) 27 | endif (NOT CMAKE_BUILD_TYPE) 28 | 29 | # disallow in-source build 30 | include(MacroEnsureOutOfSourceBuild) 31 | macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. 32 | Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.") 33 | -------------------------------------------------------------------------------- /cmake/arkcmake/DefineCompilerFlags.cmake: -------------------------------------------------------------------------------- 1 | # define system dependent compiler flags 2 | 3 | include(CheckCCompilerFlag) 4 | include(MacroCheckCCompilerFlagSSP) 5 | 6 | # 7 | # Define GNUCC compiler flags 8 | # 9 | if (${CMAKE_C_COMPILER_ID} MATCHES GNU) 10 | 11 | # add -Wconversion ? 12 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors") 13 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement") 14 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security") 15 | #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute") 16 | 17 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -pedantic-errors") 18 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow") 19 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security") 20 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-format-attribute") 21 | 22 | if (UNIX AND NOT WIN32) 23 | 24 | # with -fPIC 25 | check_c_compiler_flag("-fPIC" WITH_FPIC) 26 | if (WITH_FPIC) 27 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 28 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 29 | endif (WITH_FPIC) 30 | 31 | endif(UNIX AND NOT WIN32) 32 | 33 | check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR) 34 | if (WITH_STACK_PROTECTOR) 35 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector") 36 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") 37 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fstack-protector") 38 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKDER_FLAGS} -fstack-protector") 39 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKDER_FLAGS} -fstack-protector") 40 | endif (WITH_STACK_PROTECTOR) 41 | 42 | check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE) 43 | if (WITH_FORTIFY_SOURCE) 44 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2") 45 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") 46 | endif (WITH_FORTIFY_SOURCE) 47 | endif (${CMAKE_C_COMPILER_ID} MATCHES GNU) 48 | 49 | if (UNIX AND NOT WIN32) 50 | # 51 | # Check for large filesystem support 52 | # 53 | if (CMAKE_SIZEOF_VOID_P MATCHES "8") 54 | # with large file support 55 | execute_process( 56 | COMMAND 57 | getconf LFS64_CFLAGS 58 | OUTPUT_VARIABLE 59 | _lfs_CFLAGS 60 | ERROR_QUIET 61 | OUTPUT_STRIP_TRAILING_WHITESPACE 62 | ) 63 | else (CMAKE_SIZEOF_VOID_P MATCHES "8") 64 | # with large file support 65 | execute_process( 66 | COMMAND 67 | getconf LFS_CFLAGS 68 | OUTPUT_VARIABLE 69 | _lfs_CFLAGS 70 | ERROR_QUIET 71 | OUTPUT_STRIP_TRAILING_WHITESPACE 72 | ) 73 | endif (CMAKE_SIZEOF_VOID_P MATCHES "8") 74 | if (_lfs_CFLAGS) 75 | string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}") 76 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_lfs_CFLAGS}") 77 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_lfs_CFLAGS}") 78 | endif (_lfs_CFLAGS) 79 | 80 | endif (UNIX AND NOT WIN32) 81 | 82 | if (MSVC) 83 | # Use secure functions by defaualt and suppress warnings about 84 | #"deprecated" functions 85 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1") 86 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1") 87 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1") 88 | set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") 89 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") 90 | endif (MSVC) 91 | -------------------------------------------------------------------------------- /cmake/arkcmake/MacroCheckCCompilerFlagSSP.cmake: -------------------------------------------------------------------------------- 1 | # - Check whether the C compiler supports a given flag in the 2 | # context of a stack checking compiler option. 3 | # CHECK_C_COMPILER_FLAG_SSP(FLAG VARIABLE) 4 | # 5 | # FLAG - the compiler flag 6 | # VARIABLE - variable to store the result 7 | # 8 | # This actually calls the check_c_source_compiles macro. 9 | # See help for CheckCSourceCompiles for a listing of variables 10 | # that can modify the build. 11 | 12 | # Copyright (c) 2006, Alexander Neundorf, 13 | # 14 | # Redistribution and use is allowed according to the terms of the BSD license. 15 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 16 | 17 | 18 | INCLUDE(CheckCSourceCompiles) 19 | 20 | MACRO (CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT) 21 | SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") 22 | SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") 23 | CHECK_C_SOURCE_COMPILES("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT}) 24 | SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") 25 | ENDMACRO (CHECK_C_COMPILER_FLAG_SSP) 26 | 27 | -------------------------------------------------------------------------------- /cmake/arkcmake/MacroEnsureOutOfSourceBuild.cmake: -------------------------------------------------------------------------------- 1 | # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD() 2 | # MACRO_ENSURE_OUT_OF_SOURCE_BUILD() 3 | 4 | # Copyright (c) 2006, Alexander Neundorf, 5 | # 6 | # Redistribution and use is allowed according to the terms of the BSD license. 7 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 8 | 9 | macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage) 10 | 11 | string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource) 12 | if (_insource) 13 | file(REMOVE [CMakeCache.txt CMakeFiles]) 14 | message(FATAL_ERROR "${_errorMessage}") 15 | endif (_insource) 16 | 17 | endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD) 18 | 19 | # vim:ts=4:sw=4:expandtab 20 | -------------------------------------------------------------------------------- /cmake/arkcmake/updateArkcmake.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Author: Lenna X. Peterson (github.com/lennax) 3 | # Based on bash script by James Goppert (github.com/jgoppert) 4 | # 5 | # script used to update cmake modules from git repo, can't make this 6 | # a submodule otherwise it won't know how to interpret the CMakeLists.txt 7 | # # # # # # subprocess# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 8 | 9 | import os # for os.path 10 | import subprocess # for check_call() 11 | 12 | clone_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 13 | print(clone_path) 14 | os.chdir(clone_path) 15 | subprocess.check_call(["git", "clone", "git://github.com/arktools/arkcmake.git","arkcmake_tmp"]) 16 | subprocess.check_call(["rm", "-rf", "arkcmake_tmp/.git"]) 17 | if os.path.isdir("arkcmake"): 18 | subprocess.check_call(["rm", "-rf", "arkcmake"]) 19 | subprocess.check_call(["mv", "arkcmake_tmp", "arkcmake"]) 20 | -------------------------------------------------------------------------------- /cmake/mavlink.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArduPilot/mavlink/3309f7658bddb0f8d048715f7b41a8a1676e575c/cmake/mavlink.bmp -------------------------------------------------------------------------------- /cmake/mavlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArduPilot/mavlink/3309f7658bddb0f8d048715f7b41a8a1676e575c/cmake/mavlink.png -------------------------------------------------------------------------------- /component_information/actuators.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "show-ui-if": "SYS_CTRL_ALLOC==1", 4 | "outputs_v1": [ 5 | { 6 | "label": "MAIN", 7 | "subgroups": [ 8 | { 9 | "label": "MAIN 1-4", 10 | "parameters": [ 11 | { 12 | "name": "PWM_MAIN_TIM0", 13 | "function": "primary" 14 | }, 15 | { 16 | "name": "FMU_TIM0_EXTRA", 17 | "label": "Extra group config" 18 | } 19 | ], 20 | "per-channel-parameters": [ 21 | { 22 | "label": "Function", 23 | "name": "PWM_MAIN_FUNC${i}", 24 | "function": "function" 25 | }, 26 | { 27 | "label": "Disarmed", 28 | "name": "PWM_MAIN_DIS${i}", 29 | "show-if": "PWM_MAIN_TIM0>=-1", 30 | "function": "disarmed", 31 | "advanced": true 32 | }, 33 | { 34 | "label": "Min", 35 | "name": "PWM_MAIN_MIN${i}", 36 | "show-if": "PWM_MAIN_TIM0>=-1" 37 | }, 38 | { 39 | "label": "Max", 40 | "name": "PWM_MAIN_MAX${i}", 41 | "show-if": "PWM_MAIN_TIM0>=-1" 42 | }, 43 | { 44 | "label": "Failsafe", 45 | "name": "PWM_MAIN_FAIL${i}", 46 | "show-if": "PWM_MAIN_TIM0>=-1" 47 | } 48 | ], 49 | "channels": [ 50 | { 51 | "label": "MAIN 1", 52 | "param-index": 1 53 | }, 54 | { 55 | "label": "MAIN 2", 56 | "param-index": 2 57 | }, 58 | { 59 | "label": "MAIN 3", 60 | "param-index": 3 61 | }, 62 | { 63 | "label": "MAIN 4", 64 | "param-index": 4 65 | } 66 | ] 67 | } 68 | ] 69 | }, 70 | { 71 | "label": "AUX", 72 | "parameters": [ 73 | { 74 | "label": "DShot Telemetry", 75 | "name": "DSHOT_TEL_CFG" 76 | }, 77 | { 78 | "label": "DShot Min", 79 | "name": "DSHOT_MIN" 80 | } 81 | ], 82 | "subgroups": [ 83 | { 84 | "label": "AUX 1-4", 85 | "supported-actions": { 86 | "set-spin-direction1": { 87 | "supported-if": "PWM_AUX_TIM0<-1", 88 | "actuator-types": ["motor"] 89 | }, 90 | "set-spin-direction2": { 91 | "supported-if": "PWM_AUX_TIM0<-1", 92 | "actuator-types": ["motor"] 93 | } 94 | }, 95 | "parameters": [ 96 | { 97 | "name": "PWM_AUX_TIM0", 98 | "function": "primary" 99 | } 100 | ], 101 | "per-channel-parameters": [ 102 | { 103 | "label": "Function", 104 | "name": "PWM_AUX_FUNC${i}", 105 | "function": "function" 106 | }, 107 | { 108 | "label": "Disarmed", 109 | "name": "PWM_AUX_DIS${i}", 110 | "show-if": "PWM_AUX_TIM0>=-1", 111 | "function": "disarmed", 112 | "advanced": true 113 | }, 114 | { 115 | "label": "Min", 116 | "name": "PWM_AUX_MIN${i}", 117 | "show-if": "PWM_AUX_TIM0>=-1" 118 | }, 119 | { 120 | "label": "Max", 121 | "name": "PWM_AUX_MAX${i}", 122 | "show-if": "PWM_AUX_TIM0>=-1" 123 | }, 124 | { 125 | "label": "Failsafe", 126 | "name": "PWM_AUX_FAIL${i}", 127 | "show-if": "PWM_AUX_TIM0>=-1" 128 | } 129 | ], 130 | "channels": [ 131 | { 132 | "label": "AUX 1", 133 | "param-index": 1 134 | }, 135 | { 136 | "label": "AUX 2", 137 | "param-index": 2 138 | }, 139 | { 140 | "label": "AUX 3", 141 | "param-index": 3 142 | }, 143 | { 144 | "label": "AUX 4", 145 | "param-index": 4 146 | } 147 | ] 148 | }, 149 | { 150 | "label": "AUX 5-6", 151 | "parameters": [ 152 | { 153 | "name": "PWM_AUX_TIM1", 154 | "function": "primary" 155 | } 156 | ], 157 | "per-channel-parameters": [ 158 | { 159 | "label": "Function", 160 | "name": "PWM_AUX_FUNC${i}", 161 | "function": "function" 162 | }, 163 | { 164 | "label": "Disarmed", 165 | "name": "PWM_AUX_DIS${i}", 166 | "show-if": "PWM_AUX_TIM1>=-1", 167 | "function": "disarmed", 168 | "advanced": true 169 | }, 170 | { 171 | "label": "Min", 172 | "name": "PWM_AUX_MIN${i}", 173 | "show-if": "PWM_AUX_TIM1>=-1" 174 | }, 175 | { 176 | "label": "Max", 177 | "name": "PWM_AUX_MAX${i}", 178 | "show-if": "PWM_AUX_TIM1>=-1" 179 | }, 180 | { 181 | "label": "Failsafe", 182 | "name": "PWM_AUX_FAIL${i}", 183 | "show-if": "PWM_AUX_TIM1>=-1" 184 | }, 185 | { 186 | "label": "Min", 187 | "name": "DSHOT_FMU_MIN${i}", 188 | "show-if": "PWM_AUX_TIM1<-1" 189 | } 190 | ], 191 | "channels": [ 192 | { 193 | "label": "AUX 5", 194 | "param-index": 5 195 | }, 196 | { 197 | "label": "AUX 6", 198 | "param-index": 6 199 | } 200 | ] 201 | }, 202 | { 203 | "label": "AUX 7-8", 204 | "parameters": [ 205 | { 206 | "name": "PWM_AUX_TIM2", 207 | "function": "primary" 208 | } 209 | ], 210 | "per-channel-parameters": [ 211 | { 212 | "label": "Function", 213 | "name": "PWM_AUX_FUNC${i}", 214 | "function": "function" 215 | }, 216 | { 217 | "label": "Disarmed", 218 | "name": "PWM_AUX_DIS${i}", 219 | "show-if": "PWM_AUX_TIM2>=-1", 220 | "function": "disarmed", 221 | "advanced": true 222 | }, 223 | { 224 | "label": "Min", 225 | "name": "PWM_AUX_MIN${i}", 226 | "show-if": "PWM_AUX_TIM2>=-1" 227 | }, 228 | { 229 | "label": "Max", 230 | "name": "PWM_AUX_MAX${i}", 231 | "show-if": "PWM_AUX_TIM2>=-1" 232 | }, 233 | { 234 | "label": "Failsafe", 235 | "name": "PWM_AUX_FAIL${i}", 236 | "show-if": "PWM_AUX_TIM2>=-1" 237 | }, 238 | { 239 | "label": "Min", 240 | "name": "DSHOT_FMU_MIN${i}", 241 | "show-if": "PWM_AUX_TIM2<-1" 242 | } 243 | ], 244 | "channels": [ 245 | { 246 | "label": "AUX 7", 247 | "param-index": 7 248 | }, 249 | { 250 | "label": "AUX 8", 251 | "param-index": 8 252 | } 253 | ] 254 | }, 255 | { 256 | "label": "CAP 1-3", 257 | "parameters": [ 258 | { 259 | "name": "PWM_AUX_TIM3", 260 | "function": "primary" 261 | } 262 | ], 263 | "per-channel-parameters": [ 264 | { 265 | "label": "Function", 266 | "name": "PWM_AUX_FUNC${i}", 267 | "function": "function" 268 | }, 269 | { 270 | "label": "Disarmed", 271 | "name": "PWM_AUX_DIS${i}", 272 | "show-if": "PWM_AUX_TIM2>=-1", 273 | "function": "disarmed", 274 | "advanced": true 275 | }, 276 | { 277 | "label": "Min", 278 | "name": "PWM_AUX_MIN${i}", 279 | "show-if": "PWM_AUX_TIM2>=-1" 280 | }, 281 | { 282 | "label": "Max", 283 | "name": "PWM_AUX_MAX${i}", 284 | "show-if": "PWM_AUX_TIM2>=-1" 285 | }, 286 | { 287 | "label": "Failsafe", 288 | "name": "PWM_AUX_FAIL${i}", 289 | "show-if": "PWM_AUX_TIM2>=-1" 290 | } 291 | ], 292 | "channels": [ 293 | { 294 | "label": "CAP 1", 295 | "param-index": 9 296 | }, 297 | { 298 | "label": "CAP 2", 299 | "param-index": 10 300 | }, 301 | { 302 | "label": "CAP 3", 303 | "param-index": 11 304 | } 305 | ] 306 | } 307 | ] 308 | }, 309 | { 310 | "label": "UAVCAN", 311 | "parameters": [ 312 | { 313 | "name": "UAVCAN_ENABLE", 314 | "label": "Configure", 315 | "function": "enable" 316 | }, 317 | { 318 | "label": "Bitrate", 319 | "name": "UAVCAN_BITRATE" 320 | } 321 | ], 322 | "show-subgroups-if": "UAVCAN_ENABLE>=2", 323 | "subgroups": [ 324 | { 325 | "label": "ESCs", 326 | "per-channel-parameters": [ 327 | { 328 | "label": "Function", 329 | "name": "UAVCAN_EC_FUNC${i}", 330 | "function": "function" 331 | }, 332 | { 333 | "label": "Idle throttle spin", 334 | "name": "UAVCAN_ESC_IDLT", 335 | "show-as": "bitset", 336 | "index-offset": -1 337 | } 338 | ], 339 | "channels": [ 340 | { 341 | "label": "ESC 1", 342 | "param-index": 1 343 | }, 344 | { 345 | "label": "ESC 2", 346 | "param-index": 2 347 | } 348 | ] 349 | }, 350 | { 351 | "label": "Servos", 352 | "per-channel-parameters": [ 353 | { 354 | "label": "Function", 355 | "name": "UAVCAN_SV_FUNC${i}" 356 | } 357 | ], 358 | "channels": [ 359 | { 360 | "label": "Servo 1", 361 | "param-index": 1 362 | }, 363 | { 364 | "label": "Servo 2", 365 | "param-index": 2 366 | } 367 | ] 368 | } 369 | ] 370 | }, 371 | { 372 | "label": "HITL", 373 | "parameters": [ 374 | { 375 | "name": "SYS_HITL", 376 | "label": "Configure", 377 | "function": "enable" 378 | } 379 | ], 380 | "subgroups": [ 381 | { 382 | "per-channel-parameters": [ 383 | { 384 | "label": "Function", 385 | "function": "function", 386 | "name": "PWM_SIM_FUN${i}" 387 | } 388 | ], 389 | "channels": [ 390 | { 391 | "label": "Output 1", 392 | "param-index": 1 393 | }, 394 | { 395 | "label": "Output 2", 396 | "param-index": 2 397 | } 398 | ] 399 | } 400 | ] 401 | } 402 | ], 403 | 404 | "functions_v1": 405 | { 406 | "0": { "label": "Disabled" }, 407 | "101": { "label": "Motor 1" }, 408 | "102": { "label": "Motor 2" }, 409 | "103": { "label": "Motor 3" }, 410 | "104": { "label": "Motor 4" }, 411 | "105": { "label": "Motor 5" }, 412 | "106": { "label": "Motor 6" }, 413 | "107": { "label": "Motor 7" }, 414 | "108": { "label": "Motor 8" }, 415 | "201": { "label": "Servo 1" }, 416 | "202": { "label": "Servo 2" }, 417 | "203": { "label": "Servo 3" }, 418 | "204": { "label": "Servo 4" }, 419 | "400": { "label": "Landing Gear" }, 420 | "401": { "label": "Parachute" }, 421 | "407": { "label": "RC AUX 1" }, 422 | "2032": { 423 | "label": "Camera Capture", 424 | "exclude-from-actuator-testing": true, 425 | "note": { 426 | "condition": "TRIG_MODE==0", 427 | "text": "Camera triggering needs to be enabled and configured via TRIG_* parameters." 428 | } 429 | } 430 | }, 431 | 432 | "mixer_v1": 433 | { 434 | "actuator-types": 435 | { 436 | "motor": { 437 | "function-min": 101, 438 | "function-max": 108, 439 | "label-index-offset": 1, 440 | "values": { 441 | "min": 0, 442 | "max": 1, 443 | "default-is-nan": true, 444 | "reversible": true 445 | }, 446 | "per-item-parameters": [ 447 | { 448 | "label": "Reversible", 449 | "name": "CA_MOT_REV", 450 | "show-as": "bitset", 451 | "index-offset": -1, 452 | "advanced": true 453 | } 454 | ] 455 | }, 456 | "servo": { 457 | "function-min": 201, 458 | "function-max": 208, 459 | "values": { 460 | "min": -1, 461 | "max": 1, 462 | "default": 0 463 | }, 464 | "per-item-parameters": [ 465 | { 466 | "label": "Trim", 467 | "name": "CA_SVO_TRIM${i}", 468 | "index-offset": 1 469 | } 470 | ] 471 | }, 472 | "DEFAULT": { 473 | "values": { 474 | "min": -1, 475 | "max": 1, 476 | "default": -1 477 | } 478 | } 479 | }, 480 | "config": 481 | [ 482 | { 483 | "option": "CA_AIRFRAME==1", 484 | "type": "multirotor", 485 | "actuators": 486 | [ 487 | { 488 | "group-label": "Motors", 489 | "count": "CA_MC_R_COUNT", 490 | "actuator-type": "motor", 491 | "required": true, 492 | "parameters": [ 493 | { 494 | "label": "slew rate limit", 495 | "name": "MOT_SLEW_MAX", 496 | "advanced": true 497 | } 498 | ], 499 | "per-item-parameters": 500 | [ 501 | { 502 | "label": "Position X", 503 | "function": "posx", 504 | "name": "CA_MC_R${i}_PX", 505 | "index-offset": 0 506 | }, 507 | { 508 | "label": "Position Y", 509 | "function": "posy", 510 | "name": "CA_MC_R${i}_PY", 511 | "index-offset": 0 512 | }, 513 | { 514 | "label": "Position Z", 515 | "function": "posz", 516 | "name": "CA_MC_R${i}_PZ", 517 | "index-offset": 0, 518 | "advanced": true 519 | }, 520 | { 521 | "label": "Direction CCW", 522 | "function": "spin-dir", 523 | "name": "CA_MC_R${i}_KM", 524 | "show-as": "true-if-positive" 525 | }, 526 | { 527 | "label": "Axis X", 528 | "function": "axisx", 529 | "name": "CA_MC_R${i}_AX", 530 | "advanced": true 531 | } 532 | ] 533 | } 534 | ] 535 | }, 536 | { 537 | "option": "CA_AIRFRAME==5", 538 | "actuators": 539 | [ 540 | { 541 | "group-label": "Motors", 542 | "count": 3, 543 | "item-label-prefix": 544 | ["Front Left Motor", "Front Right Motor", "Rear Motor"], 545 | "actuator-type": "motor", 546 | "per-item-parameters": 547 | [ 548 | { 549 | "label": "Position X", 550 | "function": "posx", 551 | "value": [0.3, 0.3, -0.75] 552 | }, 553 | { 554 | "label": "Position Y", 555 | "function": "posy", 556 | "value": [-0.3, 0.3, 0] 557 | } 558 | ] 559 | }, 560 | { 561 | "group-label": "Servos", 562 | "count": 4, 563 | "item-label-prefix": 564 | ["Front Left Tilt","Front Right Tilt","Left Elevon", "Right Elevon"], 565 | "actuator-type": "servo", 566 | "per-item-parameters": 567 | [ 568 | { 569 | "label": "Position X", 570 | "function": "posx", 571 | "value": [0.3, 0.3, 0, 0] 572 | }, 573 | { 574 | "label": "Position Y", 575 | "function": "posy", 576 | "value": [-0.3, 0.3, -0.3, 0.3] 577 | } 578 | ] 579 | } 580 | ] 581 | } 582 | ] 583 | } 584 | } 585 | -------------------------------------------------------------------------------- /component_information/general.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://mavlink.io/comp_version.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema", 4 | "description": "Schema for COMP_METADATA_TYPE_GENERAL", 5 | "type": "object", 6 | 7 | "properties": { 8 | "version": { 9 | "description": "Version number for the format of this file.", 10 | "type": "integer", 11 | "minimum": 1 12 | }, 13 | "vendorName": { 14 | "type": "string", 15 | "description": "Name of the component vendor." 16 | }, 17 | "modelName": { 18 | "type": "string", 19 | "description": "Name of the component model." 20 | }, 21 | "firmwareVersion": { 22 | "type": "string", 23 | "pattern": "^\\d+\\.\\d+\\.\\d+(\\.\\d+)?$", 24 | "description": "major.minor.patch.dev format" 25 | }, 26 | "hardwareVersion": { 27 | "type": "string", 28 | "pattern": "^\\d+\\.\\d+\\.\\d+(\\.\\d+)?$", 29 | "description": "major.minor.patch.dev format" 30 | }, 31 | "metadataTypes": { 32 | "type": "array", 33 | "description": "Which `COMP_METADATA_TYPE` specs are supported, with URI's.", 34 | "items": { 35 | "type": "object", 36 | "properties": { 37 | "type": { 38 | "description": "COMP_METADATA_TYPE", 39 | "type": "integer" 40 | }, 41 | "uri": { 42 | "description": "http[s] or MAVLink FTP uri", 43 | "type": "string" 44 | }, 45 | "fileCrc": { 46 | "description": "CRC32 checksum of the file", 47 | "type": "integer" 48 | }, 49 | "uriFallback": { 50 | "description": "Fallback URI when primary is not available", 51 | "type": "string" 52 | }, 53 | "fileCrcFallback": { 54 | "description": "CRC32 checksum of the fallback file", 55 | "type": "integer" 56 | }, 57 | "translationUri": { 58 | "description": "http[s] or MAVLink FTP url", 59 | "type": "string" 60 | }, 61 | "translationFileCrc": { 62 | "description": "CRC32 checksum of the translation file", 63 | "type": "integer" 64 | }, 65 | "translationUriFallback": { 66 | "description": "Fallback URI when primary translation is not available", 67 | "type": "string" 68 | }, 69 | "translationFileCrcFallback": { 70 | "description": "CRC32 checksum of the translation fallback file", 71 | "type": "integer" 72 | } 73 | }, 74 | "required": [ "type", "uri", "fileCrc", "uriFallback", "fileCrcFallback" ], 75 | "additionalProperties": false 76 | } 77 | } 78 | }, 79 | "required": [ "version", "metadataTypes" ], 80 | "additionalProperties": false 81 | } 82 | -------------------------------------------------------------------------------- /component_information/parameter.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://mavlink.io/comp_version.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema", 4 | "description": "Schema for COMP_METADATA_TYPE_PARAMETER", 5 | "type": "object", 6 | 7 | "properties": { 8 | "version": { 9 | "description": "Version number for the format of this file.", 10 | "type": "integer", 11 | "minimum": 1 12 | }, 13 | "parameters": { 14 | "type": "array", 15 | 16 | "items": { 17 | "type": "object", 18 | "properties": { 19 | "name": { 20 | "description": "Parameter Name.", 21 | "type": "string", 22 | "pattern": "^[\\.\\-a-zA-Z0-9_\\{\\}]{1,16}$", 23 | "comment": "FOO{n}_BAR for name will match actual name of FOO1_BAR, FOO3_BAR and so forth." 24 | }, 25 | "type": { 26 | "description": "Parameter type.", 27 | "type": "string", 28 | "enum": [ "Uint8", "Int8", "Uint16", "Int16", "Uint32", "Int32", "Float" ] 29 | }, 30 | "shortDesc": { 31 | "description": "Short user facing description/name for parameter. Used in UI intead of internal parameter name.", 32 | "type": "string", 33 | "default": "", 34 | "comment": "{n} index tagging will be replaced by name index. Example: 'FOO3_BAR': 'Description for foo element {n}' will turn into 'Description for foo element 1'." 35 | }, 36 | "longDesc": { 37 | "description": "Long user facing documentation of how the parameters works.", 38 | "type": "string", 39 | "default": "", 40 | "comment": "{n} index tagging will be replaced by name index. Example: 'FOO3_BAR': 'Description for foo element {n}' will turn into 'Description for foo element 1'." 41 | }, 42 | "units": { 43 | "description": "Units for parameter value.", 44 | "type": "string", 45 | "default": "", 46 | "comment": "A 'Known Unit' allows a GCS to convert between units like meters to feet as needed. Known Units are: 'm/meter/meter', 'vertical m' - vertical distance, 'cm/px', 'm/s', 'C' - celcius, 'm^2', 'g' - grams, 'centi-degrees', 'radians', 'norm'." 47 | }, 48 | "default": { 49 | "description": "Default value for parameter.", 50 | "type": "number", 51 | "comment": "If a defaultValue is not specified, there is no default for the parameter available at all. A GCS should not provide an option to reset this parameter to default." 52 | }, 53 | "decimalPlaces": { 54 | "description": "Number of decimal places to show for user facing display.", 55 | "type": "integer", 56 | "minimum": 0, 57 | "default": 7 58 | }, 59 | "min": { 60 | "description": "Minimum valid value", 61 | "type": "number", 62 | "comment": "If 'min' is not specified the minimum value is the minimum numeric value which can be represented by the type." 63 | }, 64 | "max": { 65 | "description": "Maximum valid value", 66 | "type": "number", 67 | "comment": "If 'max' is not specified the minimum value is the maximum numeric value which can be represented by the type." 68 | }, 69 | "increment": { 70 | "description": "Increment to use for user facing UI which increments a value", 71 | "type": "number" 72 | }, 73 | "rebootRequired": { 74 | "description": "true: Vehicle must be rebooted if this value is changed", 75 | "type": "boolean", 76 | "default": false 77 | }, 78 | "group": { 79 | "description": "User readable name for a group of parameters which are commonly modified together. For example a GCS can shows params in a hierarchical display based on group ", 80 | "type": "string", 81 | "default": "" 82 | }, 83 | "category": { 84 | "description": "User readable name for a 'type' of parameter. For example 'Developer', 'System', or 'Advanced'.", 85 | "type": "string", 86 | "default": "" 87 | }, 88 | "volatile": { 89 | "description": "true: value is volatile. Should not be included in creation of a CRC over param values for example.", 90 | "type": "boolean", 91 | "default": false 92 | }, 93 | "values": { 94 | "description": "Array of values and textual descriptions for use by GCS ui.", 95 | "type": "array", 96 | "items": { 97 | "type": "object", 98 | "properties": { 99 | "value": { 100 | "type": "number" 101 | }, 102 | "description": { 103 | "type": "string" 104 | } 105 | } 106 | } 107 | }, 108 | "bitmask": { 109 | "type": "array", 110 | "items": { 111 | "type": "object", 112 | "properties": { 113 | "index": { 114 | "type": "integer" 115 | }, 116 | "description": { 117 | "type": "string" 118 | } 119 | } 120 | } 121 | } 122 | }, 123 | "required": [ "name", "type" ], 124 | "additionalProperties": false 125 | } 126 | } 127 | }, 128 | "required": [ "version", "parameters" ], 129 | "additionalProperties": false 130 | } 131 | -------------------------------------------------------------------------------- /component_information/peripherals.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://mavlink.io/comp_version.schema.json", 3 | "$schema": "http://json-schema.org/draft-07/schema", 4 | "description": "Schema for COMP_METADATA_TYPE_PERIPHERALS", 5 | "type": "object", 6 | 7 | "properties": { 8 | "version": { 9 | "description": "Version number for the format of this file.", 10 | "type": "integer", 11 | "minimum": 1 12 | }, 13 | "peripherals": { 14 | "type": "array", 15 | "description": "All external peripherals", 16 | "items": { 17 | "name": { 18 | "type": "string", 19 | "description": "Human-readable name of the peripheral." 20 | }, 21 | "vendorName": { 22 | "type": "string", 23 | "description": "Name of the peripheral vendor." 24 | }, 25 | "modelName": { 26 | "type": "string", 27 | "description": "Name of the peripheral model." 28 | }, 29 | "firmwareVersion": { 30 | "type": "string", 31 | "pattern": "^\\d+\\.\\d+\\.\\d+(\\.\\d+)?$", 32 | "description": "major.minor.patch.dev format" 33 | }, 34 | "hardwareVersion": { 35 | "type": "string", 36 | "pattern": "^\\d+\\.\\d+\\.\\d+(\\.\\d+)?$", 37 | "description": "major.minor.patch.dev format" 38 | }, 39 | "metadataTypes": { 40 | "type": "array", 41 | "description": "Which `COMP_METADATA_TYPE` specs are supported, with URI's.", 42 | "items": { 43 | "type": "object", 44 | "properties": { 45 | "type": { 46 | "description": "COMP_METADATA_TYPE", 47 | "type": "integer" 48 | }, 49 | "uri": { 50 | "description": "http[s] or MAVLink FTP uri", 51 | "type": "string" 52 | }, 53 | "fileCrc": { 54 | "description": "CRC32 checksum of the file", 55 | "type": "integer" 56 | }, 57 | "uriFallback": { 58 | "description": "Fallback URI when primary is not available", 59 | "type": "string" 60 | }, 61 | "fileCrcFallback": { 62 | "description": "CRC32 checksum of the fallback file", 63 | "type": "integer" 64 | }, 65 | "translationUri": { 66 | "description": "http[s] or MAVLink FTP url", 67 | "type": "string" 68 | }, 69 | "translationFileCrc": { 70 | "description": "CRC32 checksum of the translation file", 71 | "type": "integer" 72 | }, 73 | "translationUriFallback": { 74 | "description": "Fallback URI when primary translation is not available", 75 | "type": "string" 76 | }, 77 | "translationFileCrcFallback": { 78 | "description": "CRC32 checksum of the translation fallback file", 79 | "type": "integer" 80 | } 81 | }, 82 | "required": [ "type", "uri", "fileCrc", "uriFallback", "fileCrcFallback" ], 83 | "additionalProperties": false 84 | } 85 | } 86 | }, 87 | "required": [ "name" ], 88 | "additionalProperties": false 89 | } 90 | }, 91 | "required": [ "version", "peripherals" ], 92 | "additionalProperties": false 93 | } 94 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #define MAVLINK_VERSION "${PROJECT_VERSION}" 2 | -------------------------------------------------------------------------------- /doc/MAVLink2.md: -------------------------------------------------------------------------------- 1 | # Guide to MAVLink2 2 | 3 | MAVLink2 is a new variant of the MAVLink protocol designed to bring 4 | more flexibility and security to MAVLink communication. 5 | 6 | A background document on the MAVLink2 design is available here: 7 | 8 | https://docs.google.com/document/d/1XtbD0ORNkhZ8eKrsbSIZNLyg9sFRXMXbsR2mp37KbIg/edit?usp=sharing 9 | 10 | it is suggested that you start by reading that document. 11 | 12 | The key features of MAVLink2 are: 13 | 14 | * support for more than 256 message IDs (24 bit message ID) 15 | * support for packet signing 16 | * support for extending existing MAVLink messages 17 | * support for variable length arrays 18 | 19 | The first 3 features in this list are implemented now and ready for 20 | testing. The last feature is not implemented yet. 21 | 22 | Most of the rest of this document is a guide for programmers 23 | interested in using MAVLink2 in their applications. The two language 24 | bindings that are covered are C and Python. Bindings for MAVLink2 for 25 | other languages are not implemented yet. 26 | 27 | ## Using the C implementation 28 | 29 | Using the C implementation of MAVLink2 is very similar to using the 30 | existing MAVLink1 implementation. You start by generating the MAVLink2 31 | headers using mavgen.py, but passing the --wire-protocol=2.0 32 | option. For example: 33 | 34 | ``` 35 | mavgen.py --lang C message_definitions/v1.0/ardupilotmega.xml -o generator/C/include_v2.0 --wire-protocol=2.0 36 | ``` 37 | 38 | This will generate a set of C headers in the generator/C/include_v2.0 39 | directory. These headers offer the same range of APIs as was offered 40 | by MAVLink1. The major changes from an API perspective are: 41 | 42 | * you don't need to provide a message CRC table any more, or message 43 | length table. These have been folded into a single packed table, 44 | replacing the old table which was indexed by msgId. That was 45 | necessary to cope with the much larger 24 bit namespace of message 46 | IDs. 47 | 48 | ### Sending and receiving MAVLink1 packets 49 | 50 | The C implementation of MAVLink2 supports sending and receiving 51 | MAVLink1 packets as well. To force sending MAVLink1 packets on a 52 | particular channel you change the flags field of the status 53 | object. For example: 54 | 55 | ``` 56 | mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 57 | status->flags |= MAVLINK_STATUS_FLAG_OUT_MAVLINK1; 58 | ``` 59 | 60 | that will cause subsequent packets on the given channel to be sent as 61 | MAVLink1. 62 | 63 | Incoming MAVLink1 packets will be automatically handled as 64 | MAVLink1. If you need to determine if a particular message was received as 65 | MAVLink1 or MAVLink2 then you can use the magic field of the message, 66 | like this: 67 | 68 | ``` 69 | if (msg->magic = MAVLINK_STX_MAVLINK1) { 70 | printf("This is a MAVLink1 message\n"); 71 | } 72 | ``` 73 | 74 | In most cases this should not be necessary as the xml message 75 | definition files for MAVLink1 and MAVLink2 are the same, so you can 76 | treat incoming MAVLink1 messages the same as MAVLink2 messages. 77 | 78 | Note that MAVLink1 is restricted to messageIDs less than 256, so any 79 | messages with a higher messageID won't be received as MAVLink1. 80 | 81 | ### Handling message extensions 82 | 83 | The XML for messages can contain extensions that are optional in the 84 | protocol. This allows for extra fields to be added to a message. For 85 | example: 86 | 87 | ``` 88 | 89 | state of APM memory 90 | heap top 91 | free memory 92 | 93 | extension1 94 | extension2 95 | 96 | ``` 97 | 98 | the fields after the extensions line are extended fields. The rules 99 | for extended messages are: 100 | 101 | * if sent as a MAVLink1 message then extended fields are not sent 102 | * if received by an implementation that doesn't have the extended 103 | fields then the fields will not be seen 104 | * if sent by an implementation that doesn't have the extended fields 105 | then the recipient will see zero values for the extended fields 106 | 107 | ### Handling message signing 108 | 109 | One of the key features of MAVLink2 is support for signing of 110 | messages. To enable signing in your application you will need to add 111 | some additional code. In particular you will need to add: 112 | 113 | * code to handle the SETUP_SIGNING message 114 | * code to setup and teardown signing on a link 115 | * code to save and load the secret key and timestamp in persistent storage 116 | * a callback to allow for accepting of certain kinds of unsigned messages 117 | 118 | Example code in ArduPilot for each of these pieces if available here: 119 | 120 | https://github.com/tridge/ardupilot/blob/mavlink2-wip/libraries/GCS_MAVLink/GCS_Signing.cpp 121 | 122 | ### Handling SETUP_SIGNING 123 | 124 | The SETUP_SIGNING message is the mechanism for a GCS to setup a 125 | signing key on a MAVLink2 device. It takes a 32 byte secret key and an 126 | initial timestamp. The method of generating the 32 byte secret key is 127 | up to the GCS implementation, although it is suggested that all GCS 128 | implementations should support the use of a sha256 hash of a user 129 | provided passphrase. 130 | 131 | ### Handling timestamps 132 | 133 | The timestamp is a 64 bit number, and is in units of 10 microseconds 134 | since 1st January 2015. For systems where the time since 1/1/1970 is 135 | available (the unix epoch) you can use an offset in seconds of 136 | 1420070400. 137 | 138 | Storage and handling of the timestamp is critical to the security of 139 | the signing system. The rules are: 140 | 141 | * the current timestamp should be stored regularly in persistent 142 | storage (suggested at least once a minute) 143 | * the timestamp used on startup should be the maximum of the timestamp 144 | implied by the system clock and the stored timestamp 145 | * if the system does not have a RTC mechanism then it should update 146 | its timestamp when GPS lock is achieved. The maximum of the 147 | timestamp from the GPS and the stored timestamp should be used 148 | * the timestamp should be incremented by one on each message send. 149 | This is done for you by the generated headers. 150 | * when a correctly signed message is decoded the timestamp should be 151 | replaced by the timestamp of the incoming message if that timestamp 152 | is greater than the current timestamp. This is done for you by the 153 | generated headers 154 | * the timestamp on incoming signed messages should be checked against 155 | the previous timestamp for the incoming 156 | (linkID,srcSystem,SrcComponent) tuple and the message rejected if it 157 | is smaller. This is done for you by generated headers. 158 | * if there is no previous message with the given 159 | (linkID,srcSystem,SrcComponent) then the timestamp should be 160 | accepted if it not more than 6 million (one minute) behind the 161 | current timestamp 162 | 163 | ### Enabling signing on a channel 164 | 165 | To enable signing on a channel you need to fill in two pointers in the 166 | status structure for the cnannel. The two pointed are: 167 | 168 | ``` 169 | mavlink_signing_t *signing; 170 | mavlink_signing_streams_t *signing_streams; 171 | ``` 172 | 173 | The signing pointer controls signing for this stream. It is 174 | per-stream, and contains the secret key, the timestamp and a set of 175 | flags, plus an optional callback function for accepting unsigned 176 | packets. Typical setup would be: 177 | 178 | ``` 179 | memcpy(signing.secret_key, key.secret_key, 32); 180 | signing.link_id = (uint8_t)chan; 181 | signing.timestamp = key.timestamp; 182 | signing.flags = MAVLINK_SIGNING_FLAG_SIGN_OUTGOING; 183 | signing.accept_unsigned_callback = accept_unsigned_callback; 184 | mavlink_status_t *status = mavlink_get_channel_status(chan); 185 | status.signing = &signing; 186 | ``` 187 | 188 | The signing_streams pointer is a structure used to record the previous 189 | timestamp for a (linkId,srcSystem,SrcComponent) tuple. This must point 190 | to a structure that is common to all channels in order to prevent 191 | inter-channel replay attacks. Typical setup is: 192 | 193 | ``` 194 | mavlink_status_t *status = mavlink_get_channel_status(chan); 195 | status.signing_streams = &signing_streams; 196 | ``` 197 | 198 | The maximum number of signing streams supported is given by the 199 | MAVLINK_MAX_SIGNING_STREAMS macro. This defaults to 16, but it may be 200 | worth raising this for GCS implementations. If the C implementation 201 | runs out of signing streams then new streams will be rejected. 202 | 203 | ### Using the accept_unsigned_callback 204 | 205 | In the signing structure there is an optional accept_unsigned_callback 206 | function pointer. The C prototype for this function is: 207 | 208 | ``` 209 | bool accept_unsigned_callback(const mavlink_status_t *status, uint32_t msgId); 210 | ``` 211 | 212 | If set in the signing structure then this function will be called on 213 | any unsigned packet (including all MAVLink1 packets) or any packet 214 | where the signature is incorrect. The function offers a way for the 215 | implementation to allow unsigned packets to be accepted. 216 | 217 | The rules for what unsigned packets should be accepted is 218 | implementation specific, but it is suggested the following rules be 219 | considered: 220 | 221 | * have a mechanism for marking a particular communication channel as 222 | being secure (such as a USB connection) to allow for signing 223 | setup. 224 | * always accept RADIO_STATUS packets for feedback from 3DR radios 225 | (which don't do signing) 226 | 227 | For example: 228 | 229 | ``` 230 | static const uint32_t unsigned_messages[] = { 231 | MAVLINK_MSG_ID_RADIO_STATUS 232 | }; 233 | 234 | static bool accept_unsigned_callback(const mavlink_status_t *status, uint32_t message_id) 235 | { 236 | // Make the assumption that channel 0 is USB and should always be accessible 237 | if (status == mavlink_get_channel_status(MAVLINK_COMM_0)) { 238 | return true; 239 | } 240 | 241 | for (unsigned i = 0; i < sizeof(unsigned_messages) / sizeof(unsigned_messages[0]); i++) { 242 | if (unsigned_messages[i] == message_id) { 243 | return true; 244 | } 245 | } 246 | 247 | return false; 248 | } 249 | ``` 250 | 251 | ### Handling link IDs 252 | 253 | The purpose of the link_id field in the MAVLink2 signing structure is 254 | to prevent cross-channel replay attacks. Without the link_id an 255 | attacker could record a packet (such as a disarm request) on one 256 | channel, then play it back on a different channel. 257 | 258 | The intention with the link IDs is that each channel of communication 259 | between an autopilot and a GCS uses a different link ID. There is no 260 | requirement that the same link ID be used in both directions however. 261 | 262 | For C implementations the obvious mechanism is to use the MAVLink 263 | channel number as the link ID. That works well for an autopilot, but 264 | runs into an issue for a GCS implementation. The issue is that a user 265 | may launch multiple GCS instances talking to the same autopilot via 266 | different communication links (such as two radios, or USB and a 267 | radio). These multiple GCS instances will not be aware of each other, 268 | and so may choose the same link ID. If that happens then a large 269 | number of correctly signed packets will be rejected by the autopilot 270 | as they will have timestamps that are older than the timestamp 271 | received for the same stream tuple on the other communication link. 272 | 273 | The solution that I have adopted for MAVProxy is this: 274 | 275 | ``` 276 | if (msg.get_signed() and 277 | self.mav.signing.link_id == 0 and 278 | msg.get_link_id() != 0 and 279 | self.target_system == msg.get_srcSystem() and 280 | self.target_component == msg.get_srcComponent()): 281 | # change to link_id from incoming packet 282 | self.mav.signing.link_id = msg.get_link_id() 283 | ``` 284 | 285 | what that says is that if the current link ID in use by MAVProxy is 286 | zero, and it receives a correctly signed packet with a non-zero link 287 | ID then it switches link ID to the one from the incoming packet. 288 | 289 | The has the effect of making the GCS slave its link ID to the link ID 290 | of the autopilot. 291 | 292 | 293 | ### Negotiating MAVLink2 294 | 295 | It is expected that vehicle and GCS implementations will support both 296 | MAVLink1 and MAVLink2 for quite some time. We would like most users to 297 | receive the benefit of MAVLink2, while still supporting 298 | implementations that don't yet support MAVLink2. 299 | 300 | The following is meant to capture best practice for vehicle firmware 301 | and GCS authors: 302 | 303 | * vehicle implementations should have a way to enable/disable the 304 | sending of MAVLink2 messages. This should preferably be on a per-link 305 | basis to allow for some peripherals to be MAVLink1 while others are 306 | MAVLink2. It is acceptable for this option to require a reboot of the flight controller to take effect. 307 | 308 | * if signing is enabled and MAVLink2 is enabled then the vehicle should 309 | immediately start sending MAVLink2 on startup 310 | 311 | * if signing is not enabled and MAVLink2 is enabled then the vehicle may 312 | choose to start by sending MAVLink1 and switch to MAVLink2 on a link 313 | when it first receives a MAVLink2 message on the link 314 | 315 | * vehicles should set the MAV_PROTOCOL_CAPABILITY_MAVLINK2 capability 316 | flag in the AUTOPILOT_VERSION message if MAVLink2 is available on a 317 | link. This should be set in the case where the link is currently sending MAVLink1 packets but MAVLink2 packets will be accepted and will cause a switch to MAVLink2 318 | 319 | * GCS implementations can choose to either automatically switch to MAVLink2 where available or to have a configuration option for MAVLink2 320 | 321 | * if the GCS chooses to use a configuration option then when the option is enabled it should send MAVLink2 on starting the link 322 | 323 | * if the GCS chooses to use automatic switching then it should switch to sending MAVLink2 if either it receives a MAVLink2 message on the link or by asking for the AUTOPILOT_VERSION message to be sent and seeing the MAV_PROTOCOL_CAPABILITY_MAVLINK2 flag is set 324 | 325 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # MAVLink Micro Air Vehicle Message Marshalling Library 2 | 3 | Files: 4 | 5 | - **Doxyfile**: Doxygen project configuration file 6 | - **MAVLink2.md**: MAVLink2 Documentation 7 | - **README**: This file 8 | - **mavlink.php**: Generates online documentation from MAVLink XML - http://mavlink.org/messages/common 9 | - **mavlink_to_html_table.xsl**: XSL transform used by **mavlink.php** 10 | - **mavlink.css**: CSS used by online documentation 11 | - **mavlink_gitbook.py**: Generates documentation from MAVLink XML that can be imported into gitbook 12 | - **mavlink_to_html_table_gitbook.xsl**: XSL transform used by **mavlink_gitbook.py** 13 | 14 | 15 | For more information, please visit: https://mavlink.io/en/ 16 | 17 | (c) 2009-2010 Lorenz Meier / PIXHAWK Team 18 | -------------------------------------------------------------------------------- /doc/mavlink.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family:'Helvetica',Arial; 3 | font-size:90%; 4 | margin: 80px; 5 | } 6 | 7 | h1 { 8 | margin-top: 2em; 9 | } 10 | 11 | h2 { 12 | margin-top: 1em; 13 | } 14 | 15 | h3 { 16 | margin-top: 0.8em; 17 | font-size:150%; 18 | } 19 | 20 | p.description { 21 | font-style:italic; 22 | } 23 | 24 | table { 25 | margin-bottom: 5em; 26 | } 27 | 28 | table.sortable { 29 | border: 1px solid #656575; 30 | width: 100%; 31 | } 32 | 33 | table.sortable th { 34 | margin: 5px; 35 | } 36 | 37 | #tr:nth-child(odd) { background-color:#eee; } 38 | #tr:nth-child(even) { background-color:#fff; } 39 | 40 | table.sortable thead { 41 | background-color:#eee; 42 | color:#666666; 43 | font-weight: bold; 44 | cursor: default; 45 | } 46 | 47 | table.sortable td { 48 | margin: 5px 5px 20px 5px; 49 | vertical-align: top; 50 | } 51 | 52 | table.sortable td.mavlink_name { 53 | color:#226633; 54 | font-weight: bold; 55 | width: 25%; 56 | vertical-align: top; 57 | } 58 | 59 | table.sortable td.mavlink_mission_param { 60 | color:#334455; 61 | font-weight: bold; 62 | width: 25%; 63 | } 64 | 65 | table.sortable td.mavlink_type { 66 | color:#323232; 67 | font-weight: normal; 68 | width: 12%; 69 | } 70 | 71 | table.sortable td.mavlink_comment { 72 | color:#555555; 73 | font-weight: normal; 74 | width: 60%; 75 | } 76 | 77 | p.description { 78 | color:#808080; 79 | font-weight: normal; 80 | } -------------------------------------------------------------------------------- /doc/mavlink.php: -------------------------------------------------------------------------------- 1 | loadXML($xml); 20 | 21 | // Load stylesheet XSL file 22 | $xsl = file_get_contents($xsl_file_name); 23 | $xsl_doc = new DomDocument; 24 | $xsl_doc->loadXML($xsl); 25 | 26 | $xsltproc = new XsltProcessor(); 27 | $xsltproc->importStylesheet($xsl_doc); 28 | ?> 29 | 30 | 31 | 32 | 33 | MAVLINK Common Message set specifications 34 | 35 | 36 | 37 |

MAVLINK Common Message Set

38 | 39 |

40 | These messages define the common message set, which is the reference message set implemented by most ground control stations and autopilots. 41 |

42 | 43 | transformToXML($xml_doc)) 46 | { 47 | echo $html; 48 | } 49 | else 50 | { 51 | trigger_error("XSL transformation failed",E_USER_ERROR); 52 | } 53 | 54 | ?> 55 | 56 |
57 |
58 | 59 |

60 | Messages are defined by the common.xml file. The C packing/unpacking code is generated from this specification, as well as the HTML documentaiton in the section above.
61 |
62 | The XML displayed here is updated on every commit and therefore up-to-date. 63 |

64 | 65 | 66 | parse_code(); 76 | // 77 | //echo $display_xml; 78 | 79 | ?> -------------------------------------------------------------------------------- /doc/mavlink_gitbook.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | """ 4 | This script generates markdown files for all the MAVLink message definition XML at: 5 | https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0 6 | 7 | The files can be imported into a gitbook to display the messages as HTML 8 | 9 | The script runs on both Python2 and Python 3. The following libraries must be imported: lxml, requests, bs4. 10 | 11 | The file is run in mavlink/doc/ with no arguments. It writes the files to /messages/ 12 | """ 13 | 14 | import lxml.etree as ET 15 | import requests 16 | from bs4 import BeautifulSoup as bs 17 | import re 18 | import os # for walk 19 | 20 | 21 | xsl_file_name = "mavlink_to_html_table_gitbook.xsl" 22 | xml_message_definitions_dir_name = "../message_definitions/v1.0/" 23 | 24 | output_dir = "./messages/" 25 | output_dir_html=output_dir+"_html/" 26 | if not os.path.exists(output_dir_html): 27 | os.makedirs(output_dir_html) 28 | 29 | 30 | # File for index 31 | index_file_name = "README.md" 32 | index_file_name = output_dir + index_file_name 33 | 34 | # Get XSLT 35 | with open(xsl_file_name, 'r') as content_file: 36 | xsl_file = content_file.read() 37 | xslt = ET.fromstring(xsl_file) 38 | 39 | #initialise text for index file. 40 | index_text=""" 41 | # XML Definition Files & Dialects 42 | 43 | MAVLink definitions files can be found in [mavlink/message definitions](https://github.com/mavlink/mavlink/blob/master/message_definitions/). 44 | These can roughtly be divided into: 45 | - [Standard definitions](#standard-definitions) - core definitions shared by many flight stacks 46 | - [Test definitions](#test-definitions) - definitions to support testing and validation 47 | - [Dialects](#dialects) - *protocol-* and *vendor-specific* messages, enums and commands 48 | 49 | 50 | ## Standard Definitions 51 | 52 | The following XML definition files are considered standard/core (i.e. not dialects): 53 | 54 | - [minimal.xml](minimal.md) - the minimum set of entities (messages, enums, MAV_CMD) required to set up a MAVLink network. 55 | - [standard.xml](standard.md) - the standard set of entities that are implemented by almost all flight stacks (at least 2, in a compatible way). 56 | This `includes` [minimal.xml](minimal.md). 57 | - [common.xml](../messages/common.md) - the set of entitites that have been implemented in at least one core flight stack. 58 | This `includes` [standard.xml](minimal.md) 59 | 60 | > **Note** We are still working towards moving the truly standard entities from **common.xml** to **standard.xml** 61 | Currently you should include [common.xml](../messages/common.md) 62 | 63 | In addition: 64 | - [development.xml](development.md) - XML definitions that are _proposed_ for inclusion in the standard definitions. 65 | These are work in progress. 66 | 67 | 68 | ## Test Definitions 69 | 70 | The following definitions are used for testing and dialect validation: 71 | 72 | - [all.xml](all.md) - This includes all other XML files, and is used to verify that there are no ID clashes (and can potentially be used by GCS to communicate with any core dialect). 73 | - [test.xml](test.md) - Test XML definition file. 74 | 75 | 76 | ## Dialects {#dialects} 77 | 78 | MAVLink *dialects* are XML definition files that define *protocol-* and *vendor-specific* messages, enums and commands. 79 | 80 | > **Note** Vendor forks of MAVLink may contain XML entities that have not yet been pushed into the main repository (and will not be documented). 81 | 82 | Dialects may *include* other MAVLink XML files, which may in turn contain other XML files (up to 5 levels of XML file nesting are allowed - see `MAXIMUM_INCLUDE_FILE_NESTING` in [mavgen.py](https://github.com/ArduPilot/pymavlink/blob/master/generator/mavgen.py#L44)). 83 | A typical pattern is for a dialect to include [common.xml](../messages/common.md) (containing the *MAVLink standard definitions*), extending it with vendor or protocol specific messages. 84 | 85 | The dialect definitions are: 86 | """ 87 | 88 | index_text_trailer=""" 89 | """ 90 | 91 | #Fix up the BeautifulSoup output so to fix build-link errors in the generated gitbook. 92 | ## BS puts each tag/content in its own line. Gitbook generates anchors using the spaces/newlines. 93 | ## This puts displayed text content immediately within tags so that anchors/links generate properly 94 | def fix_content_in_tags(input_html): 95 | #print("fix_content_in_tags was called") 96 | def remove_space_between_content_tags(matchobj): 97 | stripped_string=matchobj.group(1).strip() 98 | return '>%s<' % stripped_string 99 | 100 | input_html=re.sub(r'\>(\s+?\w+?.*?)\<', remove_space_between_content_tags, input_html,flags=re.DOTALL) 101 | return input_html 102 | 103 | def fix_external_dialect_link(input_html): 104 | #print("fix_external_dialect_link was called") 105 | def fixupexternaldialecturls(matchobj): 106 | return matchobj.group(1).strip() 107 | 108 | input_html=re.sub(r' **Tip** The common set `includes` [minimal.xml](minimal.md), which contains the *minimal set* of definitions for any MAVLink system. 161 | These definitions are [reproduced at the end of this topic](#minimal). 162 | 163 | """ 164 | elif filename == 'minimal': 165 | insert_text+=""" 166 | # MAVLink Minimal Set 167 | 168 | The MAVLink *minimal* set contains the minimal set of definitions for a viable MAVLink system. 169 | 170 | The message set is defined in [minimal.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/minimal.xml) and is managed by the MAVLink project. 171 | 172 | > **Tip** The minimal set is included (imported into) other xml definition files, including the [MAVLink Common Message Set (common.xml)](minimal.md). 173 | 174 | """ 175 | elif filename == 'ardupilotmega': 176 | insert_text+=""" 177 | # Dialect: ArduPilotMega 178 | 179 | These messages define the ArduPilot specific message set, which is custom to [http://ardupilot.org](http://ardupilot.org). 180 | 181 | This topic is a human-readable form of the XML definition file: [ardupilotmega.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/ardupilotmega.xml). 182 | 183 | > **Warning** The ArduPilot MAVLink fork of [ardupilotmega.xml](https://github.com/ArduPilot/mavlink/blob/master/message_definitions/v1.0/ardupilotmega.xml) may contain messages that have not yet been merged into this documentation. 184 | """ 185 | elif filename == 'development': 186 | insert_text+=""" 187 | # Dialect: development 188 | 189 | This dialect contains messages that are proposed for inclusion in the [standard set](standard.md), in order to ease development of prototype implementations. 190 | They should be considered a 'work in progress' and not included in production builds. 191 | 192 | This topic is a human-readable form of the XML definition file: [development.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/development.xml). 193 | """ 194 | elif filename == 'all': 195 | insert_text+=""" 196 | # Dialect: all 197 | 198 | This dialect is intended to `include` all other [dialects](../messages/README.md) in the mavlink/mavlink repository (including [external dialects](https://github.com/mavlink/mavlink/tree/master/external/dialects#mavlink-external-dialects)). 199 | 200 | Dialects that are in **all.xml** are guaranteed to not have clashes in messages, enums, enum ids, and MAV_CMDs. 201 | This ensure that: 202 | - Systems based on these dialects can co-exist on the same MAVLink network. 203 | - A Ground Station might (optionally) use libraries generated from **all.xml** to communicate using any of the dialects. 204 | 205 | > **Warning** New dialect files in the official repository must be added to **all.xml** and restrict themselves to using ids in their own allocated range. 206 | A few older dialects are not included because these operate in completely closed networks or because they are only used for tests. 207 | 208 | This topic is a human-readable form of the XML definition file: [all.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/all.xml). 209 | """ 210 | else: 211 | insert_text+='\n# Dialect: %s' % filename.rsplit('.',1)[0] 212 | insert_text+='\n\n*This is a human-readable form of the XML definition file: [%s](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/%s).*' % (filename, filename) 213 | insert_text+=""" 214 | 215 | 216 | > **Note** MAVLink 2 messages have an ID > 255 and are marked up using **(MAVLink 2)** in their description. 217 | 218 | 219 | > **Note** MAVLink 2 extension fields that have been added to MAVLink 1 messages are displayed in blue. 220 | 221 | 226 | """ 227 | # Include HTML in generated content 228 | insert_text+='\n\n{%% include "_html/%s.html" %%}' % filename 229 | input_html=insert_text+'\n\n'+input_html 230 | 231 | if filename == 'common': 232 | input_html+=""" 233 | # Minimal.xml {#minimal} 234 | 235 | The minimal set of definitions required for any MAVLink system are included from [minimal.xml](minimal.md). 236 | These are listed below. 237 | 238 | 239 | {% include "_html/minimal.html" %}""" 240 | 241 | 242 | #print(input_html) 243 | return input_html 244 | 245 | dialect_files = set() 246 | all_files = set() 247 | 248 | for subdir, dirs, files in os.walk(xml_message_definitions_dir_name): 249 | #Generate html for all the XML files 250 | for file in files: 251 | print(file) 252 | if not file.endswith('.xml'): #only process xml files. 253 | continue 254 | xml_file_name = xml_message_definitions_dir_name+file 255 | with open(xml_file_name, 'r') as content_file: 256 | xml_file = content_file.read() 257 | dom = ET.fromstring(xml_file) 258 | transform = ET.XSLT(xslt) 259 | newdom = transform(dom) 260 | 261 | #Prettify the HTML using BeautifulSoup 262 | soup=bs(str(newdom), "lxml") 263 | prettyHTML=soup.prettify() 264 | 265 | #Strip out text before tag in XSLT output 266 | prettyHTML=strip_text_before_string(prettyHTML,'') 267 | prettyHTML = fix_content_in_tags(prettyHTML) 268 | 269 | #Replace invalid file extensions (workaround for xslt) 270 | prettyHTML = fix_include_file_extension(prettyHTML) 271 | 272 | #Replace space markers with intentional space 273 | prettyHTML = fix_replace_space_marker(prettyHTML) 274 | 275 | #Fix up links to external dialects to not be links 276 | prettyHTML = fix_external_dialect_link(prettyHTML) 277 | 278 | #Fix up plain text mav symbols to be internal links 279 | prettyHTML = fix_add_implicit_links_items(prettyHTML) 280 | 281 | 282 | #Write output html file 283 | output_file_name_html = file.rsplit('.',1)[0]+".html" 284 | 285 | output_file_name_html_withdir = output_dir_html+output_file_name_html 286 | print("Output filename (html): %s" % output_file_name_html) 287 | 288 | with open(output_file_name_html_withdir, 'w') as out: 289 | out.write(prettyHTML) 290 | 291 | # Create sortable list of output file names 292 | #Write output markdown file 293 | output_file_name_prefix = file.rsplit('.',1)[0] 294 | all_files.add(output_file_name_prefix) 295 | if not file=='common.xml' and not file=='standard.xml' and not file=='minimal.xml' and not file=='test.xml' and not file=='development.xml': 296 | dialect_files.add(output_file_name_prefix) 297 | 298 | 299 | # Generate the markdown files 300 | for file_prefix in all_files: 301 | print(file_prefix) 302 | markdown_text='' 303 | #Inject a heading and doc-type intro (markdown format) 304 | markdown_text = inject_top_level_docs(markdown_text,file_prefix) 305 | 306 | output_file_name_md_withdir = output_dir+file_prefix+'.md' 307 | print("Output filename (md): %s" % output_file_name_md_withdir) 308 | 309 | with open(output_file_name_md_withdir, 'w') as out: 310 | out.write(markdown_text) 311 | 312 | 313 | for the_file in sorted(dialect_files): 314 | index_text+='\n* [%s.xml](%s.md)' % (the_file,the_file) 315 | index_text+='\n\n' 316 | index_text+=index_text_trailer 317 | 318 | #Write the index 319 | with open(index_file_name, 'w') as content_file: 320 | content_file.write(index_text) 321 | 322 | print("COMPLETED") 323 | 324 | 325 | 326 | -------------------------------------------------------------------------------- /doc/mavlink_to_html_table.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

MAVLink Include Files

7 |

Including files:

8 |
9 | 10 | 11 |

MAVLink Type Enumerations

12 | 13 |
14 | 15 | 16 |

MAVLink Messages

17 | 18 |
19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |

35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
Field NameTypeDescription
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |

MAVLink Documentation

59 |

60 | The Official MAVLink message documentation contains additional information, including field units and enum values. 61 |

62 | 63 |

MAVLink Protocol Version

64 |

The current MAVLink version is 2.. The minor version numbers (after the dot) range from 1-255.

65 |
66 | 67 | 68 | 69 | 70 | ENUM_ 71 | 72 | 73 | 74 | 75 |

76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
ValueField NameDescription
88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 |
102 | 103 |
104 | 105 | 106 | 107 | 108 | Mission Param # 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/mavlink_to_html_table_gitbook.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

MAVLink Include Files: .md.unlikely

7 |
8 | 9 | 10 |

MAVLink Type Enumerations

11 | 12 | 13 | 14 |

MAVLink Commands (MAV_CMD)

15 |

MAVLink commands (MAV_CMD) and messages are different! These commands define the values of up to 7 parameters that are packaged INSIDE specific messages used in the Mission Protocol and Command Protocol. Use commands for actions in missions or if you need acknowledgment and/or retry logic from a request. Otherwise use messages.

16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 |

MAVLink Messages

24 | 25 |
26 | 27 | 28 |

29 | 30 | ( 31 | 32 | # 33 | # 34 | 35 | )

36 | 37 | 38 |

[Message] 39 | (MAVLink 2) 40 |

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
Field NameTypeUnitsValuesDescription
62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 |  ** 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | # 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 |

MAVLink Protocol Version

95 |

The current MAVLink version is 2.. The minor version numbers (after the dot) range from 1-255.

96 |
97 | 98 | 99 |

This file has protocol dialect: .

100 |
101 | 102 | 103 | 104 |

105 | 106 |

107 | 108 |

[Enum]

109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
ValueField NameDescription
121 |
122 | 123 | 124 | 125 |

126 | 127 |
128 | 129 | 130 | 131 |

(#)

132 | 133 | 134 |

[Command]

135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 |
Param (:Label)DescriptionValuesUnits
157 | 158 |
159 | 160 | 161 | 162 | 163 | 164 | 165 | # 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 |
180 | 181 |
182 |
183 | 184 | 185 | 186 | 187 | 188 | 189 | : 190 | 191 | 192 | Reserved (set to 0) 193 |
GCS display settings: 194 | Label: , 195 | decimalPlaces: 196 |
197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | # 205 | 206 | 207 | min:xxx_space_xxx 208 | max:xxx_space_xxx 209 | increment: 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 |
221 | 222 | 223 | 224 | 225 | 226 | 227 | Param # 228 | 229 | 230 | 231 | 232 | 233 |
Possible values: 234 |
235 | 236 |
Values: 237 | units: , 238 | min:, 239 | max:, 240 | increment: 241 |
242 |
243 | 244 |
GCS display settings: 245 | Label: , 246 | decimalPlaces: 247 |
248 | 249 | 250 | 251 | 252 |
253 | 254 | 255 |

WORK IN PROGRESS:xxx_space_xxxDo not use in stable production environments (it may change).

256 |
257 | 258 | 259 |

DEPRECATED:xxx_space_xxxReplaced by (). 260 | 261 | 262 | 263 | 264 | 265 |

266 |
267 | 268 | 269 | 270 |
271 | -------------------------------------------------------------------------------- /examples/linux/.gitignore: -------------------------------------------------------------------------------- 1 | mavlink_udp 2 | -------------------------------------------------------------------------------- /examples/linux/README.md: -------------------------------------------------------------------------------- 1 | # MAVLink UDP Quickstart Instructions 2 | 3 | MAVLink UDP Example for *nix system (Linux, MacOS, BSD, etc.) 4 | 5 | To compile with GCC, just enter: 6 | 7 | ``` 8 | gcc -std=c99 -I ../../include/common -o mavlink_udp mavlink_udp.c 9 | ``` 10 | 11 | The MAVLink header directory must be added to the include path, as shown above. 12 | Be sure to use version 2.0 of the MAVLink headers for this example 13 | as the example uses MAVLink 2 extension fields. 14 | 15 | To run, type: 16 | 17 | ``` 18 | ./mavlink_udp 19 | ``` 20 | 21 | If you run *QGroundControl* on the same machine, checkout received message in MAVLink Inspector widget. 22 | -------------------------------------------------------------------------------- /examples/linux/mavlink_udp.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (C) 2010 Bryan Godbolt godbolt ( a t ) ualberta.ca 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | ****************************************************************************/ 18 | /* 19 | This program sends some data to qgroundcontrol using the mavlink protocol. The sent packets 20 | cause qgroundcontrol to respond with heartbeats. Any settings or custom commands sent from 21 | qgroundcontrol are printed by this program along with the heartbeats. 22 | 23 | 24 | I compiled this program sucessfully on Ubuntu 10.04 with the following command 25 | 26 | gcc -I ../../pixhawk/mavlink/include -o udp-server udp-server-test.c 27 | 28 | the rt library is needed for the clock_gettime on linux 29 | */ 30 | /* These headers are for QNX, but should all be standard on unix/linux */ 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #if (defined __QNX__) | (defined __QNXNTO__) 42 | /* QNX specific headers */ 43 | #include 44 | #else 45 | /* Linux / MacOS POSIX timer headers */ 46 | #include 47 | #include 48 | #include 49 | #include /* required for the definition of bool in C99 */ 50 | #endif 51 | 52 | /* This assumes you have the mavlink headers on your include path 53 | or in the same folder as this source file */ 54 | #include 55 | 56 | 57 | #define BUFFER_LENGTH 2041 // minimum buffer size that can be used with qnx (I don't know why) 58 | 59 | uint64_t microsSinceEpoch(); 60 | 61 | int main(int argc, char* argv[]) 62 | { 63 | 64 | char help[] = "--help"; 65 | 66 | 67 | char target_ip[100]; 68 | 69 | float position[6] = {}; 70 | int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); 71 | struct sockaddr_in gcAddr; 72 | struct sockaddr_in locAddr; 73 | //struct sockaddr_in fromAddr; 74 | uint8_t buf[BUFFER_LENGTH]; 75 | ssize_t recsize; 76 | socklen_t fromlen = sizeof(gcAddr); 77 | int bytes_sent; 78 | mavlink_message_t msg; 79 | uint16_t len; 80 | int i = 0; 81 | //int success = 0; 82 | unsigned int temp = 0; 83 | 84 | // Check if --help flag was used 85 | if ((argc == 2) && (strcmp(argv[1], help) == 0)) 86 | { 87 | printf("\n"); 88 | printf("\tUsage:\n\n"); 89 | printf("\t"); 90 | printf("%s", argv[0]); 91 | printf(" \n"); 92 | printf("\tDefault for localhost: udp-server 127.0.0.1\n\n"); 93 | exit(EXIT_FAILURE); 94 | } 95 | 96 | 97 | // Change the target ip if parameter was given 98 | strcpy(target_ip, "127.0.0.1"); 99 | if (argc == 2) 100 | { 101 | strcpy(target_ip, argv[1]); 102 | } 103 | 104 | 105 | memset(&locAddr, 0, sizeof(locAddr)); 106 | locAddr.sin_family = AF_INET; 107 | locAddr.sin_addr.s_addr = INADDR_ANY; 108 | locAddr.sin_port = htons(14551); 109 | 110 | /* Bind the socket to port 14551 - necessary to receive packets from qgroundcontrol */ 111 | if (-1 == bind(sock,(struct sockaddr *)&locAddr, sizeof(struct sockaddr))) 112 | { 113 | perror("error bind failed"); 114 | close(sock); 115 | exit(EXIT_FAILURE); 116 | } 117 | 118 | /* Attempt to make it non blocking */ 119 | #if (defined __QNX__) | (defined __QNXNTO__) 120 | if (fcntl(sock, F_SETFL, O_NONBLOCK | FASYNC) < 0) 121 | #else 122 | if (fcntl(sock, F_SETFL, O_NONBLOCK | O_ASYNC) < 0) 123 | #endif 124 | 125 | { 126 | fprintf(stderr, "error setting nonblocking: %s\n", strerror(errno)); 127 | close(sock); 128 | exit(EXIT_FAILURE); 129 | } 130 | 131 | 132 | memset(&gcAddr, 0, sizeof(gcAddr)); 133 | gcAddr.sin_family = AF_INET; 134 | gcAddr.sin_addr.s_addr = inet_addr(target_ip); 135 | gcAddr.sin_port = htons(14550); 136 | 137 | 138 | 139 | for (;;) 140 | { 141 | 142 | /*Send Heartbeat */ 143 | mavlink_msg_heartbeat_pack(1, 200, &msg, MAV_TYPE_HELICOPTER, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE); 144 | len = mavlink_msg_to_send_buffer(buf, &msg); 145 | bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in)); 146 | 147 | /* Send Status */ 148 | mavlink_msg_sys_status_pack(1, 200, &msg, 0, 0, 0, 500, 11000, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0); 149 | len = mavlink_msg_to_send_buffer(buf, &msg); 150 | bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof (struct sockaddr_in)); 151 | 152 | /* Send Local Position */ 153 | mavlink_msg_local_position_ned_pack(1, 200, &msg, microsSinceEpoch(), 154 | position[0], position[1], position[2], 155 | position[3], position[4], position[5]); 156 | len = mavlink_msg_to_send_buffer(buf, &msg); 157 | bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in)); 158 | 159 | /* Send attitude */ 160 | mavlink_msg_attitude_pack(1, 200, &msg, microsSinceEpoch(), 1.2, 1.7, 3.14, 0.01, 0.02, 0.03); 161 | len = mavlink_msg_to_send_buffer(buf, &msg); 162 | bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in)); 163 | 164 | 165 | memset(buf, 0, BUFFER_LENGTH); 166 | recsize = recvfrom(sock, (void *)buf, BUFFER_LENGTH, 0, (struct sockaddr *)&gcAddr, &fromlen); 167 | if (recsize > 0) 168 | { 169 | // Something received - print out all bytes and parse packet 170 | mavlink_message_t msg; 171 | mavlink_status_t status; 172 | 173 | printf("Bytes Received: %d\nDatagram: ", (int)recsize); 174 | for (i = 0; i < recsize; ++i) 175 | { 176 | temp = buf[i]; 177 | printf("%02x ", (unsigned char)temp); 178 | if (mavlink_parse_char(MAVLINK_COMM_0, buf[i], &msg, &status)) 179 | { 180 | // Packet received 181 | printf("\nReceived packet: SYS: %d, COMP: %d, LEN: %d, MSG ID: %d\n", msg.sysid, msg.compid, msg.len, msg.msgid); 182 | } 183 | } 184 | printf("\n"); 185 | } 186 | memset(buf, 0, BUFFER_LENGTH); 187 | sleep(1); // Sleep one second 188 | } 189 | } 190 | 191 | 192 | /* QNX timer version */ 193 | #if (defined __QNX__) | (defined __QNXNTO__) 194 | uint64_t microsSinceEpoch() 195 | { 196 | 197 | struct timespec time; 198 | 199 | uint64_t micros = 0; 200 | 201 | clock_gettime(CLOCK_REALTIME, &time); 202 | micros = (uint64_t)time.tv_sec * 1000000 + time.tv_nsec/1000; 203 | 204 | return micros; 205 | } 206 | #else 207 | uint64_t microsSinceEpoch() 208 | { 209 | 210 | struct timeval tv; 211 | 212 | uint64_t micros = 0; 213 | 214 | gettimeofday(&tv, NULL); 215 | micros = ((uint64_t)tv.tv_sec) * 1000000 + tv.tv_usec; 216 | 217 | return micros; 218 | } 219 | #endif 220 | -------------------------------------------------------------------------------- /mavgenerate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """\ 3 | mavgenerate.py is a GUI front-end for mavgen, a python based MAVLink 4 | header generation tool. 5 | 6 | Notes: 7 | ----- 8 | * 2012-7-16 -- dagoodman 9 | Working on Mac 10.6.8 darwin, with Python 2.7.1 10 | 11 | * 2012-7-17 -- dagoodman 12 | Only GUI code working on Mac 10.6.8 darwin, with Python 3.2.3 13 | Working on Windows 7 SP1, with Python 2.7.3 and 3.2.3 14 | Mavgen doesn't work with Python 3.x yet 15 | 16 | * 2012-9-25 -- dagoodman 17 | Passing error limit into mavgen to make output cleaner. 18 | 19 | Copyright 2012 David Goodman (dagoodman@soe.ucsc.edu) 20 | Released under GNU GPL version 3 or later 21 | 22 | """ 23 | import os 24 | import re 25 | import sys 26 | 27 | # Python 2.x and 3.x compatibility 28 | if sys.version_info[0] == 3: 29 | from tkinter import * 30 | import tkinter.filedialog 31 | import tkinter.messagebox 32 | else: 33 | # Must be using Python 2.x, import and rename 34 | from Tkinter import * 35 | import tkFileDialog 36 | import tkMessageBox 37 | 38 | tkinter.filedialog = tkFileDialog 39 | del tkFileDialog 40 | tkinter.messagebox = tkMessageBox 41 | del tkMessageBox 42 | 43 | 44 | from pymavlink.generator import mavgen 45 | from pymavlink.generator import mavparse 46 | 47 | title = "MAVLink Generator" 48 | error_limit = 5 49 | 50 | 51 | class Application(Frame): 52 | def __init__(self, master=None): 53 | Frame.__init__(self, master) 54 | self.pack_propagate(0) 55 | self.grid( sticky=N+S+E+W) 56 | self.createWidgets() 57 | 58 | """\ 59 | Creates the gui and all of its content. 60 | """ 61 | def createWidgets(self): 62 | 63 | 64 | #---------------------------------------- 65 | # Create the XML entry 66 | 67 | self.xml_value = StringVar() 68 | self.xml_label = Label( self, text="XML" ) 69 | self.xml_label.grid(row=0, column = 0) 70 | self.xml_entry = Entry( self, width = 26, textvariable=self.xml_value ) 71 | self.xml_entry.grid(row=0, column = 1) 72 | self.xml_button = Button (self, text="Browse", command=self.browseXMLFile) 73 | self.xml_button.grid(row=0, column = 2) 74 | 75 | #---------------------------------------- 76 | # Create the Out entry 77 | 78 | self.out_value = StringVar() 79 | self.out_label = Label( self, text="Out" ) 80 | self.out_label.grid(row=1,column = 0) 81 | self.out_entry = Entry( self, width = 26, textvariable=self.out_value ) 82 | self.out_entry.grid(row=1, column = 1) 83 | self.out_button = Button (self, text="Browse", command=self.browseOutDirectory) 84 | self.out_button.grid(row=1, column = 2) 85 | 86 | #---------------------------------------- 87 | # Create the Lang box 88 | 89 | self.language_value = StringVar() 90 | self.language_choices = mavgen.supportedLanguages 91 | self.language_label = Label( self, text="Language" ) 92 | self.language_label.grid(row=2, column=0) 93 | self.language_menu = OptionMenu(self,self.language_value,*self.language_choices) 94 | self.language_value.set(mavgen.DEFAULT_LANGUAGE) 95 | self.language_menu.config(width=10) 96 | self.language_menu.grid(row=2, column=1,sticky=W) 97 | 98 | #---------------------------------------- 99 | # Create the Protocol box 100 | 101 | self.protocol_value = StringVar() 102 | self.protocol_choices = [mavparse.PROTOCOL_1_0, mavparse.PROTOCOL_2_0] 103 | self.protocol_label = Label( self, text="Protocol") 104 | self.protocol_label.grid(row=3, column=0) 105 | self.protocol_menu = OptionMenu(self,self.protocol_value,*self.protocol_choices) 106 | self.protocol_value.set(mavgen.DEFAULT_WIRE_PROTOCOL) 107 | self.protocol_menu.config(width=10) 108 | self.protocol_menu.grid(row=3, column=1,sticky=W) 109 | 110 | #---------------------------------------- 111 | # Create the Validate box 112 | 113 | self.validate_value = BooleanVar() 114 | self.validate_label = Label( self, text="Validate") 115 | self.validate_label.grid(row=4, column=0) 116 | self.validate_button = Checkbutton(self, variable=self.validate_value, onvalue=True, offvalue=False) 117 | self.validate_value.set(mavgen.DEFAULT_VALIDATE) 118 | self.validate_button.config(width=10) 119 | self.validate_button.grid(row=4, column=1,sticky=W) 120 | 121 | #---------------------------------------- 122 | # Create the Validate Units box 123 | 124 | self.strict_units_value = BooleanVar() 125 | self.strict_units_label = Label( self, text="Validate Units") 126 | self.strict_units_label.grid(row=5, column=0) 127 | self.strict_units_button = Checkbutton(self, variable=self.strict_units_value, onvalue=True, offvalue=False) 128 | self.strict_units_value.set(mavgen.DEFAULT_STRICT_UNITS) 129 | self.strict_units_button.config(width=10) 130 | self.strict_units_button.grid(row=5, column=1,sticky=W) 131 | 132 | #---------------------------------------- 133 | # Create the generate button 134 | 135 | self.generate_button = Button ( self, text="Generate", command=self.generateHeaders) 136 | self.generate_button.grid(row=6,column=1) 137 | 138 | """\ 139 | Open a file selection window to choose the XML message definition. 140 | """ 141 | def browseXMLFile(self): 142 | # TODO Allow specification of multiple XML definitions 143 | xml_file = tkinter.filedialog.askopenfilename(parent=self, title='Choose a definition file') 144 | if xml_file != None: 145 | self.xml_value.set(xml_file) 146 | 147 | """\ 148 | Open a directory selection window to choose an output directory for 149 | headers. 150 | """ 151 | def browseOutDirectory(self): 152 | mavlinkFolder = os.path.dirname(os.path.realpath(__file__)) 153 | out_dir = tkinter.filedialog.askdirectory(parent=self,initialdir=mavlinkFolder,title='Please select an output directory') 154 | if out_dir != None: 155 | self.out_value.set(out_dir) 156 | 157 | """\ 158 | Generates the header files and place them in the output directory. 159 | """ 160 | def generateHeaders(self): 161 | # Verify settings 162 | rex = re.compile(".*\\.xml$", re.IGNORECASE) 163 | if not self.xml_value.get(): 164 | tkinter.messagebox.showerror('Error Generating Headers','An XML message definition file must be specified.') 165 | return 166 | 167 | if not self.out_value.get(): 168 | tkinter.messagebox.showerror('Error Generating Headers', 'An output directory must be specified.') 169 | return 170 | 171 | 172 | if os.path.isdir(self.out_value.get()): 173 | if not tkinter.messagebox.askokcancel('Overwrite Headers?','The output directory \'{0}\' already exists. Headers may be overwritten if they already exist.'.format(self.out_value.get())): 174 | return 175 | 176 | # Generate headers 177 | opts = mavgen.Opts(self.out_value.get(), wire_protocol=self.protocol_value.get(), language=self.language_value.get(), validate=self.validate_value.get(), error_limit=error_limit, strict_units=self.strict_units_value.get()); 178 | args = [self.xml_value.get()] 179 | try: 180 | mavgen.mavgen(opts,args) 181 | tkinter.messagebox.showinfo('Successfully Generated Headers', 'Headers generated successfully.') 182 | 183 | except Exception as ex: 184 | exStr = formatErrorMessage(str(ex)); 185 | tkinter.messagebox.showerror('Error Generating Headers','{0!s}'.format(exStr)) 186 | return 187 | 188 | """\ 189 | Format the mavgen exceptions by removing 'ERROR: '. 190 | """ 191 | def formatErrorMessage(message): 192 | reObj = re.compile(r'^(ERROR):\s+',re.M); 193 | matches = re.findall(reObj, message); 194 | prefix = ("An error occurred in mavgen:" if len(matches) == 1 else "Errors occurred in mavgen:\n") 195 | message = re.sub(reObj, '\n', message); 196 | 197 | return prefix + message 198 | 199 | 200 | # End of Application class 201 | # --------------------------------- 202 | 203 | # --------------------------------- 204 | # Start 205 | 206 | if __name__ == '__main__': 207 | app = Application() 208 | app.master.title(title) 209 | app.mainloop() 210 | -------------------------------------------------------------------------------- /message_definitions/v1.0/ASLUAV.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | common.xml 6 | 7 | 8 | 9 | 10 | Mission command to reset Maximum Power Point Tracker (MPPT) 11 | MPPT number 12 | Empty 13 | Empty 14 | Empty 15 | Empty 16 | Empty 17 | Empty 18 | 19 | 20 | Mission command to perform a power cycle on payload 21 | Complete power cycle 22 | VISensor power cycle 23 | Empty 24 | Empty 25 | Empty 26 | Empty 27 | Empty 28 | 29 | 30 | 31 | 32 | no service 33 | 34 | 35 | link type unknown 36 | 37 | 38 | 2G (GSM/GRPS/EDGE) link 39 | 40 | 41 | 3G link (WCDMA/HSDPA/HSPA) 42 | 43 | 44 | 4G link (LTE) 45 | 46 | 47 | 48 | 49 | not specified 50 | 51 | 52 | HUAWEI LTE USB Stick E3372 53 | 54 | 55 | 56 | 57 | 58 | Message encoding a command with parameters as scaled integers and additional metadata. Scaling depends on the actual command value. 59 | UTC time, seconds elapsed since 01.01.1970 60 | Microseconds elapsed since vehicle boot 61 | System ID 62 | Component ID 63 | The coordinate system of the COMMAND, as defined by MAV_FRAME enum 64 | The scheduled action for the mission item, as defined by MAV_CMD enum 65 | false:0, true:1 66 | autocontinue to next wp 67 | PARAM1, see MAV_CMD enum 68 | PARAM2, see MAV_CMD enum 69 | PARAM3, see MAV_CMD enum 70 | PARAM4, see MAV_CMD enum 71 | PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 72 | PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 73 | PARAM7 / z position: global: altitude in meters (MSL, WGS84, AGL or relative to home - depending on frame). 74 | 75 | 76 | Send a command with up to seven parameters to the MAV and additional metadata 77 | UTC time, seconds elapsed since 01.01.1970 78 | Microseconds elapsed since vehicle boot 79 | System which should execute the command 80 | Component which should execute the command, 0 for all components 81 | Command ID, as defined by MAV_CMD enum. 82 | 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) 83 | Parameter 1, as defined by MAV_CMD enum. 84 | Parameter 2, as defined by MAV_CMD enum. 85 | Parameter 3, as defined by MAV_CMD enum. 86 | Parameter 4, as defined by MAV_CMD enum. 87 | Parameter 5, as defined by MAV_CMD enum. 88 | Parameter 6, as defined by MAV_CMD enum. 89 | Parameter 7, as defined by MAV_CMD enum. 90 | 91 | 92 | Voltage and current sensor data 93 | Power board voltage sensor reading 94 | Power board current sensor reading 95 | Board current sensor 1 reading 96 | Board current sensor 2 reading 97 | 98 | 99 | Maximum Power Point Tracker (MPPT) sensor data for solar module power performance tracking 100 | MPPT last timestamp 101 | MPPT1 voltage 102 | MPPT1 current 103 | MPPT1 pwm 104 | MPPT1 status 105 | MPPT2 voltage 106 | MPPT2 current 107 | MPPT2 pwm 108 | MPPT2 status 109 | MPPT3 voltage 110 | MPPT3 current 111 | MPPT3 pwm 112 | MPPT3 status 113 | 114 | 115 | ASL-fixed-wing controller data 116 | Timestamp 117 | ASLCTRL control-mode (manual, stabilized, auto, etc...) 118 | See sourcecode for a description of these values... 119 | 120 | 121 | Pitch angle 122 | Pitch angle reference 123 | 124 | 125 | 126 | 127 | 128 | 129 | Airspeed reference 130 | 131 | Yaw angle 132 | Yaw angle reference 133 | Roll angle 134 | Roll angle reference 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | ASL-fixed-wing controller debug data 144 | Debug data 145 | Debug data 146 | Debug data 147 | Debug data 148 | Debug data 149 | Debug data 150 | Debug data 151 | Debug data 152 | Debug data 153 | Debug data 154 | Debug data 155 | 156 | 157 | Extended state information for ASLUAVs 158 | Status of the position-indicator LEDs 159 | Status of the IRIDIUM satellite communication system 160 | Status vector for up to 8 servos 161 | Motor RPM 162 | 163 | 164 | 165 | Extended EKF state estimates for ASLUAVs 166 | Time since system start 167 | Magnitude of wind velocity (in lateral inertial plane) 168 | Wind heading angle from North 169 | Z (Down) component of inertial wind velocity 170 | Magnitude of air velocity 171 | Sideslip angle 172 | Angle of attack 173 | 174 | 175 | Off-board controls/commands for ASLUAVs 176 | Time since system start 177 | Elevator command [~] 178 | Throttle command [~] 179 | Throttle 2 command [~] 180 | Left aileron command [~] 181 | Right aileron command [~] 182 | Rudder command [~] 183 | Off-board computer status 184 | 185 | 186 | Atmospheric sensors (temperature, humidity, ...) 187 | Time since system boot 188 | Ambient temperature 189 | Relative humidity 190 | 191 | 192 | Battery pack monitoring data for Li-Ion batteries 193 | Time since system start 194 | Battery pack temperature 195 | Battery pack voltage 196 | Battery pack current 197 | Battery pack state-of-charge 198 | Battery monitor status report bits in Hex 199 | Battery monitor serial number in Hex 200 | Battery monitor safetystatus report bits in Hex 201 | Battery monitor operation status report bits in Hex 202 | Battery pack cell 1 voltage 203 | Battery pack cell 2 voltage 204 | Battery pack cell 3 voltage 205 | Battery pack cell 4 voltage 206 | Battery pack cell 5 voltage 207 | Battery pack cell 6 voltage 208 | 209 | 210 | Fixed-wing soaring (i.e. thermal seeking) data 211 | Timestamp 212 | Timestamp since last mode change 213 | Thermal core updraft strength 214 | Thermal radius 215 | Thermal center latitude 216 | Thermal center longitude 217 | Variance W 218 | Variance R 219 | Variance Lat 220 | Variance Lon 221 | Suggested loiter radius 222 | Suggested loiter direction 223 | Distance to soar point 224 | Expected sink rate at current airspeed, roll and throttle 225 | Measurement / updraft speed at current/local airplane position 226 | Measurement / roll angle tracking error 227 | Expected measurement 1 228 | Expected measurement 2 229 | Thermal drift (from estimator prediction step only) 230 | Thermal drift (from estimator prediction step only) 231 | Total specific energy change (filtered) 232 | Debug variable 1 233 | Debug variable 2 234 | Control Mode [-] 235 | Data valid [-] 236 | 237 | 238 | Monitoring of sensorpod status 239 | Timestamp in linuxtime (since 1.1.1970) 240 | Rate of ROS topic 1 241 | Rate of ROS topic 2 242 | Rate of ROS topic 3 243 | Rate of ROS topic 4 244 | Number of recording nodes 245 | Temperature of sensorpod CPU in 246 | Free space available in recordings directory in [Gb] * 1e2 247 | 248 | 249 | Monitoring of power board status 250 | Timestamp 251 | Power board status register 252 | Power board leds status 253 | Power board system voltage 254 | Power board servo voltage 255 | Power board digital voltage 256 | Power board left motor current sensor 257 | Power board right motor current sensor 258 | Power board analog current sensor 259 | Power board digital current sensor 260 | Power board extension current sensor 261 | Power board aux current sensor 262 | 263 | 264 | Status of GSM modem (connected to onboard computer) 265 | Timestamp (of OBC) 266 | GSM modem used 267 | GSM link type 268 | RSSI as reported by modem (unconverted) 269 | RSRP (LTE) or RSCP (WCDMA) as reported by modem (unconverted) 270 | SINR (LTE) or ECIO (WCDMA) as reported by modem (unconverted) 271 | RSRQ (LTE only) as reported by modem (unconverted) 272 | 273 | 274 | 275 | Status of the SatCom link 276 | Timestamp 277 | Timestamp of the last successful sbd session 278 | Number of failed sessions 279 | Number of successful sessions 280 | Signal quality 281 | Ring call pending 282 | Transmission session pending 283 | Receiving session pending 284 | 285 | 286 | Calibrated airflow angle measurements 287 | Timestamp 288 | Angle of attack 289 | Angle of attack measurement valid 290 | Sideslip angle 291 | Sideslip angle measurement valid 292 | 293 | 294 | 295 | -------------------------------------------------------------------------------- /message_definitions/v1.0/AVSSUAS.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | common.xml 10 | 2 11 | 1 12 | 13 | 14 | 15 | 16 | AVSS defined command. Set PRS arm statuses. 17 | PRS arm statuses 18 | User defined 19 | User defined 20 | User defined 21 | User defined 22 | User defined 23 | User defined 24 | 25 | 26 | AVSS defined command. Gets PRS arm statuses 27 | User defined 28 | User defined 29 | User defined 30 | User defined 31 | User defined 32 | User defined 33 | User defined 34 | 35 | 36 | AVSS defined command. Get the PRS battery voltage in millivolts 37 | User defined 38 | User defined 39 | User defined 40 | User defined 41 | User defined 42 | User defined 43 | User defined 44 | 45 | 46 | AVSS defined command. Get the PRS error statuses. 47 | User defined 48 | User defined 49 | User defined 50 | User defined 51 | User defined 52 | User defined 53 | User defined 54 | 55 | 56 | AVSS defined command. Set the ATS arming altitude in meters. 57 | ATS arming altitude 58 | User defined 59 | User defined 60 | User defined 61 | User defined 62 | User defined 63 | User defined 64 | 65 | 66 | AVSS defined command. Get the ATS arming altitude in meters. 67 | User defined 68 | User defined 69 | User defined 70 | User defined 71 | User defined 72 | User defined 73 | User defined 74 | 75 | 76 | AVSS defined command. Shuts down the PRS system. 77 | User defined 78 | User defined 79 | User defined 80 | User defined 81 | User defined 82 | User defined 83 | User defined 84 | 85 | 86 | 87 | 88 | AVSS defined command failure reason. PRS not steady. 89 | 90 | 91 | AVSS defined command failure reason. PRS DTM not armed. 92 | 93 | 94 | AVSS defined command failure reason. PRS OTM not armed. 95 | 96 | 97 | 98 | 99 | In manual control mode 100 | 101 | 102 | In attitude mode 103 | 104 | 105 | In GPS mode 106 | 107 | 108 | In hotpoint mode 109 | 110 | 111 | In assisted takeoff mode 112 | 113 | 114 | In auto takeoff mode 115 | 116 | 117 | In auto landing mode 118 | 119 | 120 | In go home mode 121 | 122 | 123 | In sdk control mode 124 | 125 | 126 | In sport mode 127 | 128 | 129 | In force auto landing mode 130 | 131 | 132 | In tripod mode 133 | 134 | 135 | In search mode 136 | 137 | 138 | In engine mode 139 | 140 | 141 | 142 | 143 | In manual control mode 144 | 145 | 146 | In auto takeoff mode 147 | 148 | 149 | In auto landing mode 150 | 151 | 152 | In go home mode 153 | 154 | 155 | In drop mode 156 | 157 | 158 | 159 | 160 | 161 | AVSS PRS system status. 162 | Timestamp (time since PRS boot). 163 | PRS error statuses 164 | Estimated battery run-time without a remote connection and PRS battery voltage 165 | PRS arm statuses 166 | PRS battery charge statuses 167 | 168 | 169 | Drone position. 170 | Timestamp (time since FC boot). 171 | Latitude, expressed 172 | Longitude, expressed 173 | Altitude (MSL). Note that virtually all GPS modules provide both WGS84 and MSL. 174 | Altitude above ground, This altitude is measured by a ultrasound, Laser rangefinder or millimeter-wave radar 175 | This altitude is measured by a barometer 176 | 177 | 178 | Drone IMU data. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). 179 | Timestamp (time since FC boot). 180 | Quaternion component 1, w (1 in null-rotation) 181 | Quaternion component 2, x (0 in null-rotation) 182 | Quaternion component 3, y (0 in null-rotation) 183 | Quaternion component 4, z (0 in null-rotation) 184 | X acceleration 185 | Y acceleration 186 | Z acceleration 187 | Angular speed around X axis 188 | Angular speed around Y axis 189 | Angular speed around Z axis 190 | 191 | 192 | Drone operation mode. 193 | Timestamp (time since FC boot). 194 | DJI M300 operation mode 195 | horsefly operation mode 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /message_definitions/v1.0/all.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ardupilotmega.xml 4 | 8 | ASLUAV.xml 9 | common.xml 10 | development.xml 11 | icarous.xml 12 | 13 | 14 | minimal.xml 15 | 16 | 17 | python_array_test.xml 18 | standard.xml 19 | test.xml 20 | ualberta.xml 21 | uAvionix.xml 22 | 26 | loweheiser.xml 27 | 31 | storm32.xml 32 | 36 | AVSSUAS.xml 37 | 41 | cubepilot.xml 42 | csAirLink.xml 43 | 47 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /message_definitions/v1.0/csAirLink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 3 8 | 9 | 10 | 11 | Login or password error 12 | 13 | 14 | Auth successful 15 | 16 | 17 | 18 | 19 | 20 | Authorization package 21 | Login 22 | Password 23 | 24 | 25 | Response to the authorization request 26 | Response type 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /message_definitions/v1.0/cubepilot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | common.xml 8 | 9 | 10 | Raw RC Data 11 | 12 | 13 | 14 | Information about video stream 15 | Video Stream ID (1 for first, 2 for second, etc.) 16 | Number of streams available. 17 | Frame rate. 18 | Horizontal resolution. 19 | Vertical resolution. 20 | Bit rate. 21 | Video image rotation clockwise. 22 | Video stream URI (TCP or RTSP URI ground station should connect to) or port number (UDP port ground station should listen to). 23 | 24 | 25 | Herelink Telemetry 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Start firmware update with encapsulated data. 36 | System ID. 37 | Component ID. 38 | FW Size. 39 | FW CRC. 40 | 41 | 42 | offset response to encapsulated data. 43 | System ID. 44 | Component ID. 45 | FW Offset. 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /message_definitions/v1.0/icarous.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ICAROUS heartbeat 26 | See the FMS_STATE enum. 27 | 28 | 29 | Kinematic multi bands (track) output from Daidalus 30 | Number of track bands 31 | See the TRACK_BAND_TYPES enum. 32 | min angle (degrees) 33 | max angle (degrees) 34 | See the TRACK_BAND_TYPES enum. 35 | min angle (degrees) 36 | max angle (degrees) 37 | See the TRACK_BAND_TYPES enum. 38 | min angle (degrees) 39 | max angle (degrees) 40 | See the TRACK_BAND_TYPES enum. 41 | min angle (degrees) 42 | max angle (degrees) 43 | See the TRACK_BAND_TYPES enum. 44 | min angle (degrees) 45 | max angle (degrees) 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /message_definitions/v1.0/loweheiser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | minimal.xml 9 | 10 | 11 | 12 | 13 | Set Loweheiser desired states 14 | EFI Index 15 | Desired Engine/EFI State (0: Power Off, 1:Running) 16 | Desired Governor State (0:manual throttle, 1:Governed throttle) 17 | Manual throttle level, 0% - 100% 18 | Electronic Start up (0:Off, 1:On) 19 | Empty 20 | Empty 21 | 22 | 23 | 24 | 25 | 26 | Composite EFI and Governor data from Loweheiser equipment. This message is created by the EFI unit based on its own data and data received from a governor attached to that EFI unit. 27 | 28 | Generator Battery voltage. 29 | Generator Battery current. 30 | Current being produced by generator. 31 | Load current being consumed by the UAV (sum of curr_gen and curr_batt) 32 | Generator fuel remaining in litres. 33 | Throttle Output. 34 | Seconds this generator has run since it was rebooted. 35 | Seconds until this generator requires maintenance. A negative value indicates maintenance is past due. 36 | The Temperature of the rectifier. 37 | The temperature of the mechanical motor, fuel cell core or generator. 38 | 39 | EFI Supply Voltage. 40 | Motor RPM. 41 | Injector pulse-width in miliseconds. 42 | Fuel flow rate in litres/hour. 43 | Fuel consumed. 44 | Atmospheric pressure. 45 | Manifold Air Temperature. 46 | Cylinder Head Temperature. 47 | Throttle Position. 48 | Exhaust gas temperature. 49 | 50 | EFI index. 51 | Generator status. 52 | EFI status. 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /message_definitions/v1.0/paparazzi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | common.xml 4 | 3 5 | 6 | 7 | 8 | 9 | 10 | Message encoding a mission script item. This message is emitted upon a request for the next script item. 11 | System ID 12 | Component ID 13 | Sequence 14 | The name of the mission script, NULL terminated. 15 | 16 | 17 | Request script item with the sequence number seq. The response of the system to this message should be a SCRIPT_ITEM message. 18 | System ID 19 | Component ID 20 | Sequence 21 | 22 | 23 | Request the overall list of mission items from the system/component. 24 | System ID 25 | Component ID 26 | 27 | 28 | This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV to get the number of mission scripts. 29 | System ID 30 | Component ID 31 | Number of script items in the sequence 32 | 33 | 34 | This message informs about the currently active SCRIPT. 35 | Active Sequence 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /message_definitions/v1.0/python_array_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | common.xml 5 | 6 | 7 | Array test #0. 8 | Stub field 9 | Value array 10 | Value array 11 | Value array 12 | Value array 13 | 14 | 15 | Array test #1. 16 | Value array 17 | 18 | 19 | Array test #3. 20 | Stub field 21 | Value array 22 | 23 | 24 | Array test #4. 25 | Value array 26 | Stub field 27 | 28 | 29 | Array test #5. 30 | Value array 31 | Value array 32 | 33 | 34 | Array test #6. 35 | Stub field 36 | Stub field 37 | Stub field 38 | Value array 39 | Value array 40 | Value array 41 | Value array 42 | Value array 43 | Value array 44 | Value array 45 | Value array 46 | Value array 47 | 48 | 49 | Array test #7. 50 | Value array 51 | Value array 52 | Value array 53 | Value array 54 | Value array 55 | Value array 56 | Value array 57 | Value array 58 | Value array 59 | 60 | 61 | Array test #8. 62 | Stub field 63 | Value array 64 | Value array 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /message_definitions/v1.0/standard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | common.xml 5 | 0 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /message_definitions/v1.0/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 5 | 6 | Test all field types 7 | char 8 | string 9 | uint8_t 10 | uint16_t 11 | uint32_t 12 | uint64_t 13 | int8_t 14 | int16_t 15 | int32_t 16 | int64_t 17 | float 18 | double 19 | uint8_t_array 20 | uint16_t_array 21 | uint32_t_array 22 | uint64_t_array 23 | int8_t_array 24 | int16_t_array 25 | int32_t_array 26 | int64_t_array 27 | float_array 28 | double_array 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /message_definitions/v1.0/uAvionix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | common.xml 8 | 9 | 10 | State flags for ADS-B transponder dynamic report 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Transceiver RF control flags for ADS-B transponder dynamic reports 19 | 20 | 21 | 22 | 23 | Status for ADS-B transponder dynamic input 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Status flags for ADS-B transponder dynamic output 33 | 34 | 35 | 36 | 37 | 38 | Definitions for aircraft size 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | GPS lataral offset encoding 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | GPS longitudinal offset encoding 69 | 70 | 71 | 72 | 73 | Emergency status encoding 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | State flags for ADS-B transponder dynamic report 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | State flags for X-Bit and reserved fields. 95 | 96 | 97 | 98 | State flags for ADS-B transponder status report 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | State flags for ADS-B transponder status report 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | State flags for ADS-B transponder fault report 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | Static data to configure the ADS-B transponder (send within 10 sec of a POR and every 10 sec thereafter) 145 | Vehicle address (24 bit) 146 | Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) 147 | Transmitting vehicle type. See ADSB_EMITTER_TYPE enum 148 | Aircraft length and width encoding (table 2-35 of DO-282B) 149 | GPS antenna lateral offset (table 2-36 of DO-282B) 150 | GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) 151 | Aircraft stall speed in cm/s 152 | ADS-B transponder reciever and transmit enable flags 153 | 154 | 155 | Dynamic data used to generate ADS-B out transponder data (send at 5Hz) 156 | UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX 157 | Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX 158 | Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX 159 | Altitude (WGS84). UP +ve. If unknown set to INT32_MAX 160 | 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK 161 | Number of satellites visible. If unknown set to UINT8_MAX 162 | Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX 163 | Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX 164 | Vertical accuracy in cm. If unknown set to UINT16_MAX 165 | Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX 166 | GPS vertical speed in cm/s. If unknown set to INT16_MAX 167 | North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX 168 | East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX 169 | Emergency status 170 | ADS-B transponder dynamic input state flags 171 | Mode A code (typically 1200 [0x04B0] for VFR) 172 | 173 | 174 | Transceiver heartbeat with health report (updated every 10s) 175 | ADS-B transponder messages 176 | 177 | 178 | Aircraft Registration. 179 | Aircraft Registration (ASCII string A-Z, 0-9 only), e.g. "N8644B ". Trailing spaces (0x20) only. This is null-terminated. 180 | 181 | 182 | Flight Identification for ADSB-Out vehicles. 183 | Flight Identification: 8 ASCII characters, '0' through '9', 'A' through 'Z' or space. Spaces (0x20) used as a trailing pad character, or when call sign is unavailable. Reflects Control message setting. This is null-terminated. 184 | 185 | 186 | Request messages. 187 | Message ID to request. Supports any message in this 10000-10099 range 188 | 189 | 190 | Control message with all data sent in UCP control message. 191 | ADS-B transponder control state flags 192 | Barometric pressure altitude (MSL) relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX 193 | Mode A code (typically 1200 [0x04B0] for VFR) 194 | Emergency status 195 | Flight Identification: 8 ASCII characters, '0' through '9', 'A' through 'Z' or space. Spaces (0x20) used as a trailing pad character, or when call sign is unavailable. 196 | X-Bit enable (military transponders only) 197 | 198 | 199 | Status message with information from UCP Heartbeat and Status messages. 200 | ADS-B transponder status state flags 201 | Mode A code (typically 1200 [0x04B0] for VFR) 202 | Integrity and Accuracy of traffic reported as a 4-bit value for each field (NACp 7:4, NIC 3:0) and encoded by Containment Radius (HPL) and Estimated Position Uncertainty (HFOM), respectively 203 | Board temperature in C 204 | ADS-B transponder fault flags 205 | Flight Identification: 8 ASCII characters, '0' through '9', 'A' through 'Z' or space. Spaces (0x20) used as a trailing pad character, or when call sign is unavailable. 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /message_definitions/v1.0/ualberta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | common.xml 4 | 5 | 6 | Available autopilot modes for ualberta uav 7 | 8 | Raw input pulse widts sent to output 9 | 10 | 11 | Inputs are normalized using calibration, the converted back to raw pulse widths for output 12 | 13 | 14 | dfsdfs 15 | 16 | 17 | dfsfds 18 | 19 | 20 | dfsdfsdfs 21 | 22 | 23 | 24 | Navigation filter mode 25 | 26 | 27 | AHRS mode 28 | 29 | 30 | INS/GPS initialization mode 31 | 32 | 33 | INS/GPS mode 34 | 35 | 36 | 37 | Mode currently commanded by pilot 38 | 39 | sdf 40 | 41 | 42 | dfs 43 | 44 | 45 | Rotomotion mode 46 | 47 | 48 | 49 | 50 | 51 | Accelerometer and Gyro biases from the navigation filter 52 | Timestamp (microseconds) 53 | b_f[0] 54 | b_f[1] 55 | b_f[2] 56 | b_f[0] 57 | b_f[1] 58 | b_f[2] 59 | 60 | 61 | Complete set of calibration parameters for the radio 62 | Aileron setpoints: left, center, right 63 | Elevator setpoints: nose down, center, nose up 64 | Rudder setpoints: nose left, center, nose right 65 | Tail gyro mode/gain setpoints: heading hold, rate mode 66 | Pitch curve setpoints (every 25%) 67 | Throttle curve setpoints (every 25%) 68 | 69 | 70 | System status specific to ualberta uav 71 | System mode, see UALBERTA_AUTOPILOT_MODE ENUM 72 | Navigation mode, see UALBERTA_NAV_MODE ENUM 73 | Pilot mode, see UALBERTA_PILOT_MODE 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | 4 | Name: @PROJECT_NAME@ 5 | Description: MAVLink micro air vehicle marshalling / communication library 6 | Version: @PROJECT_VERSION@ 7 | Cflags: -I@CMAKE_INSTALL_PREFIX@/include/@PROJECT_NAME@ 8 | -------------------------------------------------------------------------------- /scripts/format_xml.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # A POSIX variable 5 | OPTIND=1 # Reset in case getopts has been used previously in the shell. 6 | 7 | # Initialize variables 8 | mode="format" 9 | xml_dir="." 10 | keep_old=0 11 | 12 | while getopts "h?cd:o" opt; do 13 | case "$opt" in 14 | h|\?) 15 | show_help 16 | exit 0 17 | ;; 18 | c) mode="check" 19 | ;; 20 | d) xml_dir=${OPTARG} 21 | ;; 22 | o) keep_old=1 23 | ;; 24 | esac 25 | done 26 | 27 | shift $(($OPTIND - 1)) 28 | 29 | xml_file="$1" 30 | 31 | if [ "$xml_file" == "" ] 32 | then 33 | xml_files=$(find $xml_dir -name "*.xml") 34 | else 35 | xml_files="$xml_dir/$xml_file" 36 | fi 37 | echo "processing file(s) $xml_files" 38 | 39 | ret=0 40 | for f in $xml_files 41 | do 42 | xmllint -format "${f}" > "${f}".new 43 | case "$mode" in 44 | format) 45 | if ! cmp "${f}" "${f}".new >/dev/null 2>&1 46 | then 47 | echo "formatting $f" 48 | if [ $keep_old -eq 1 ] 49 | then 50 | cp "${f}" "${f}".old 51 | fi 52 | cp "${f}".new "${f}" 53 | fi 54 | ;; 55 | check) 56 | if ! cmp "${f}" "${f}".new >/dev/null 2>&1 57 | then 58 | echo "file $f needs formatting - run ./scripts/format_xml.sh $f" 59 | ret=1 60 | fi 61 | ;; 62 | esac 63 | rm "${f}".new 64 | done 65 | 66 | exit $ret 67 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | SRC_DIR=$(pwd) 5 | 6 | # NOTE: we must do all testing on the installed python package, not 7 | # on the build tree. Otherwise the testing is invalid and may not 8 | # indicate the code actually works 9 | 10 | test_format() { 11 | # check format 12 | sep="##############################################" 13 | echo $sep 14 | echo "FORMAT TEST" 15 | echo $sep 16 | cd "$SRC_DIR" 17 | ./scripts/format_xml.sh -c 18 | echo PASS 19 | } 20 | 21 | generate_mavlink() { 22 | echo $sep 23 | echo "GENERATING MAVLINK " \ 24 | "protocol:${wire_protocol} language:${lang}" 25 | echo "DEFINITION : " "$msg_def" 26 | echo $sep 27 | outdir="/tmp/mavlink_${wire_protocol}_${lang}" 28 | pymavlink/tools/mavgen.py --lang="${lang}" \ 29 | --wire-protocol "${wire_protocol}" \ 30 | --strict-units \ 31 | --output="${outdir}" "${msg_def}" 32 | echo PASS 33 | } 34 | 35 | test_py() { 36 | cd "$SRC_DIR" 37 | for msg_def in message_definitions/v1.0/*.xml 38 | do 39 | [ -e "$msg_def" ] || continue 40 | wire_protocol="1.0" 41 | for lang in Python C CS WLua Java 42 | do 43 | generate_mavlink 44 | done 45 | wire_protocol="2.0" 46 | for lang in Python C C++11 CS WLua Java 47 | do 48 | generate_mavlink 49 | done 50 | done 51 | } 52 | 53 | test_node() { 54 | # Avoid `spurious errors` caused by ~/.npm permission issues 55 | # ref: https://github.com/travis-ci/travis-ci/issues/2244 56 | # ref: https://github.com/npm/npm/issues/4815 57 | # Does it already exist? Who owns? What permissions? 58 | ls -lah ~/.npm || mkdir ~/.npm 59 | # Make sure we own it 60 | # $USER references the current user in Travis env 61 | chown -R "$USER" ~/.npm 62 | if [ -f /usr/bin/nodejs ] 63 | then 64 | mkdir -p ~/bin 65 | ln -sf /usr/bin/nodejs ~/bin/node 66 | . ~/.bashrc 67 | fi 68 | cd "$SRC_DIR/pymavlink/" && ./test_gen_js.sh 69 | cd "generator/javascript" && npm test 70 | } 71 | 72 | if [ "$#" -eq 1 ]; then 73 | if [ "$1" == "format" ]; then 74 | test_format 75 | elif [ "$1" == "py" ]; then 76 | test_py 77 | elif [ "$1" == "node" ]; then 78 | test_node 79 | else 80 | echo "Error: unknown argument '$1'" 81 | echo "" 82 | echo "Usage:" 83 | echo " $0 [py|node|format]" 84 | exit 1 85 | fi 86 | else 87 | test_format 88 | test_py 89 | test_node 90 | fi 91 | 92 | -------------------------------------------------------------------------------- /scripts/update_c_library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # c_library repository update script 4 | # Author: Thomas Gubler 5 | # 6 | # This script can be used together with a github webhook to automatically 7 | # generate new c header files and push to the c_library repository whenever 8 | # the message specifications are updated. 9 | # The script assumes that the git repositories in MAVLINK_GIT_PATH and 10 | # CLIBRARY_GIT_PATH are set up prior to invoking the script. 11 | # 12 | # Usage, for example: 13 | # cd ~/src 14 | # git clone git@github.com:mavlink/mavlink.git 15 | # cd mavlink 16 | # git remote rename origin upstream 17 | # mkdir -p include/mavlink/v1.0 18 | # cd include/mavlink/v1.0 19 | # git clone git@github.com:mavlink/c_library_v1.git 20 | # cd ~/src/mavlink 21 | # ./scripts/update_c_library.sh 1 22 | # 23 | # A one-liner for the TMP directory (e.g. for crontab) 24 | # cd /tmp; git clone git@github.com:mavlink/mavlink.git &> /dev/null; \ 25 | # cd /tmp/mavlink && git remote rename origin upstream &> /dev/null; \ 26 | # mkdir -p include/mavlink/v1.0 && cd include/mavlink/v1.0 && git clone git@github.com:mavlink/c_library_v1.git &> /dev/null; \ 27 | # cd /tmp/mavlink && ./scripts/update_c_library.sh &> /dev/null 28 | 29 | function generate_headers() { 30 | python pymavlink/tools/mavgen.py \ 31 | --output $CLIBRARY_PATH \ 32 | --lang C \ 33 | --wire-protocol $2.0 \ 34 | message_definitions/v1.0/$1.xml 35 | } 36 | 37 | # settings 38 | MAVLINK_PATH=$PWD 39 | MAVLINK_GIT_REMOTENAME=upstream 40 | MAVLINK_GIT_BRANCHNAME=master 41 | CLIBRARY_PATH=$MAVLINK_PATH/include/mavlink/v$1.0/c_library_v$1 42 | CLIBRARY_GIT_REMOTENAME=origin 43 | CLIBRARY_GIT_BRANCHNAME=master 44 | 45 | # fetch latest message specifications 46 | #cd $MAVLINK_PATH 47 | #git fetch $MAVLINK_GIT_REMOTENAME 48 | #git diff $MAVLINK_GIT_REMOTENAME/$MAVLINK_GIT_BRANCHNAME --exit-code 49 | #RETVAL=$? 50 | # if the diff value is zero nothing changed - abort 51 | #[ $RETVAL -eq 0 ] && exit 0 52 | #echo -e "\0033[34mFetching latest protocol specifications\0033[0m\n" 53 | #git pull $MAVLINK_GIT_REMOTENAME $MAVLINK_GIT_BRANCHNAME || exit 1 54 | 55 | # save git hash 56 | MAVLINK_GITHASH=$(git rev-parse HEAD) 57 | 58 | # delete old c headers 59 | rm -rf $CLIBRARY_PATH/* 60 | 61 | # generate new c headers 62 | echo -e "\0033[34mStarting to generate c headers\0033[0m\n" 63 | generate_headers development $1 64 | generate_headers ardupilotmega $1 65 | generate_headers matrixpilot $1 66 | generate_headers test $1 67 | generate_headers ASLUAV $1 68 | generate_headers standard $1 69 | mkdir -p $CLIBRARY_PATH/message_definitions 70 | cp message_definitions/v1.0/* $CLIBRARY_PATH/message_definitions/. 71 | echo -e "\0033[34mFinished generating c headers\0033[0m\n" 72 | 73 | # git add and git commit in local c_library repository 74 | cd $CLIBRARY_PATH 75 | git add --all :/ || exit 1 76 | COMMIT_MESSAGE="autogenerated headers for rev https://github.com/mavlink/mavlink/tree/"$MAVLINK_GITHASH 77 | git commit -m "$COMMIT_MESSAGE" || exit 0 # for the case when nothing is there to commit 78 | 79 | # push to c_library repository 80 | git push $CLIBRARY_GIT_REMOTENAME $CLIBRARY_GIT_BRANCHNAME || exit 1 81 | echo -e "\0033[34mHeaders updated and pushed successfully\0033[0m" 82 | -------------------------------------------------------------------------------- /scripts/update_generated_repos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Config for auto-building 4 | git remote rename origin upstream 5 | git config --global user.email "bot@pixhawk.org" 6 | git config --global user.name "PX4BuildBot" 7 | git config --global credential.helper "store --file=$HOME/.git-credentials" 8 | echo "https://${GH_TOKEN}:@github.com" > "$HOME"/.git-credentials 9 | 10 | # Build C library 11 | GEN_START_PATH=$PWD 12 | mkdir -p include/mavlink/v2.0 13 | cd include/mavlink/v2.0 14 | git clone https://github.com/mavlink/c_library_v2.git 15 | cd ../../.. 16 | ./scripts/update_c_library.sh 2 17 | # v1.0 legacy 18 | cd "$GEN_START_PATH" 19 | mkdir -p include/mavlink/v1.0 20 | cd include/mavlink/v1.0 21 | git clone https://github.com/mavlink/c_library_v1.git 22 | cd ../../.. 23 | ./scripts/update_c_library.sh 1 24 | --------------------------------------------------------------------------------