2025-04-28 12:25:20 +08:00
|
|
|
|
#include "XNATA04DataProcessor.h"
|
|
|
|
|
#include "XNATA04DataProcessor_p.h"
|
|
|
|
|
#include <XNCore/XNModelManager.h>
|
|
|
|
|
#include <XNCore/XNDDSManager.h>
|
|
|
|
|
#include <QMutexLocker>
|
2025-04-29 11:55:56 +08:00
|
|
|
|
#include <iostream>
|
2025-04-28 12:25:20 +08:00
|
|
|
|
|
|
|
|
|
XN_DLL_INITIALIZE(XNATA04DataProcessor)
|
|
|
|
|
XN_REGISTER_PARTICIPANT_BEGIN(XNATA04DataProcessor)
|
|
|
|
|
XN_PUBLISHTOPIC(XNSim::ATA04::Aerodynamics_input)
|
|
|
|
|
XN_PUBLISHTOPIC(XNSim::ATA04::WeightBalance_input)
|
|
|
|
|
XN_PUBLISHTOPIC(XNSim::ATA04::GroundHandling_input)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::WeightBalance_output, &XNATA04DataProcessor::OnWbOutput)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::GroundHandling_output, &XNATA04DataProcessor::OnGhOutput)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::Aerodynamics_output, &XNATA04DataProcessor::OnAeroOutput)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::Aerodynamics_heartbeat, &XNATA04DataProcessor::OnAeroHeartbeat)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::WeightBalance_heartbeat, &XNATA04DataProcessor::OnWbHeartbeat)
|
|
|
|
|
XN_SUBSCRIBETOPIC(XNSim::ATA04::GroundHandling_heartbeat, &XNATA04DataProcessor::OnGhHeartbeat)
|
|
|
|
|
XN_REGISTER_PARTICIPANT_END(XNATA04DataProcessor)
|
|
|
|
|
|
|
|
|
|
XNATA04DataProcessor::XNATA04DataProcessor(QObject *parent)
|
|
|
|
|
: XNModelObject(*new XNATA04DataProcessorPrivate(this), parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XNATA04DataProcessor::~XNATA04DataProcessor()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XNATA04DataProcessor::XNATA04DataProcessor(XNATA04DataProcessorPrivate &dd, QObject *parent)
|
|
|
|
|
: XNModelObject(dd, parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnInitialize()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
XNModelObject::OnInitialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnPrepareForExecute()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
XNModelObject::OnPrepareForExecute();
|
|
|
|
|
RegisterRTEventHandler("ATA04AeroInput", std::bind(&XNATA04DataProcessor::OnAeroInput, this,
|
|
|
|
|
std::placeholders::_1));
|
|
|
|
|
RegisterRTEventHandler(
|
|
|
|
|
"ATA04WbInput", std::bind(&XNATA04DataProcessor::OnWbInput, this, std::placeholders::_1));
|
|
|
|
|
RegisterRTEventHandler(
|
|
|
|
|
"ATA04GhInput", std::bind(&XNATA04DataProcessor::OnGhInput, this, std::placeholders::_1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::StepUpdate()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
XNModelObject::StepUpdate();
|
|
|
|
|
SendUdpData();
|
2025-04-28 16:41:21 +08:00
|
|
|
|
SendUdpTestData();
|
2025-04-28 12:25:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendUdpData()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
SendAeroOutput();
|
|
|
|
|
SendWbOutput();
|
|
|
|
|
SendGhOutput();
|
|
|
|
|
SendAeroHeartbeat();
|
|
|
|
|
SendWbHeartbeat();
|
|
|
|
|
SendGhHeartbeat();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendAeroOutput()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_aeroOutputMutex);
|
|
|
|
|
QByteArray outputData;
|
|
|
|
|
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
|
|
|
|
outputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x00, 0x01, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
outputStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
//outputData.append(getQByteArray(d->_aeroOutput.l_04_o_aerocomac_fxb_f8()));
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_fxb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_fxb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_fyb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_fyb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_fzb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_fzb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_mxb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_mxb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_myb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_myb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_mzb_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_mzb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cls_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cls_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cl_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cl_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cd_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cd_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cm_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cm_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cr_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cr_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cy_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cy_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (d->_aeroOutput.l_04_o_aerocomac_cn_f8()) {
|
|
|
|
|
outputStream << d->_aeroOutput.l_04_o_aerocomac_cn_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = outputData.size();
|
|
|
|
|
outputData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
outputData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendGhOutput()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_ghOutputMutex);
|
|
|
|
|
QByteArray outputData;
|
|
|
|
|
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
|
|
|
|
outputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x01, 0x01, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
outputStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_frz_l1()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_frz_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_ac_on_ground_l1()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_ac_on_ground_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_ac_stationary_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_ac_stationary_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_alt_tire_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_alt_tire_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_zcg_to_tire_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_zcg_to_tire_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_fxb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_fxb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_fyb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_fyb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_fzb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_fzb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_mxb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_mxb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_myb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_myb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_mzb_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_mzb_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_fygs_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_fygs_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_mzgs_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_mzgs_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_mu_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_mu_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_dstroke_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_dstroke_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_sr_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_sr_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_sy_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_sy_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_sx_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_sx_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_xft_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_xft_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_yft_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_yft_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_zft_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_zft_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_distngrxcg_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_distngrxcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_distmgrxcg_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_distmgrxcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_distmgrzcg_f8()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_distmgrzcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_tire_vel_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_vel_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_tire_temp_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_temp_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_tire_burst_l1()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_burst_l1().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_wow_l1()) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_wow_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_utirew_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_utirew_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_vtirew_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_vtirew_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_whl_omega_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_whl_omega_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_dstruc_f8()) {
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_dstruc_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_nd_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_nd_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_wor_par_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_wor_par_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_ghOutput.l_04_o_gdcomac_vczt_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
outputStream << d->_ghOutput.l_04_o_gdcomac_vczt_f8().value()[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = outputData.size();
|
|
|
|
|
outputData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
outputData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendWbOutput()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_wbOutputMutex);
|
|
|
|
|
QByteArray outputData;
|
|
|
|
|
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
|
|
|
|
outputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x02, 0x01, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
outputStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_gw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_gw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_cg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_cg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_xcg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_xcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_blcg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_blcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_bscg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_bscg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_wlcg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_wlcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ixx_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ixx_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_iyy_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_iyy_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_izz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_izz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ixy_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ixy_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ixz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ixz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_iyz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_iyz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zfw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zfwcg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zfwcg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zfw_blcg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_blcg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zfw_wlcg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_wlcg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_cmd_f8()) {
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_cmd_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_mode_i4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_mode_i4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (int)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixx_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixx_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixy_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixy_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_iyy_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_iyy_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_iyz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_iyz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_fuel_izz_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_izz_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_l_wt_fuel_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_l_wt_fuel_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_airframe_total_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_airframe_total_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_eng_f8()) {
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_eng_f8().value()[i];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0 << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_eng_total_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_eng_total_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_fuselage_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_fuselage_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_left_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_left_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_right_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_right_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_total_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_total_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_total_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_total_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_total_frac_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_total_frac_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_vert_tail_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_vert_tail_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_left_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_left_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_right_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_right_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_total_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_total_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_frz_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_frz_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zcgfrz_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zcgfrz_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_zcgfrz_grfx_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_zcgfrz_grfx_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_ycgfrz_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_ycgfrz_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_inertfrz_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_inertfrz_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_init_l1()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_init_l1().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (quint8)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_min_gw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_min_gw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_max_gw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_max_gw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_min_cg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_min_cg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_max_cg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_max_cg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_min_zfw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_min_zfw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_max_zfw_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_max_zfw_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_min_zfwcg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_min_zfwcg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_max_zfwcg_f4()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_max_zfwcg_f4().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (float)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_potmin_gw_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_potmin_gw_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_potmax_gw_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_potmax_gw_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_potmin_gwcg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_potmin_gwcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
|
|
|
|
if (d->_wbOutput.l_04_o_wbcomac_potmax_gwcg_f8()) {
|
|
|
|
|
outputStream << d->_wbOutput.l_04_o_wbcomac_potmax_gwcg_f8().value();
|
|
|
|
|
} else {
|
|
|
|
|
outputStream << (double)0;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = outputData.size();
|
|
|
|
|
outputData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
outputData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendAeroHeartbeat()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_aeroHeartbeatMutex);
|
|
|
|
|
QByteArray heartbeatData;
|
|
|
|
|
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
|
|
|
|
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x00, 0x02, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
heartbeatStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
heartbeatStream << d->_aeroHeartbeat.aero_model_heartbeat();
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = heartbeatData.size();
|
|
|
|
|
heartbeatData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
heartbeatData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendGhHeartbeat()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_ghHeartbeatMutex);
|
|
|
|
|
QByteArray heartbeatData;
|
|
|
|
|
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
|
|
|
|
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x01, 0x02, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
heartbeatStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
heartbeatStream << d->_ghHeartbeat.groundhandling_model_heartbeat();
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = heartbeatData.size();
|
|
|
|
|
heartbeatData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
heartbeatData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendWbHeartbeat()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_wbHeartbeatMutex);
|
|
|
|
|
QByteArray heartbeatData;
|
|
|
|
|
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
|
|
|
|
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 header[6] = {0x0a, 0x04, 0x02, 0x02, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
heartbeatStream << header[0] << header[1] << header[2] << header[3] << header[4] << header[5];
|
2025-04-28 12:25:20 +08:00
|
|
|
|
heartbeatStream << d->_wbHeartbeat.weightbody_model_heartbeat();
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
auto size = heartbeatData.size();
|
|
|
|
|
heartbeatData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
heartbeatData[5] = size & 0xFF; // 低字节
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnWbInput(const QVariant &data)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QByteArray inputData = data.toByteArray();
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
|
|
|
|
// 检查数据包头
|
|
|
|
|
if (inputData[0] != 0x0b || inputData[1] != 0x04 || inputData[2] != 0x02
|
|
|
|
|
|| inputData[3] != 0x00) {
|
|
|
|
|
LOG_WARNING("ATA04DataProcessor::OnWbInput: invalid input data header");
|
2025-04-28 12:25:20 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
|
|
|
|
// 读取两个字节的大小字段
|
|
|
|
|
quint16 size = ((quint16)(quint8)inputData[4] << 8) | (quint16)(quint8)inputData[5];
|
|
|
|
|
if (size != inputData.size()) {
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
"ATA04DataProcessor::OnWbInput: invalid data size. Expected %d bytes, got %d bytes",
|
|
|
|
|
size, inputData.size());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
|
|
|
|
inputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream.setVersion(QDataStream::Qt_6_0);
|
|
|
|
|
|
|
|
|
|
// 跳过6字节的头
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
2025-04-28 12:25:20 +08:00
|
|
|
|
char tmp;
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QMutexLocker locker(&d->_wbInputMutex);
|
|
|
|
|
double dTmp;
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_theta_deg_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_phi_deg_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_psi_deg_f8(dTmp);
|
|
|
|
|
quint8 ucTmp;
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_gear_mode_l1(ucTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_gw_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_cg_f8(dTmp);
|
|
|
|
|
std::array<float, 20> farray20;
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
inputStream >> farray20[i];
|
|
|
|
|
}
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_tankfuel_f4(farray20);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_totfuel_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_zfw_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_acset_zfwcg_f8(dTmp);
|
|
|
|
|
std::array<char, 4> ucarray4;
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
inputStream >> ucarray4[i];
|
|
|
|
|
}
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_eng_efsep_l1(ucarray4);
|
|
|
|
|
std::array<double, 20> darray20;
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
inputStream >> darray20[i];
|
|
|
|
|
}
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_fuel_f8(darray20);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_gear_avg_f8(dTmp);
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
inputStream >> darray20[i];
|
|
|
|
|
}
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_kice_f8(darray20);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_bycglim_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_bygwlim_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_frz_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_zcgfrz_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_zcgfrz_grfx_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_ycgfrz_l1(ucTmp);
|
|
|
|
|
inputStream >> ucTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_inertfrz_l1(ucTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_potreq_gw_f8(dTmp);
|
|
|
|
|
inputStream >> dTmp;
|
|
|
|
|
d->_wbInput.l_04_i_wbcomac_potreq_gwcg_f8(dTmp);
|
|
|
|
|
d->_dataWriters["XNSim::ATA04::WeightBalance_input"]->write(&d->_wbInput);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnGhInput(const QVariant &data)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QByteArray inputData = data.toByteArray();
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
|
|
|
|
// 检查数据包头
|
|
|
|
|
if (inputData[0] != 0x0b || inputData[1] != 0x04 || inputData[2] != 0x01
|
|
|
|
|
|| inputData[3] != 0x00) {
|
|
|
|
|
LOG_WARNING("ATA04DataProcessor::OnGhInput: invalid input data header");
|
2025-04-28 12:25:20 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
|
|
|
|
// 读取两个字节的大小字段
|
|
|
|
|
quint16 size = ((quint16)(quint8)inputData[4] << 8) | (quint16)(quint8)inputData[5];
|
|
|
|
|
if (size != inputData.size()) {
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
"ATA04DataProcessor::OnGhInput: invalid data size. Expected %d bytes, got %d bytes",
|
|
|
|
|
size, inputData.size());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
|
|
|
|
inputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream.setVersion(QDataStream::Qt_6_0);
|
|
|
|
|
|
|
|
|
|
// 跳过6字节的头
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
2025-04-28 12:25:20 +08:00
|
|
|
|
char tmp;
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QMutexLocker locker(&d->_ghInputMutex);
|
|
|
|
|
quint8 uchartmp;
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_frz_l1(uchartmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_chocks_l1(uchartmp);
|
|
|
|
|
double doubleTmp;
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_alt_agl_f8(doubleTmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_frzflt_l1(uchartmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_p_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_q_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_r_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_ug_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_vg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_wg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_blcg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_bscg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_wlcg_f8(doubleTmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_pb_active_l1(uchartmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_pb_towforce_f8(doubleTmp);
|
|
|
|
|
std::array<std::array<double, 2>, 3> tmpArray32;
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
inputStream >> tmpArray32[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_brake_torq_f8(tmpArray32);
|
|
|
|
|
std::array<double, 3> tmpArray3;
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
inputStream >> tmpArray3[i];
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_gear_f8(tmpArray3);
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
inputStream >> tmpArray3[i];
|
|
|
|
|
}
|
|
|
|
|
std::array<double, 10> tmpArray10;
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
inputStream >> tmpArray10[i];
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_gsteer_f8(tmpArray10);
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
inputStream >> tmpArray32[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_tire_pres_f8(tmpArray32);
|
|
|
|
|
std::array<double, 4> tmpArray4;
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
inputStream >> tmpArray4[i];
|
|
|
|
|
}
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_onjax_l1(uchartmp);
|
|
|
|
|
std::array<double, 7> tmpArray7;
|
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
|
inputStream >> tmpArray7[i];
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_contdep_f8(tmpArray7);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_thetag_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_phig_f8(doubleTmp);
|
|
|
|
|
qint32 intTmp;
|
|
|
|
|
inputStream >> intTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_rwyrgh_i2(intTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_rwyhdg_f8(doubleTmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_reset_braketemp_l1(uchartmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_reset_tirepress_l1(uchartmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_temp_c_f8(doubleTmp);
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
inputStream >> tmpArray32[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_brake_temp_f8(tmpArray32);
|
|
|
|
|
std::array<std::array<char, 2>, 3> tmpArray322;
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
inputStream >> tmpArray322[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_tire_tburst_l1(tmpArray322);
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
inputStream >> tmpArray322[i][j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_tire_tflat_l1(tmpArray322);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_brk_reset_tpres_l1(uchartmp);
|
|
|
|
|
std::array<double, 14> tmpArray14;
|
|
|
|
|
for (int i = 0; i < 14; i++) {
|
|
|
|
|
inputStream >> tmpArray14[i];
|
|
|
|
|
}
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_rcon_ci_f8(tmpArray14);
|
|
|
|
|
inputStream >> intTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_gsteer_state_i4(intTmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_trim_active_l1(uchartmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_phi_deg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_theta_deg_f8(doubleTmp);
|
|
|
|
|
inputStream >> doubleTmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_psi_deg_f8(doubleTmp);
|
|
|
|
|
inputStream >> uchartmp;
|
|
|
|
|
d->_ghInput.l_04_i_gdcomac_resetint_l1(uchartmp);
|
|
|
|
|
d->_dataWriters["XNSim::ATA04::GroundHandling_input"]->write(&d->_ghInput);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnAeroInput(const QVariant &data)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QByteArray inputData = data.toByteArray();
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 现在我们知道数据包确实以0b 04 00开头
|
|
|
|
|
if (inputData[0] != 0x0b || inputData[1] != 0x04 || inputData[2] != 0x00
|
|
|
|
|
|| inputData[3] != 0x00) {
|
|
|
|
|
LOG_WARNING("ATA04DataProcessor::OnAeroInput: invalid input data");
|
2025-04-28 16:41:21 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 读取两个字节的大小字段
|
|
|
|
|
quint16 size = ((quint16)(quint8)inputData[4] << 8) | (quint16)(quint8)inputData[5];
|
|
|
|
|
if (size != inputData.size()) {
|
|
|
|
|
LOG_WARNING(
|
|
|
|
|
"ATA04DataProcessor::OnAeroInput: invalid data size. Expected %1 bytes, got %2 bytes",
|
|
|
|
|
size, inputData.size());
|
2025-04-28 12:25:20 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 使用与发送方相同版本的QDataStream读取数据
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
|
|
|
|
inputStream.setByteOrder(QDataStream::LittleEndian);
|
2025-04-28 16:41:21 +08:00
|
|
|
|
inputStream.setVersion(QDataStream::Qt_6_0);
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 跳过6字节的头
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
2025-04-28 12:25:20 +08:00
|
|
|
|
char tmp;
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
}
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
2025-04-28 12:25:20 +08:00
|
|
|
|
QMutexLocker locker(&d->_aeroInputMutex);
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 尝试读取数据,并添加异常处理
|
|
|
|
|
try {
|
|
|
|
|
double tmp;
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_alpha_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_alpdot_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_beta_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_press_alt_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_tas_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_mach_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_nx_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_ny_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_nz_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_p_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_q_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_r_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_qbar_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_blcg_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_bscg_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_wlcg_f8(tmp);
|
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_stab_f8(tmp);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
|
|
|
|
// ail_f8 (10个double)
|
|
|
|
|
std::array<double, 10> ailArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 10; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> ailArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_ail_f8(ailArray);
|
|
|
|
|
|
|
|
|
|
// elv_f8 (4个double)
|
|
|
|
|
std::array<double, 4> elvArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> elvArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_elv_f8(elvArray);
|
|
|
|
|
|
|
|
|
|
// rud_f8 (2个double)
|
|
|
|
|
std::array<double, 2> rudArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 2; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> rudArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_rud_f8(rudArray);
|
|
|
|
|
|
|
|
|
|
// gear_f8 (7个double)
|
|
|
|
|
std::array<double, 7> gearArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 7; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> gearArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_gear_f8(gearArray);
|
|
|
|
|
|
|
|
|
|
// flap_f8 (10个double)
|
|
|
|
|
std::array<double, 10> flapArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 10; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> flapArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_flap_f8(flapArray);
|
|
|
|
|
|
|
|
|
|
// slat_f8 (20个double)
|
|
|
|
|
std::array<double, 20> slatArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> slatArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_slat_f8(slatArray);
|
|
|
|
|
|
|
|
|
|
// spl_f8 (20个double)
|
|
|
|
|
std::array<double, 20> splArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> splArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_spl_f8(splArray);
|
|
|
|
|
|
|
|
|
|
// tnet_f8 (4个double)
|
|
|
|
|
std::array<double, 4> tnetArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> tnetArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_tnet_f8(tnetArray);
|
|
|
|
|
|
|
|
|
|
// kice_f8 (20个double)
|
|
|
|
|
std::array<double, 20> kiceArray;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
inputStream >> kiceArray[i];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
2025-04-29 11:55:56 +08:00
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_kice_f8(kiceArray);
|
|
|
|
|
|
2025-04-28 16:41:21 +08:00
|
|
|
|
inputStream >> tmp;
|
|
|
|
|
d->_aeroInput.l_04_i_aerocomac_alt_agl_f8(tmp);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
2025-04-28 16:41:21 +08:00
|
|
|
|
d->_dataWriters["XNSim::ATA04::Aerodynamics_input"]->write(&d->_aeroInput);
|
|
|
|
|
} catch (const std::exception &e) {
|
|
|
|
|
LOG_WARNING("ATA04DataProcessor::OnAeroInput: exception during data parsing: %s", e.what());
|
|
|
|
|
return;
|
|
|
|
|
} catch (...) {
|
|
|
|
|
LOG_WARNING("ATA04DataProcessor::OnAeroInput: unknown exception during data parsing");
|
|
|
|
|
return;
|
2025-04-28 12:25:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnWbOutput(const XNSim::ATA04::WeightBalance_output &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_wbOutputMutex);
|
|
|
|
|
d->_wbOutput = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnGhOutput(const XNSim::ATA04::GroundHandling_output &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_ghOutputMutex);
|
|
|
|
|
d->_ghOutput = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnAeroOutput(const XNSim::ATA04::Aerodynamics_output &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_aeroOutputMutex);
|
|
|
|
|
d->_aeroOutput = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnAeroHeartbeat(const XNSim::ATA04::Aerodynamics_heartbeat &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_aeroHeartbeatMutex);
|
|
|
|
|
d->_aeroHeartbeat = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnWbHeartbeat(const XNSim::ATA04::WeightBalance_heartbeat &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_wbHeartbeatMutex);
|
|
|
|
|
d->_wbHeartbeat = input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::OnGhHeartbeat(const XNSim::ATA04::GroundHandling_heartbeat &input)
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
QMutexLocker locker(&d->_ghHeartbeatMutex);
|
|
|
|
|
d->_ghHeartbeat = input;
|
|
|
|
|
}
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
void XNATA04DataProcessor::SendUdpTestData()
|
|
|
|
|
{
|
|
|
|
|
Q_D(XNATA04DataProcessor);
|
|
|
|
|
|
|
|
|
|
// 创建气动输入(AeroInput)数据包
|
|
|
|
|
QByteArray aeroData;
|
|
|
|
|
QDataStream aeroStream(&aeroData, QIODevice::WriteOnly);
|
|
|
|
|
aeroStream.setByteOrder(QDataStream::LittleEndian);
|
|
|
|
|
aeroStream.setVersion(QDataStream::Qt_6_0);
|
|
|
|
|
|
|
|
|
|
// 气动输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x00=气动模型, 0x00=输入数据)
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 aeroHeader[6] = {0x0b, 0x04, 0x00, 0x00, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
aeroStream << aeroHeader[0] << aeroHeader[1] << aeroHeader[2] << aeroHeader[3] << aeroHeader[4]
|
|
|
|
|
<< aeroHeader[5];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 气动数据字段
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)-2.0; // alpha
|
|
|
|
|
aeroStream << (double)0.0; // alpdot
|
|
|
|
|
aeroStream << (double)0.0; // beta
|
2025-04-28 16:41:21 +08:00
|
|
|
|
aeroStream << (double)10000.0; // press_alt
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)360.0; // tas
|
|
|
|
|
aeroStream << (double)0.3; // mach
|
|
|
|
|
aeroStream << (double)0.0; // nx
|
2025-04-28 16:41:21 +08:00
|
|
|
|
aeroStream << (double)0.0; // ny
|
|
|
|
|
aeroStream << (double)1.0; // nz
|
|
|
|
|
aeroStream << (double)0.0; // p
|
|
|
|
|
aeroStream << (double)0.0; // q
|
|
|
|
|
aeroStream << (double)0.0; // r
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)110.0; // qbar
|
2025-04-28 16:41:21 +08:00
|
|
|
|
aeroStream << (double)0.0; // blcg
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)650.0; // bscg
|
|
|
|
|
aeroStream << (double)7.0; // wlcg
|
|
|
|
|
aeroStream << (double)-2.0; // stab
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// ail_f8 数组,需要10个double
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
aeroStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// elv_f8 数组,需要4个double
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
aeroStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// rud_f8 数组,需要2个double
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
|
aeroStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gear_f8 数组,需要7个double
|
|
|
|
|
for (int i = 0; i < 7; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)1.0;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flap_f8 数组,需要10个double
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)41.5;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// slat_f8 数组,需要20个double
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)20.855;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// spl_f8 数组,需要20个double
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
aeroStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// tnet_f8 数组,需要4个double
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)8000.0;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// kice_f8 数组,需要20个double
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
aeroStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// alt_agl
|
2025-04-29 11:55:56 +08:00
|
|
|
|
aeroStream << (double)2500.0;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
quint16 size = aeroData.size();
|
|
|
|
|
aeroData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
aeroData[5] = size & 0xFF; // 低字节
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 创建地面操作输入(GhInput)数据包
|
|
|
|
|
QByteArray ghData;
|
|
|
|
|
QDataStream ghStream(&ghData, QIODevice::WriteOnly);
|
|
|
|
|
ghStream.setByteOrder(QDataStream::LittleEndian);
|
|
|
|
|
ghStream.setVersion(QDataStream::Qt_6_0);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
2025-04-28 16:41:21 +08:00
|
|
|
|
// 地面操作输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x01=地面操作模型, 0x00=输入数据)
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 ghHeader[6] = {0x0b, 0x04, 0x01, 0x00, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
ghStream << ghHeader[0] << ghHeader[1] << ghHeader[2] << ghHeader[3] << ghHeader[4]
|
|
|
|
|
<< ghHeader[5];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 地面操作数据字段
|
|
|
|
|
ghStream << (quint8)0; // frz_l1
|
|
|
|
|
ghStream << (quint8)0; // chocks_l1
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)8.0; // alt_agl_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (quint8)0; // frzflt_l1
|
|
|
|
|
ghStream << (double)0.0; // p_f8
|
|
|
|
|
ghStream << (double)0.0; // q_f8
|
|
|
|
|
ghStream << (double)0.0; // r_f8
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)50.0; // ug_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (double)0.0; // vg_f8
|
|
|
|
|
ghStream << (double)0.0; // wg_f8
|
|
|
|
|
ghStream << (double)0.0; // blcg_f8
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)649.3; // bscg_f8
|
|
|
|
|
ghStream << (double)10.0; // wlcg_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (quint8)0; // pb_active_l1
|
|
|
|
|
ghStream << (double)0.0; // pb_towforce_f8
|
|
|
|
|
|
|
|
|
|
// brake_torq_f8 数组 3x2
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
ghStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gear_f8 数组,需要3个double
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)1.0;
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gsteer_f8 数组,需要10个double
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
ghStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// tire_pres_f8 数组 3x2
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
if (i == 0) {
|
|
|
|
|
ghStream << (double)98.0; // 98 kpa的胎压
|
|
|
|
|
} else {
|
|
|
|
|
ghStream << (double)140.0; // 140 kpa的胎压
|
|
|
|
|
}
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4个double数组
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
ghStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ghStream << (quint8)0; // onjax_l1
|
|
|
|
|
|
|
|
|
|
// contdep_f8 数组,需要7个double
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)1.0;
|
|
|
|
|
for (int i = 1; i < 7; i++) {
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ghStream << (double)0.0; // thetag_f8
|
|
|
|
|
ghStream << (double)0.0; // phig_f8
|
|
|
|
|
ghStream << (qint32)0; // rwyrgh_i2
|
|
|
|
|
ghStream << (double)0.0; // rwyhdg_f8
|
|
|
|
|
ghStream << (quint8)0; // reset_braketemp_l1
|
|
|
|
|
ghStream << (quint8)0; // reset_tirepress_l1
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)16.0; // temp_c_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// brake_temp_f8 数组 3x2
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)16.0; // 16度的刹车温度
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// tire_tburst_l1 数组 3x2
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
ghStream << (char)0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// tire_tflat_l1 数组 3x2
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
|
ghStream << (char)0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ghStream << (quint8)0; // brk_reset_tpres_l1
|
|
|
|
|
|
|
|
|
|
// rcon_ci_f8 数组,需要14个double
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (double)1.0;
|
|
|
|
|
for (int i = 1; i < 14; i++) {
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (qint32)2; // gsteer_state_i4
|
|
|
|
|
ghStream << (quint8)1; // trim_active_l1
|
2025-04-28 16:41:21 +08:00
|
|
|
|
ghStream << (double)0.0; // phi_deg_f8
|
|
|
|
|
ghStream << (double)0.0; // theta_deg_f8
|
|
|
|
|
ghStream << (double)0.0; // psi_deg_f8
|
2025-04-29 11:55:56 +08:00
|
|
|
|
ghStream << (quint8)1; // resetint_l1
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
size = ghData.size();
|
|
|
|
|
ghData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
ghData[5] = size & 0xFF; // 低字节
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 创建重量平衡输入(WbInput)数据包
|
|
|
|
|
QByteArray wbData;
|
|
|
|
|
QDataStream wbStream(&wbData, QIODevice::WriteOnly);
|
|
|
|
|
wbStream.setByteOrder(QDataStream::LittleEndian);
|
|
|
|
|
wbStream.setVersion(QDataStream::Qt_6_0);
|
2025-04-29 11:55:56 +08:00
|
|
|
|
|
2025-04-28 16:41:21 +08:00
|
|
|
|
// 重量平衡输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x02=重量平衡模型, 0x00=输入数据)
|
2025-04-29 11:55:56 +08:00
|
|
|
|
quint8 wbHeader[6] = {0x0b, 0x04, 0x02, 0x00, 0x00, 0x00}; // 最后两个字节用于大小
|
|
|
|
|
wbStream << wbHeader[0] << wbHeader[1] << wbHeader[2] << wbHeader[3] << wbHeader[4]
|
|
|
|
|
<< wbHeader[5];
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 重量平衡数据字段
|
|
|
|
|
wbStream << (double)0.0; // theta_deg_f8
|
|
|
|
|
wbStream << (double)0.0; // phi_deg_f8
|
|
|
|
|
wbStream << (double)0.0; // psi_deg_f8
|
|
|
|
|
wbStream << (quint8)0; // gear_mode_l1
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)82574.0; // acset_gw_f8 (60000kg飞机重量)
|
|
|
|
|
wbStream << (double)0.1215; // acset_cg_f8 (25%MAC重心位置)
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// acset_tankfuel_f4 数组,需要20个float
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)(i < 2 ? 4541.0 : 0.0); // 前2个油箱各4541kg
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)9082.0; // acset_totfuel_f8 (总油量9082kg)
|
|
|
|
|
wbStream << (double)73492.0; // acset_zfw_f8 (零油重73492kg)
|
|
|
|
|
wbStream << (double)0.12; // acset_zfwcg_f8 (零油重重心24%MAC)
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// eng_efsep_l1 数组,需要4个char
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
wbStream << (char)0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fuel_f8 数组,需要20个double
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)(i < 2 ? 4541.0 : 0.0); // 前2个油箱各4541kg
|
2025-04-28 16:41:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)1.0; // gear_avg_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// kice_f8 数组,需要20个double
|
|
|
|
|
for (int i = 0; i < 20; i++) {
|
|
|
|
|
wbStream << (double)0.0;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (quint8)1; // bycglim_l1
|
|
|
|
|
wbStream << (quint8)1; // bygwlim_l1
|
2025-04-28 16:41:21 +08:00
|
|
|
|
wbStream << (quint8)0; // frz_l1
|
|
|
|
|
wbStream << (quint8)0; // zcgfrz_l1
|
|
|
|
|
wbStream << (quint8)0; // zcgfrz_grfx_l1
|
|
|
|
|
wbStream << (quint8)0; // ycgfrz_l1
|
|
|
|
|
wbStream << (quint8)0; // inertfrz_l1
|
2025-04-29 11:55:56 +08:00
|
|
|
|
wbStream << (double)80000.0; // potreq_gw_f8
|
|
|
|
|
wbStream << (double)0.2; // potreq_gwcg_f8
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
2025-04-29 11:55:56 +08:00
|
|
|
|
// 更新数据包大小(使用两个字节)
|
|
|
|
|
size = wbData.size();
|
|
|
|
|
wbData[4] = (size >> 8) & 0xFF; // 高字节
|
|
|
|
|
wbData[5] = size & 0xFF; // 低字节
|
2025-04-28 16:41:21 +08:00
|
|
|
|
|
|
|
|
|
// 发送测试数据包
|
|
|
|
|
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(aeroData));
|
|
|
|
|
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(ghData));
|
|
|
|
|
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(wbData));
|
|
|
|
|
}
|