QGroundControl 自定义命令小工具的使用

Custom Command Widgets

  • 不用编译qgc的源码,仅仅需要编写一个QML UIs文件
  • 这个小工具窗口可以被加载,并且从重启之后仍然可以使用,而且不受操作系统的限制
  • 主要有两个用途 1查询显示(接收) 2自定义发送命令(mavlink message)

编写QML文件

import QtQuick 2.2

import QGroundControl.Controls      1.0
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controllers   1.0

Rectangle {
    anchors.fill:   parent
    color:          qgcPal.window

    CustomCommandWidgetController {
        id:         controller
        factPanel:  panel
    }

    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }

    Column {
        spacing: ScreenTools.defaultFontPixelHeight
       //Sending custom command(standarder custom)
       //定义一个按钮 用于发送命令
        QGCButton {
            //neme
            text: "Set Home to current position"
            // Arguments to CustomCommandWidgetController::sendCommand (MAVLink COMMAND_LONG)
            //   command id
            //   component id
            //   confirmation
            //   param 1-7
            onClicked: controller.sendCommand(179, 50, 0, 1, 0, 0, 0, 0, 0, 0) //send mavlink
        }

        //Parameter editors
        //设置一个文本框 用于设置参数
        // The FactTextField control is bound to the specified parameter. Note that there is no validation.
               FactTextField {
                   // The -1 signals default component id.
                   // You can replace it with a specific component id if you like
                   fact: controller.getParameterFact(-1, "MAV_SYS_ID")
               }
           }
}
参考文档

QGroundControl Developers Guide

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

一銤阳光

希望分享的内容对你有帮助

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

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

打赏作者

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

抵扣说明:

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

余额充值