支持Windows、Linux 使用过的环境:windows11、ubuntu20.04、银河麒麟V10(SP1) 2203 x86_64
Linux 1. 获取源码 1 2 3 4 5 6 7 8 # Dependencies sudo apt install python3-pip # Clone mavlink into the directory of your choice git clone https://github.com/mavlink/mavlink.git --recursive cd mavlink python3 -m pip install -r pymavlink/requirements.txt
2. 安装 1 2 cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=install cmake --build build --target install
头文件在 install/include
里
3. 构建示例 1 2 3 cd examples/c cmake -Bbuild -H. -DCMAKE_PREFIX_PATH=$(pwd)/../../install cmake --build build
1 python3 -m pymavlink.tools.mavgen --lang=C --wire-protocol=2.0 --output=./include/ message_definitions/v1.0/common.xml
Windows
安装Python 3.6+ Python for Windows
future 模块 pip3 install future
克隆源码 git clone https://github.com/mavlink/mavlink.git --recursive
可以直接双击 mavgenerate.py
运行,或者加入环境变量,使用命令行运行 python3 -m mavgenerate
官方手册:Install MAVLink · MAVLink Developer Guide