QGC开发环境搭建

源码获取&&模块安装&&问题解决
推荐的开发环境:
Windows10/11、Ubuntu20.04、Android{jdk11}
Qt Version:5.15.2
QGC Version:latest release version
参考QGC开发手册

获取源码:

克隆存储库(或您的分支),包括子模块:

1
git clone --recursive -j8 https://github.com/mavlink/qgroundcontrol.git

更新子模块(每次提取新源代码时都需要):

1
git submodule update --recursive

个别模块获取失败:libs/cpp/parse/nlohmann_json

1
git submodule update --init --recursive

出现 the untracked or modified content in submodules

进入该子模块目录,清理

1
2
git reset --hard HEAD
git clean -fxd

或者

1
git submodule foreach git reset --hard

参考:git submodules with modified and untracked content - why and how to remove it? - Stack Overflow


配置开发环境

开发环境(maybe QGC 4.0):
  • Windows: Vista or higher, Visual Studio 2017 compiler (64 bit)
  • Android: Jelly Bean (4.1) and higher.
    • Standard QGC is built against ndk version 19.
    • Java JDK 8 is required.
  • Qt version: t5.12 ~ 5.14
开发环境(QGC 4.2.8):
  • macOS: v10.11 or higher
  • Ubuntu: 64 bit, gcc compiler
  • Windows: Vista or higher, Visual Studio 2019 compiler (64 bit)
  • iOS: 10.0 and higher
  • Android: Jelly Bean (4.1) and higher.
    • Standard QGC is built against ndk version 19.
    • Java JDK 11 is required.
  • Qt version: 5.15.2 (only)
依赖
  • Ubuntu: sudo apt-get install speech-dispatcher libudev-dev libsdl2-dev patchelf build-essential curl libxcb-xinerama0 -y
  • Fedora: sudo dnf install speech-dispatcher SDL2-devel SDL2 systemd-devel patchelf
  • Arch Linux: pacman -Sy speech-dispatcher patchelf
  • Android: Qt Android Setup ;个人博客:配置Qt&Android开发环境

安装可选模块

相关配置在QGCExternalLibs.pri ,工程文件会检测是否安装进行条件编译

gstreamer

该模块提供视频流支持;

确认子模块存在

qgc代码目录libs/qmlglsink/gst-plugins-good克隆 https://github.com/mavlink/gst-plugins-good.git

下载 gstreamer 库

Windows/Android

下载地址:Download GStreamer

Linux

1
sudo apt-get install libgstreamer* -y

AirMap

仅Linux平台支持,可使用配置文件禁用

1
echo -e "DEFINES += DISABLE_AIRMAP\r\n" | tee user_config.pri

相关配置在QGCExternalLibs.pri [OPTIONAL] AirMap Support

自动下载失败可以手动下载,目录在 {构建目录}/libs/airmap-platform-sdk;可以使用迅雷下载后拷贝至该目录

1
2
sudo apt install curl
curl --location --output ./airmap-platform-sdk.deb https://github.com/airmap/platform-sdk/releases/download/2.0.1/airmap-platform-sdk-2.0.1-Linux-x86_64.deb

解压至tmp

1
ar p airmap-platform-sdk.deb data.tar.gz | tar xvz -C ./tmp/ --strip-components=1

拷贝

1
2
3
4
mv -u ./tmp/usr/lib/x86_64-linux-gnu/* ./linux/Qt.5.15/
mv -u ./tmp/usr/include/airmap/* ./include/airmap/
rm -rf ./tmp
rm ./airmap-platform-sdk.deb

最初的启动

ubuntu 需要执行如下命令

1
2
sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager

配置仿真环境

详见个人博客: QGC开发与调试

查阅PX4手册>开发>仿真

视频,模拟飞行;已搭建

多机控制;已搭建


Q&A

1.qmake error : sdl2 development package not found

1
sudo apt install libsdl2-dev

2.Linux 安装GStreamer后编译报错:g_once_init_enter ‘__atomic_load’ must not be a pointer to a ‘volatile’ type

解决方案:

删除错误处的 volatile 声明

相关链接:GCC 11 的构建错误(原子作为易失性和循环构造) ·问题 #9669 ·马夫林克/Q地面控制 ·GitHub

作者

tty

发布于

2023-05-09

更新于

2023-08-10

许可协议