0

我对 Mission Planner 中的自动 NAMED_VALUE_FLOAT 处理有一个小问题。

根据:https ://github.com/ArduPilot/MissionPlanner/pull/2360应该很容易在 Quickview 中显示 NAMED_VALUE_FLOAT。所以这是我的设置:

  • Mission Planner 作为地面控制站 (GCS) (SysId: 255, CompID: 0)
  • Pixhawk 立方体作为自动驾驶仪(用于调试通过 USB 连接到 GCS)(SysId:1,Comp:0 和 1)
  • ArduinoUno作为副机(连接到PX TELEM2,发送MavLink2 Heartbeat [1 Hz]和NAMED_VALUE_FLOAT [2 Hz]),代码如下,使用库:https ://github.com/mavlink/c_library_v2
#include<common\mavlink.h>
#include<mavlink_helpers.h>
#include<mavlink_types.h>
#include<minimal\mavlink_msg_heartbeat.h>

mavlink_system_t mavlink_system = {
    1, // System ID (1-255)
    2  // Component ID (a MAV_COMPONENT value)
};

uint16_t packed;
mavlink_message_t msg;
mavlink_message_t heartbeat;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
uint16_t len;
short i;
float debug;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200); 
  i = 0;
  debug = 0.0;
}

void loop() {
  // put your main code here, to run repeatedly:
  packed = mavlink_msg_named_value_float_pack(1, 2, &msg, millis(), "debug", debug);
  len = mavlink_msg_to_send_buffer(buf, &msg);
  Serial.write(buf, len);
  if(debug >= 100){
    debug = 0;
  }
  debug = debug + 0.5;
  if(i == 2){
    i = 0;
    packed = mavlink_msg_heartbeat_pack(1, 2, &heartbeat, 18, 3, 0, 0, 5);
    len = mavlink_msg_to_send_buffer(buf, &heartbeat);
    Serial.write(buf, len);
  }
  i = i + 1;
  delay(500);
}

默认情况下,Mission Planner 应该使用 customfield0 来处理我的调试值。那么我如何测试这个:

  • 我将 PX 与 PC 和 Mission Planner 连接
  • 我正在 Quickview 中检查我的调试字段是否存在(双击任何值并查找 MAV_DEBUG)[不应该存在] no_custom_field
  • 我正在连接 Arduino 并重复之前的检查 [字段可见] field_visible
  • 我正在选择我的领域 价值没有变化
  • 如果字段值发生变化,我的状态非常好

但我的值 MAV_DEBUG 始终为 0.0 是否需要更改任何内容才能正确显示此值?

4

0 回答 0