From 0575a8b3da32bae1baaeeb9a60837a4d97d6cd41 Mon Sep 17 00:00:00 2001 From: hm-thinkbook14p Date: Tue, 14 Feb 2023 15:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/mainwindow.cpp | 37 +++++++++++++++++++++---------------- MavLinkNode/mavlinknode.cpp | 2 +- dlink/dlink.cpp | 2 ++ 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/App/mainwindow.cpp b/App/mainwindow.cpp index ec80a8e..40996a1 100644 --- a/App/mainwindow.cpp +++ b/App/mainwindow.cpp @@ -1015,7 +1015,6 @@ void MainWindow::beep(int id) if(map->getUAVCurrent() == id) { QApplication::beep(); - //Beep(455,50); } } @@ -1033,11 +1032,8 @@ void MainWindow::setTTS(QVariant state) void MainWindow::TTSsay(QString str) { - //qDebug() << u8"播报语音"; - //把要说的话加入队列 if(isEnableTTS) { - //qDebug() << u8"把要说的话加入到队列"; if(!tts) { tts = new QTextToSpeech(); @@ -1045,8 +1041,6 @@ void MainWindow::TTSsay(QString str) if(tts->state() == QTextToSpeech::Ready) { - //qDebug() << u8"准备开始播放语音"; - //TTS有问题,可能会导致死机 tts->say(str); } } @@ -1966,18 +1960,29 @@ void MainWindow::updateUI()//事件驱动式更新数据 } - qreal la_command = dir_la.toInt() * ((int16_t)vehicle.servo_output_raw.servo14_raw)/32767.0 * max_la.toDouble()/scale_la.toDouble() + bias_la.toDouble() * 57.295; - qreal la_angle = dir_la.toInt() * ((int16_t)vehicle.servo_output_raw.servo4_raw) /32767.0 * max_la.toDouble()/scale_la.toDouble() + bias_la.toDouble() * 57.295; - qreal ra_command = dir_ra.toInt() * ((int16_t)vehicle.servo_output_raw.servo11_raw)/32767.0 * max_ra.toDouble()/scale_ra.toDouble() + bias_ra.toDouble() * 57.295; - qreal ra_angle = dir_ra.toInt() * ((int16_t)vehicle.servo_output_raw.servo5_raw)/ 32767.0 * max_ra.toDouble()/scale_ra.toDouble() + bias_ra.toDouble() * 57.295; + qreal la_command = dir_la.toDouble() * ((int16_t)vehicle.servo_output_raw.servo14_raw)/32767.0 * max_la.toDouble()/scale_la.toDouble() + bias_la.toDouble() * 57.295; + qreal la_angle = dir_la.toDouble() * ((int16_t)vehicle.servo_output_raw.servo4_raw) /32767.0 * max_la.toDouble()/scale_la.toDouble() + bias_la.toDouble() * 57.295; + qreal ra_command = dir_ra.toDouble() * ((int16_t)vehicle.servo_output_raw.servo11_raw)/32767.0 * max_ra.toDouble()/scale_ra.toDouble() + bias_ra.toDouble() * 57.295; + qreal ra_angle = dir_ra.toDouble() * ((int16_t)vehicle.servo_output_raw.servo5_raw)/ 32767.0 * max_ra.toDouble()/scale_ra.toDouble() + bias_ra.toDouble() * 57.295; - qreal le_command = dir_le.toInt() * ((int16_t)vehicle.servo_output_raw.servo15_raw)/32767.0 * max_le.toDouble()/scale_le.toDouble() + bias_le.toDouble() * 57.295; - qreal le_angle = dir_le.toInt() * ((int16_t)vehicle.servo_output_raw.servo1_raw) /32767.0 * max_le.toDouble()/scale_le.toDouble() + bias_le.toDouble() * 57.295; - qreal re_command = dir_re.toInt() * ((int16_t)vehicle.servo_output_raw.servo12_raw)/32767.0 * max_re.toDouble()/scale_re.toDouble() + bias_re.toDouble() * 57.295; - qreal re_angle = dir_re.toInt() * ((int16_t)vehicle.servo_output_raw.servo2_raw) /32767.0 * max_re.toDouble()/scale_re.toDouble() + bias_re.toDouble() * 57.295; + qreal le_command = dir_le.toDouble() * ((int16_t)vehicle.servo_output_raw.servo15_raw)/32767.0 * max_le.toDouble()/scale_le.toDouble() + bias_le.toDouble() * 57.295; + qreal le_angle = dir_le.toDouble() * ((int16_t)vehicle.servo_output_raw.servo1_raw) /32767.0 * max_le.toDouble()/scale_le.toDouble() + bias_le.toDouble() * 57.295; + qreal re_command = dir_re.toDouble() * ((int16_t)vehicle.servo_output_raw.servo12_raw)/32767.0 * max_re.toDouble()/scale_re.toDouble() + bias_re.toDouble() * 57.295; + qreal re_angle = dir_re.toDouble() * ((int16_t)vehicle.servo_output_raw.servo2_raw) /32767.0 * max_re.toDouble()/scale_re.toDouble() + bias_re.toDouble() * 57.295; - qreal ru_command = dir_ru.toInt() * ((int16_t)vehicle.servo_output_raw.servo13_raw)/32767.0 * max_ru.toDouble()/scale_ru.toDouble() + bias_ru.toDouble() * 57.295; - qreal ru_angle = dir_ru.toInt() * ((int16_t)vehicle.servo_output_raw.servo3_raw) /32767.0 * max_ru.toDouble()/scale_ru.toDouble() + bias_ru.toDouble() * 57.295; + qreal ru_command = dir_ru.toDouble() * ((int16_t)vehicle.servo_output_raw.servo13_raw)/32767.0 * max_ru.toDouble()/scale_ru.toDouble() + bias_ru.toDouble() * 57.295; + qreal ru_angle = dir_ru.toDouble() * ((int16_t)vehicle.servo_output_raw.servo3_raw) /32767.0 * max_ru.toDouble()/scale_ru.toDouble() + bias_ru.toDouble() * 57.295; + + qDebug() << la_command + << la_angle + << ra_command + << ra_angle + << le_command + << le_angle + << re_command + << re_angle + << ru_command + << ru_angle ; statusui->setServo(1,QString::number(la_command,'f',2), diff --git a/MavLinkNode/mavlinknode.cpp b/MavLinkNode/mavlinknode.cpp index c330533..6605837 100644 --- a/MavLinkNode/mavlinknode.cpp +++ b/MavLinkNode/mavlinknode.cpp @@ -1278,7 +1278,7 @@ void MavLinkNode::StatusParse(mavlink_message_t msg) _showinfo info; - info.flag = 0x23F8; + info.flag = 0x24a8; info.id = infoExportID;//1 info.time = (int32_t)vehicle.ins1.time;//(second+min*60+hour*3600)*1000 info.lng = vehicle.ins1.lon * 10000000;//*10000000 diff --git a/dlink/dlink.cpp b/dlink/dlink.cpp index f0a98f7..f69719b 100644 --- a/dlink/dlink.cpp +++ b/dlink/dlink.cpp @@ -154,10 +154,12 @@ void DLink::setExportInfo(QVariant value,QVariant id, QHostAddress addr, qint32 Export_addr = addr; Export_port = port; + /* qDebug() << "isExportInfo" << value << id << addr << port; + */ } int DLink::SendMessageToExport(quint8 ch, quint8 *msg, quint16 len)