【无人机】地面站QGC:软件架构

本文详细介绍了QGC(一款开源地面站软件)的应用架构及其实现机制,包括软件版本信息、核心类QGCApplication的设计原理及其与qml的交互方式,为开发者提供了深入理解QGC内部工作原理的基础。

版本信息

软件 版本
QGC V3.4
Qt 5.11.0
Visual Studio 2015

软件架构

// main.cc内209行

QGCApplication* app = new QGCApplication(argc, argv, runUnitTests)

QGCApplication在QGCApplication.h内定义。

QGCApplication是QGC数据交互的主体,QGC将相关的类在其中构造并将App作为一个全局的静态变量通过qgcApp()来访问。

QGCApplication.cc内定义qgcApp()

/// @brief Returns the QGCApplication object singleton.
QGCApplication* qgcApp(void)
{
   
   
    return QGCApplication::_app;
}

在该类的QGCApplication_initCommon()实现名称为QGroundControlQmlGlobal的单例,也就是qml文件中常常看到的QgroundControl 1.0模块,通过该单例,可以在qml中访问C++的接口和一些属性信息。

void QGCApplication::_initCommon(void)
{
   
   
    QSettings settings;

    // Register our Qml objects

    qmlRegisterType<QGCPalette>     ("QGroundControl.Palette", 1, 0, "QGCPalette");
    qmlRegisterType<QGCMapPalette>  ("QGroundControl.Palette", 1, 0, "QGCMapPalette");

    qmlRegisterUncreatableType<CoordinateVector>    ("QGroundControl",                      1, 0, "CoordinateVector",       "Reference only");
    qmlRegisterUncreatableType<QmlObjectListModel>  ("QGroundControl",                      1, 0, "QmlObjectListModel",     "Reference only");
    qmlRegisterUncreatableType<MissionCommandTree>  ("QGroundControl",                      1, 0, "MissionCommandTree",     "Reference only");
    qmlRegisterUncreatableType<CameraCalc>          ("QGroundControl",                      1, 0, "CameraCalc",             "Reference only");

    qmlRegisterUncreatableType<AutoPilotPlugin>     ("QGroundControl.AutoPilotPlugin",      1, 0, "AutoPilotPlugin",        "Reference only");
    qmlRegisterUncreatableType<VehicleComponent>    ("QGroundControl.AutoPilotPlugin",      1, 0, "VehicleComponent",       "Reference only");
    qmlRegisterUncreatableType<Vehicle>             ("QGroundControl.Vehicle",              1, 0, "Vehicle",                "Reference only");
    qmlRegisterUncreatableType<MissionItem>         ("QGroundControl.Vehicle",              1, 0, "MissionItem",            "Reference only");
    qmlRegisterUncreatableType<MissionManager>      
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

望天边星宿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值