您的位置:首页 > 其它

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

2018-03-07 17:36 232 查看

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐