【QGroundControl二次开发】四.QGC自定义MAVLink消息

【QGroundControl二次开发】一.开发环境准备(Windows)
【QGroundControl二次开发】二.使用QT编译QGC(Windows)
【QGroundControl二次开发】三.QGC修改标题和logo(Windows)

一. 环境准备

参考:MAVLink代码生成-C#

二. 生成新的MAVLINK协议

在MAVlink源码下找到message_definitions/common.xml,修改其中的内容。
例如:

<message id="12" name="DISTANCE_SENSOR">
      <description>Dedicated Raspberry PI Detects distance of the obstacle in front of the sensor</description>
      <field type="uint64_t" name="time_usec" units="us">Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.</field>
      <field type="uint8_t" name="sensor_type" enum="MAV_DISTANCE_SENSOR">Class id of the distance sensor type.</field>
      <field type="uint16_t[72]" name="distances" units="cm" invalid="[UINT16_MAX]">Distance of obstacles around the vehicle with index 0 corresponding to north + angle_offset, unless otherwise specified in the frame. A value of 0 is valid and means that the obstacle is practically touching the sensor. A value of max_distance +1 means no obstacle is present. A value of UINT16_MAX for unknown/not used. In a array element, one unit corresponds to 1cm.</field>
      <field type="uint8_t" name="increment" units="deg">Angular width in degrees of each array element. Increment direction is clockwise. This field is ignored if increment_f is non-zero.</field>
      <field type="uint16_t" name="min_distance" units="cm">Minimum distance the sensor can measure.</field>
      <field type="uint16_t" name="max_distance" units="cm">Maximum distance the sensor can measure.</field>
      <extensions/>
      <field type="float" name="increment_f" units="deg">Angular width in degrees of each array element as a float. If non-zero then this value is used instead of the uint8_t increment field. Positive is clockwise direction, negative is counter-clockwise.</field>
      <field type="float" name="angle_offset" units="deg">Relative angle offset of the 0-index element in the distances array. Value of 0 corresponds to forward. Positive is clockwise direction, negative is counter-clockwise.</field>
      <field type="uint8_t" name="frame" enum="MAV_FRAME">Coordinate frame of reference for the yaw rotation and offset of the sensor data. Defaults to MAV_FRAME_GLOBAL, which is north aligned. For body-mounted sensors use MAV_FRAME_BODY_FRD, which is vehicle front aligned.</field>
    </message>

在这里插入图片描述
使用mavgenerate编译成所需语言。

python -m mavgenerate

在这里插入图片描述
XMl: 选择刚才修改后的common.xml。
Out: 输出路径
点击Generate, 显示如下即为成功。

生成内容如下:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值