修改状态显示,添加组别
This commit is contained in:
@@ -17,7 +17,7 @@ HealthUI::HealthUI(QWidget *parent) :
|
||||
|
||||
|
||||
Install("内置惯导",1,state::inital);
|
||||
Install("SBG",2,state::inital);
|
||||
Install("航姿",2,state::inital);
|
||||
Install("ECU",3,state::inital);
|
||||
Install("舵控",4,state::inital);
|
||||
Install("回收着陆器",5,state::inital);
|
||||
@@ -58,8 +58,13 @@ HealthUI::HealthUI(QWidget *parent) :
|
||||
row = n;
|
||||
}
|
||||
}
|
||||
this->resize(400,26 * row + 36);
|
||||
}
|
||||
this->resize(400,26 * row + 36);
|
||||
else
|
||||
{
|
||||
this->resize(400,0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#include "StateGroup.h"
|
||||
|
||||
StateGroup::StateGroup(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
StateGroup::~StateGroup()
|
||||
{
|
||||
foreach (StateWidget * w, ItemList) {
|
||||
delete w;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StateGroup::addItem(StateWidget * w)
|
||||
{
|
||||
ItemList.insert(ItemList.size(),w);//逐渐往上加
|
||||
|
||||
|
||||
|
||||
//检查界面,添加到界面
|
||||
|
||||
}
|
||||
|
||||
void StateGroup::addItems(QMap<int, StateWidget *> list)
|
||||
{
|
||||
foreach (StateWidget *w, list) {
|
||||
addItem(w);
|
||||
}
|
||||
}
|
||||
|
||||
void StateGroup::setValue(int index,QString value)
|
||||
{
|
||||
if(ItemList.contains(index))
|
||||
{
|
||||
ItemList.value(index)->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
void StateGroup::setState(int index,StateWidget::state s)
|
||||
{
|
||||
if(ItemList.contains(index))
|
||||
{
|
||||
ItemList.value(index)->setColor(s);
|
||||
}
|
||||
}
|
||||
|
||||
void StateGroup::updateUI(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#ifndef STATEGROUP_H
|
||||
#define STATEGROUP_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "StateWidget.h"
|
||||
|
||||
class StateGroup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit StateGroup(QWidget *parent = nullptr);
|
||||
|
||||
~StateGroup();
|
||||
|
||||
int id;
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void setID(int value)
|
||||
{
|
||||
id = value;
|
||||
}
|
||||
|
||||
int ID(void)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
QMap<int,StateWidget *> Items(void)
|
||||
{
|
||||
return ItemList;
|
||||
}
|
||||
|
||||
void addItem(StateWidget * w);
|
||||
void addItems(QMap<int,StateWidget *> list);
|
||||
|
||||
StateWidget *Item(int key)
|
||||
{
|
||||
StateWidget *w = nullptr;
|
||||
|
||||
if(ItemList.contains(key))
|
||||
{
|
||||
w = ItemList.value(key);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
StateWidget *Item(QString name)
|
||||
{
|
||||
StateWidget *w = nullptr;
|
||||
|
||||
foreach (StateWidget *i, ItemList) {
|
||||
if(i->Name() == name){
|
||||
w = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
void setValue(int index, QString value);
|
||||
void setState(int index,StateWidget::state s);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QMap<int,StateWidget *> ItemList;
|
||||
|
||||
QString title;
|
||||
|
||||
};
|
||||
|
||||
#endif // STATEGROUP_H
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
int w = 150;
|
||||
int h = 20;
|
||||
|
||||
gridlayout = new QGridLayout(this);
|
||||
gridlayout->setMargin(0);
|
||||
gridlayout->setVerticalSpacing(6);
|
||||
@@ -14,15 +11,15 @@ StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
|
||||
title->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
title->setFixedSize(w/2,h);
|
||||
|
||||
gridlayout->addWidget(title,0,0);
|
||||
gridlayout->addWidget(title,0,0,1,1);
|
||||
|
||||
if(flag == 0)
|
||||
{
|
||||
label = new QLabel("0");
|
||||
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
label->setFixedSize(w,h);
|
||||
setColor(label,state::gray);
|
||||
gridlayout->addWidget(label,0,1);
|
||||
label->setFixedSize(w/2,h);
|
||||
setColor(state::gray);
|
||||
gridlayout->addWidget(label,0,1,1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -30,9 +27,11 @@ StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
|
||||
bar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
bar->setRange(0,100);
|
||||
bar->setValue(0);
|
||||
bar->setFixedSize(w,h);
|
||||
gridlayout->addWidget(bar,0,1);
|
||||
bar->setFixedSize(w/2,h);
|
||||
gridlayout->addWidget(bar,0,1,1,1);
|
||||
}
|
||||
|
||||
this->setLayout(gridlayout);
|
||||
}
|
||||
|
||||
StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidget *parent) : QWidget(parent)
|
||||
@@ -40,9 +39,6 @@ StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidg
|
||||
|
||||
id = index;
|
||||
|
||||
int w = 150;
|
||||
int h = 20;
|
||||
|
||||
gridlayout = new QGridLayout(this);
|
||||
gridlayout->setMargin(0);
|
||||
gridlayout->setVerticalSpacing(6);
|
||||
@@ -52,51 +48,105 @@ StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidg
|
||||
title->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
title->setFixedSize(w/2,h);
|
||||
|
||||
gridlayout->addWidget(title,0,0);
|
||||
gridlayout->addWidget(title,0,0,1,1);
|
||||
|
||||
if(flag == 0)
|
||||
{
|
||||
label = new QLabel(v.toString());
|
||||
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
label->setFixedSize(w,h);
|
||||
setColor(label,s);
|
||||
gridlayout->addWidget(label,0,1);
|
||||
label->setFixedSize(w/2,h);
|
||||
setColor(s);
|
||||
gridlayout->addWidget(label,0,1,1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bar = new QProgressBar();
|
||||
bar->setFormat("%v");
|
||||
bar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
bar->setRange(0,100);
|
||||
bar->setValue(v.toDouble());
|
||||
bar->setFixedSize(w,h);
|
||||
gridlayout->addWidget(bar,0,1);
|
||||
bar->setFixedSize(w/2,h);
|
||||
gridlayout->addWidget(bar,0,1,1,1);
|
||||
}
|
||||
|
||||
this->setLayout(gridlayout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
StateWidget::~StateWidget()
|
||||
{
|
||||
if(title)
|
||||
{
|
||||
delete title;
|
||||
}
|
||||
|
||||
if(label)
|
||||
{
|
||||
delete label;
|
||||
}
|
||||
|
||||
if(bar)
|
||||
{
|
||||
delete bar;
|
||||
}
|
||||
|
||||
if(gridlayout)
|
||||
{
|
||||
delete gridlayout;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void StateWidget::setColor(QWidget *w,state s)
|
||||
void StateWidget::setColor(state s)
|
||||
{
|
||||
w->setProperty("state",s);
|
||||
w->style()->unpolish(w);
|
||||
w->style()->polish(w);
|
||||
if(label)
|
||||
{
|
||||
label->setProperty("state",s);
|
||||
label->style()->unpolish(label);
|
||||
label->style()->polish(label);
|
||||
}
|
||||
|
||||
if(bar)
|
||||
{
|
||||
bar->setProperty("state",s);
|
||||
bar->style()->unpolish(bar);
|
||||
bar->style()->polish(bar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StateWidget::setValue(QLabel *w,QString s)
|
||||
void StateWidget::setValue(QString s)
|
||||
{
|
||||
w->setText(s);
|
||||
if(label)
|
||||
{
|
||||
label->setText(s);
|
||||
}
|
||||
|
||||
if(bar)
|
||||
{
|
||||
bar->setValue(s.toDouble());
|
||||
}
|
||||
}
|
||||
|
||||
void StateWidget::setRange(double m_min,double m_max)
|
||||
{
|
||||
min = m_min;
|
||||
max = m_max;
|
||||
|
||||
if(bar)
|
||||
{
|
||||
bar->setRange(m_min,m_max);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,8 +57,24 @@ signals:
|
||||
|
||||
public slots:
|
||||
|
||||
void setColor(QWidget *w,state s);
|
||||
void setValue(QLabel *w,QString s);
|
||||
int ID(void)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
QString Name(void)
|
||||
{
|
||||
return title->text();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setColor(state s);
|
||||
void setValue(QString s);
|
||||
|
||||
void setRange(double m_min,double m_max);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -68,6 +84,8 @@ private slots:
|
||||
|
||||
private:
|
||||
|
||||
int w = 300;
|
||||
int h = 20;
|
||||
|
||||
double max = 99999999999999999;
|
||||
double min = -99999999999999999;
|
||||
|
||||
@@ -16,9 +16,7 @@ StatusUI::StatusUI(QWidget *parent) :
|
||||
file.close();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
install(0,"www",11);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +60,37 @@ void StatusUI::setValue(QString name,QVariant value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StatusUI::setServo(int index,double value)
|
||||
{
|
||||
switch (index) {
|
||||
case 1:
|
||||
// ui->label_Servo_1->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 2:
|
||||
// ui->label_Servo_2->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 3:
|
||||
// ui->label_Servo_3->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 4:
|
||||
// ui->label_Servo_4->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 5:
|
||||
// ui->label_Servo_5->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 6:
|
||||
//ui->label_Servo_6->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 7:
|
||||
//ui->label_Servo_7->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
case 8:
|
||||
//ui->label_Servo_8->setText(QString::number(value,'f',0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
void install(int flag, QString name, QVariant value);
|
||||
|
||||
|
||||
void setServo(int index,double value);
|
||||
|
||||
public slots:
|
||||
|
||||
void setValue(QString name,QVariant value);
|
||||
|
||||
@@ -16,10 +16,12 @@ FORMS += \
|
||||
$$PWD/StatusUI.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/StateGroup.h \
|
||||
$$PWD/StateWidget.h \
|
||||
$$PWD/StatusUI.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/StateGroup.cpp \
|
||||
$$PWD/StateWidget.cpp \
|
||||
$$PWD/StatusUI.cpp
|
||||
|
||||
|
||||
+1
-797
@@ -13,803 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="24" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>转速[r/min]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="38" column="1">
|
||||
<widget class="QLabel" name="label_Fuel_Int">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>海拔[m]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="33" column="1">
|
||||
<widget class="QLabel" name="label_bat_2">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="40" column="0" colspan="2">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="38" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>积分油量[kg]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>表速[m/s]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="41" column="1">
|
||||
<widget class="QLabel" name="label_ssp">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_66">
|
||||
<property name="text">
|
||||
<string>飞行模式</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_1_heading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_mode">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>控制状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="39" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>估计油量[kg]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="label_1_rate">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_1_rol">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1">
|
||||
<widget class="QLabel" name="label_rpm">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="36" column="1">
|
||||
<widget class="QLabel" name="label_EngineVol">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="30" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>开伞状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_1_tas">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="34" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>发动机电压[V]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="27" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>电流[mA]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>发动机状态</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="37" column="1">
|
||||
<widget class="QLabel" name="label_flux">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_1_Slide">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_49">
|
||||
<property name="text">
|
||||
<string>滚转角[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1">
|
||||
<widget class="QLabel" name="label_P5">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="30" column="1">
|
||||
<widget class="QLabel" name="label_Parachute">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>T1[℃]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="1">
|
||||
<widget class="QLabel" name="label_T0">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QProgressBar" name="label_throttle">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>航迹角[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_64">
|
||||
<property name="text">
|
||||
<string>地速[m/s]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_48">
|
||||
<property name="text">
|
||||
<string>俯仰角[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<widget class="QLabel" name="label_la_real">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLabel" name="label_1_gs">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="34" column="1">
|
||||
<widget class="QLabel" name="label_bat_3">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0">
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="text">
|
||||
<string>左尾舵[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>油门[%]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_1_cas">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="32" column="1">
|
||||
<widget class="QLabel" name="label_bat_1">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="text">
|
||||
<string>右尾舵[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_63">
|
||||
<property name="text">
|
||||
<string>真空速[m/s]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_1_alt">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="33" column="0">
|
||||
<widget class="QLabel" name="label_52">
|
||||
<property name="text">
|
||||
<string>舵机电压[V]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="37" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>燃油流量[L/min]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_FlightMode">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>爬升率[m/s]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="35" column="1">
|
||||
<widget class="QLabel" name="label_BackFuel">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="42" column="1">
|
||||
<widget class="QLabel" name="label_ssr">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="32" column="0">
|
||||
<widget class="QLabel" name="label_50">
|
||||
<property name="text">
|
||||
<string>飞控电压[V]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_1_Atteck">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>GPS定向</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_1_pit">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="36" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>滑油压力[Pa]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="35" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>涡轮后温度[℃]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="39" column="1">
|
||||
<widget class="QLabel" name="label_Fuel_Est">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>马赫数[Ma]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QLabel" name="label_gps_dir">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="41" column="0">
|
||||
<widget class="QLabel" name="label_54">
|
||||
<property name="text">
|
||||
<string>信号[%-B/s]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>攻角[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="1">
|
||||
<widget class="QLabel" name="label_engine_check">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="1">
|
||||
<widget class="QLabel" name="label_ele_real">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="1">
|
||||
<widget class="QLabel" name="label_Hstable_real">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="31" column="0" colspan="2">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>侧滑角[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="label_46">
|
||||
<property name="text">
|
||||
<string>右副翼[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="29" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>发动机动作</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>P2[MPa]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="27" column="1">
|
||||
<widget class="QLabel" name="label_servo_current">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<widget class="QLabel" name="label_43">
|
||||
<property name="text">
|
||||
<string>左副翼[°]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="29" column="1">
|
||||
<widget class="QLabel" name="label_EngineState">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<widget class="QLabel" name="label_ra_real">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_base">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Adobe 黑体 Std R</family>
|
||||
<pointsize>12</pointsize>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>基本信息</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="label_servo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Adobe 黑体 Std R</family>
|
||||
<pointsize>12</pointsize>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>作动状态</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="label_1_ma">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -25,9 +25,9 @@ tools_Index4::tools_Index4(QWidget *parent) :
|
||||
|
||||
addGroup(0);
|
||||
addGroup(1);
|
||||
addGroup(2);
|
||||
addGroup(3);
|
||||
addGroup(4);
|
||||
//addGroup(2);
|
||||
//addGroup(3);
|
||||
//addGroup(4);
|
||||
|
||||
|
||||
|
||||
|
||||
+12
-256
@@ -1010,8 +1010,6 @@ void MainWindow::setServoOffset(QVariant la,QVariant ra,
|
||||
void MainWindow::update_servo_output_raw(mavlink_servo_output_raw_t servo)
|
||||
{
|
||||
|
||||
|
||||
|
||||
static qint64 lastTime = 0;
|
||||
/*
|
||||
qDebug() << "Time:"
|
||||
@@ -1045,132 +1043,22 @@ void MainWindow::update_servo_output_raw(mavlink_servo_output_raw_t servo)
|
||||
|
||||
if(servo.port == 0)
|
||||
{
|
||||
//qDebug() << "setPWM";
|
||||
/*
|
||||
statusui->setServo(1,QString::number(pwm2angle(servo.servo12_raw,2032,1218,-30,20,2.56),'f',2),0);//左副
|
||||
statusui->setServo(2,QString::number(pwm2angle(servo.servo13_raw,1145,1764,-30,20,-1.24),'f',2),0);//右副
|
||||
statusui->setServo(3,QString::number(pwm2angle(servo.servo10_raw,1845,1154,-25.7,25.3,-0.16),'f',2),0);//左升降
|
||||
statusui->setServo(4,QString::number(pwm2angle(servo.servo11_raw,1353,1936,-5.2,4,-0.53),'f',2),0);//右升降
|
||||
statusui->setServo(5,QString::number(pwm2angle(servo.servo14_raw,1728,1277,-27,23,-1.61),'f',2),0);//方向
|
||||
*/
|
||||
/*
|
||||
statusui->setServo(1,QString::number(pwm2angle_2((int16_t)servo.servo1_raw,0.0,0.0168,-4.5791)),
|
||||
QString::number(pwm2angle_2((int16_t)servo.servo8_raw,0.0,0.0168,-4.5791)));//左副
|
||||
statusui->setServo(2,QString::number(pwm2angle_2((int16_t)servo.servo3_raw,0.0,0.017,-4.8676)),
|
||||
QString::number(pwm2angle_2((int16_t)servo.servo10_raw,0.0,0.017,-4.8676)));//右副
|
||||
statusui->setServo(3,QString::number(pwm2angle_2((int16_t)servo.servo2_raw,0.0,0.0147,-0.5647)),
|
||||
QString::number(pwm2angle_2((int16_t)servo.servo9_raw,0.0,0.0147,-0.5647)));//左尾
|
||||
statusui->setServo(4,QString::number(pwm2angle_2((int16_t)servo.servo4_raw,0.0,0.0147,-8.3054)),
|
||||
QString::number(pwm2angle_2((int16_t)servo.servo11_raw,0.0,0.0147,-8.3054)));//右尾
|
||||
|
||||
|
||||
|
||||
|
||||
statusui->setEngine(1,QString::number((servo.servo5_raw - 1000) * 0.1,'f',0));
|
||||
statusui->setEngine(2,QString::number(servo.servo12_raw,'f',1));//转速
|
||||
statusui->setEngine(3,QString::number(servo.servo13_raw - 55,'f',0));//T1
|
||||
statusui->setEngine(4,QString::number((double)servo.servo14_raw * 0.6 / 255,'f',1));//p2
|
||||
statusui->setEngine(5,QString::number((double)servo.servo15_raw * 150.0 / 255,'f',0));//current
|
||||
*/
|
||||
|
||||
QString eng;
|
||||
switch (servo.servo16_raw) {
|
||||
case 0x00:
|
||||
eng.append("转速大于600r/min");
|
||||
break;
|
||||
case 0xA5:
|
||||
eng.append("发动机起动正常");
|
||||
break;
|
||||
case 0xA1:
|
||||
eng.append("无法判断发动机正常");
|
||||
break;
|
||||
case 0xAF:
|
||||
eng.append("发动机起动异常");
|
||||
break;
|
||||
case 0xC5:
|
||||
eng.append("发动机转级正常");
|
||||
break;
|
||||
case 0xC1:
|
||||
eng.append("无法判断发动机转级正常");
|
||||
break;
|
||||
case 0xCF:
|
||||
eng.append("发动机转级异常");
|
||||
break;
|
||||
case 0xFF:
|
||||
eng.append("收到飞控指令");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//statusui->setEngine(6,eng);//engine
|
||||
|
||||
eng.clear();
|
||||
switch (servo.servo7_raw) {
|
||||
case 0:
|
||||
eng.append("待机");
|
||||
break;
|
||||
case 1:
|
||||
eng.append("射检");
|
||||
break;
|
||||
case 2:
|
||||
eng.append("油泵启动");
|
||||
break;
|
||||
case 3:
|
||||
eng.append("启动发动机");
|
||||
break;
|
||||
case 4:
|
||||
eng.append("发动机转速指令");
|
||||
break;
|
||||
}
|
||||
//statusui->setEngine(7,eng);//engine
|
||||
|
||||
|
||||
eng.clear();
|
||||
switch (servo.servo6_raw) {
|
||||
case 0:
|
||||
eng.append("未开伞");
|
||||
break;
|
||||
case 1:
|
||||
eng.append("以开伞");
|
||||
break;
|
||||
}
|
||||
//statusui->setEngine(8,eng);//engine
|
||||
|
||||
|
||||
double fluxsrc = dlink->mavlinknode->vehicleList.value(currentUAV).rpm.rpm3;
|
||||
double fuelflux = 0;
|
||||
|
||||
fuelflux = -4E-07 * fluxsrc * fluxsrc + 0.0189 * fluxsrc - 0.4689;
|
||||
|
||||
//statusui->setEngine(9,QString::number(fuelflux,'f',2));//flux
|
||||
|
||||
|
||||
//349kg
|
||||
|
||||
|
||||
qint64 current = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
double dt = current - lastTime;
|
||||
lastTime = current;
|
||||
|
||||
if(fuelflux >= 0)
|
||||
{
|
||||
fuelTotal -= (fuelflux * dt * 0.001 * 0.8 ) / 60.0 ;
|
||||
}
|
||||
|
||||
//statusui->setEngine(10,QString::number(fuelTotal,'f',2));//fuel
|
||||
|
||||
|
||||
|
||||
//12-16
|
||||
|
||||
statusui->setServo(1,servo.servo12_raw);
|
||||
statusui->setServo(2,servo.servo13_raw);
|
||||
statusui->setServo(3,servo.servo14_raw);
|
||||
statusui->setServo(4,servo.servo15_raw);
|
||||
statusui->setServo(5,servo.servo16_raw);
|
||||
|
||||
}
|
||||
else if(servo.port == 1)
|
||||
{
|
||||
//ZUO
|
||||
//statusui->setState(12,(servo.servo1_raw)?("未定向"):("已定向"),0);
|
||||
|
||||
//statusui->setEngine(11,QString::number(servo.servo2_raw * 0.01,'f',2));//fuel
|
||||
//17-19
|
||||
statusui->setServo(6,servo.servo1_raw);
|
||||
statusui->setServo(7,servo.servo2_raw);
|
||||
statusui->setServo(8,servo.servo3_raw);
|
||||
}
|
||||
|
||||
|
||||
@@ -1192,7 +1080,7 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
|
||||
static quint64 lastTime = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
static qint64 frq_time = 0;
|
||||
static qint64 frq_time = 0;//5hz
|
||||
if((QDateTime::currentMSecsSinceEpoch() - frq_time) <= 200)
|
||||
{
|
||||
return;
|
||||
@@ -1294,20 +1182,9 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
gps_str.append(tr("%1").arg(dlink->mavlinknode->vehicleList.value(currentUAV).gps_raw_int.fix_type));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
copk->setGPS(gps_str);
|
||||
|
||||
|
||||
/*
|
||||
toolsui->diagram->setTime(3,QTime::fromMSecsSinceStartOfDay(StartupTime->time().msecsTo(QDateTime::currentDateTime().time())));//开车时长
|
||||
|
||||
toolsui->diagram->setTime(4,QTime::fromMSecsSinceStartOfDay(FlightTime->time().msecsTo(QDateTime::currentDateTime().time())));//飞行时长
|
||||
*/
|
||||
|
||||
|
||||
QString arm_str;
|
||||
arm_str.clear();
|
||||
|
||||
@@ -1498,131 +1375,12 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
menuBarUI->setwp_Dist(((float)dlink->mavlinknode->vehicleList.value(currentUAV).nav_controller_output.wp_dist) * 0.001);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if(MainIndex == 3)//飞行界面
|
||||
{
|
||||
//刷新时间1Hz
|
||||
//显示状态信息 数据链信号状态,定位信号状态,电池状态,解锁状态,剩余飞行时间等
|
||||
QString message;
|
||||
|
||||
message.append(tr("<h6>数据强度:<font color=red>%1</font>\t").arg(QString::number(100)));
|
||||
message.append(tr("定位类型:<font color=red>%1</font>\t").arg(gps_str));
|
||||
message.append(tr("卫星数目:<font color=red>%1</font>颗</h6>").arg(QString::number(dlink->mavlinknode->vehicleList.value(currentUAV).gps_raw_int.satellites_visible)));
|
||||
message.append(tr("<h6>电池电压:<font color=red>%1</font>V\t").arg(QString::number(dlink->mavlinknode->vehicleList.value(currentUAV).sys_status.voltage_battery * 0.001)));
|
||||
message.append(tr("剩余时间:<font color=red>%1</font></h6>").arg(QString::number(0)));
|
||||
|
||||
showMessage(message);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//实测,r,le,e,la,a
|
||||
//有符号16位,-32767 ~ 32767
|
||||
le = dlink->mavlinknode->vehicleList.value(currentUAV).servo_output_raw.servo1_raw
|
||||
re =
|
||||
ru =
|
||||
la =
|
||||
ra =
|
||||
thr = (1000 ~2000)
|
||||
afb = (1000/2000)
|
||||
0
|
||||
0
|
||||
healt
|
||||
sbus = feedback (ra)
|
||||
sbus = feedback (re)
|
||||
sbus = feedback (ru)
|
||||
sbus = feedback (la)
|
||||
15 sbus = feedback (le)
|
||||
health = 0 000 000 000 000 000 //顺序和上面sbus一样
|
||||
GBIT zero SBIT
|
||||
//指令
|
||||
|
||||
舵机指令
|
||||
自检 2004
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//toolsui->powersystem->setTurbineState(&dlink->mavlinknode->vehicleList.value(currentUAV).turbinstate);
|
||||
//toolsui->powersystem->setCCMState(&dlink->mavlinknode->vehicleList.value(currentUAV).ccmstate);
|
||||
|
||||
toolsui->powersystem->setMa(dlink->mavlinknode->vehicleList.value(currentUAV).emb_atom_com.mach);
|
||||
toolsui->powersystem->setAlt(dlink->mavlinknode->vehicleList.value(currentUAV).gps_raw_int.alt * 10e-4);
|
||||
|
||||
|
||||
toolsui->powersystem->setFuel(QString::number(dlink->mavlinknode->vehicleList.value(currentUAV).ccmstate.volts[2],'f',0),
|
||||
QString::number(dlink->mavlinknode->vehicleList.value(currentUAV).ccmstate.fuel_level * 10.0 / 65536.0f,'f',1));
|
||||
|
||||
//toolsui->servosystem->setBUMState(&dlink->mavlinknode->vehicleList.value(currentUAV).bmustate);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool v28_Low = false,v56_Low = false;
|
||||
v28_Low = (((float)dlink->mavlinknode->vehicleList.value(currentUAV).bmustate.BAT1_remain_perc * 0.1) < 10)?(false):(true);
|
||||
v56_Low = (((float)dlink->mavlinknode->vehicleList.value(currentUAV).bmustate.BAT2_remain_perc * 0.1) < 10)?(false):(true);
|
||||
|
||||
// qDebug() << "v28_Low" << v28_Low << "v56_Low" << v56_Low;
|
||||
|
||||
toolsui->servosystem->setCheckState(1,v28_Low || v56_Low);
|
||||
toolsui->servosystem->setCheckState(2,v28_Low);
|
||||
toolsui->servosystem->setCheckState(3,v56_Low);
|
||||
toolsui->servosystem->setCheckState(4,0);
|
||||
toolsui->servosystem->setCheckState(5,(dlink->mavlinknode->vehicleList.value(currentUAV).bmustate.p500w_enabled)?(1):(0));
|
||||
|
||||
|
||||
uint32_t health = dlink->mavlinknode->vehicleList.value(currentUAV).sys_status.onboard_control_sensors_health;
|
||||
uint32_t enabled= dlink->mavlinknode->vehicleList.value(currentUAV).sys_status.onboard_control_sensors_enabled;
|
||||
if(isCommunicationLost == false)
|
||||
{
|
||||
|
||||
/*
|
||||
healthui->setState(1,getBit(health,2)?(getBit(health,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//IMU
|
||||
healthui->setState(2,getBit(health,3)?(getBit(health,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//SBG
|
||||
healthui->setState(3,getBit(health,6)?(getBit(health,5)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//GEAR
|
||||
healthui->setState(4,getBit(health,9)?(getBit(health,8)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//SBG
|
||||
healthui->setState(5,getBit(health,11)?(getBit(health,10)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//起落架
|
||||
|
||||
|
||||
healthui->setState(6,getBit(health,12)?(HealthUI::state::success):(HealthUI::state::failure));//RC
|
||||
healthui->setState(7,getBit(health,13)?(HealthUI::state::success):(HealthUI::state::failure));//DLINK
|
||||
|
||||
healthui->setState(8,getBit(health,7)?(HealthUI::state::success):(HealthUI::state::failure));//RECORD
|
||||
|
||||
|
||||
healthui->setState(9,getBit(health,4)?(HealthUI::state::warning):(HealthUI::state::success));//使用内置惯导
|
||||
healthui->setValue(9,getBit(health,4)?(tr("使用外置")):(tr("使用内置")));//sel
|
||||
|
||||
healthui->setState(11,getBit(health,14)?(HealthUI::state::failure):(HealthUI::state::success));//开伞
|
||||
healthui->setState(12,getBit(health,15)?(HealthUI::state::failure):(HealthUI::state::success));//刹车
|
||||
healthui->setState(13,getBit(health,16)?(HealthUI::state::success):(HealthUI::state::inital));//起落架收到位
|
||||
healthui->setState(14,getBit(health,17)?(HealthUI::state::success):(HealthUI::state::inital));//起落架放到位
|
||||
//healthui->setState(15,getBit(health,15)?(getBit(servoHealt,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RU
|
||||
|
||||
healthui->setState(16,getBit(health,18)?(HealthUI::state::success):(HealthUI::state::failure));//轮转
|
||||
healthui->setState(17,getBit(health,19)?(HealthUI::state::success):(HealthUI::state::failure));//左轮载
|
||||
healthui->setState(18,getBit(health,20)?(HealthUI::state::success):(HealthUI::state::failure));//右轮载
|
||||
healthui->setState(19,getBit(health,21)?(HealthUI::state::success):(HealthUI::state::failure));//前轮载
|
||||
|
||||
|
||||
healthui->setState(21,getBit(health,22)?(HealthUI::state::success):(HealthUI::state::failure));//开伞
|
||||
healthui->setState(22,getBit(health,23)?(HealthUI::state::success):(HealthUI::state::failure));//开气囊
|
||||
healthui->setState(23,getBit(health,24)?(HealthUI::state::success):(HealthUI::state::failure));//充气
|
||||
healthui->setState(24,getBit(health,25)?(HealthUI::state::success):(HealthUI::state::failure));//抛伞
|
||||
*/
|
||||
|
||||
healthui->setState(1,getBit(health,6)?(getBit(health,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//IMU
|
||||
healthui->setState(2,getBit(health,7)?(getBit(health,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//SBG
|
||||
healthui->setState(2,getBit(health,7)?(getBit(health,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//NAV
|
||||
healthui->setState(3,getBit(health,9)?(getBit(health,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//ecu
|
||||
healthui->setState(4,getBit(health,10)?(getBit(health,4)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//servo
|
||||
healthui->setState(5,getBit(health,11)?(getBit(health,5)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//起落架
|
||||
@@ -1636,8 +1394,6 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
healthui->setValue(10,getBit(enabled,2)?(tr("正在写入")):(tr("停止写入")));//sel
|
||||
|
||||
|
||||
|
||||
|
||||
healthui->setState(11,getBit(health,16)?(HealthUI::state::failure):(HealthUI::state::inital));//气囊充气
|
||||
healthui->setState(12,getBit(health,17)?(HealthUI::state::failure):(HealthUI::state::inital));//开伞
|
||||
healthui->setState(13,getBit(health,18)?(HealthUI::state::failure):(HealthUI::state::inital));//切伞
|
||||
|
||||
+24
-20
@@ -499,7 +499,11 @@ void MavLinkNode::CreateCSV(void)
|
||||
ins2_file->write(ins2_csv);
|
||||
gps_raw_int_file->write(gps_raw_int_csv);
|
||||
global_position_int_file->write(global_position_int_csv);
|
||||
servo_output_raw_file->write(servo_output_raw_csv);
|
||||
|
||||
for(int i = 0;i < 10;i++)
|
||||
{
|
||||
servo_output_raw_file->write(servo_output_raw_csv[i]);
|
||||
}
|
||||
rc_channels_raw_file->write(rc_channels_raw_csv);
|
||||
nav_controller_output_file->write(nav_controller_output_csv);
|
||||
airspeed_autocal_file->write(airspeed_autocal_csv);
|
||||
@@ -559,7 +563,7 @@ void MavLinkNode::process()//线程函数
|
||||
ins2_csv.append("time_boot_ms,pitch,roll,yaw,lon,lat,alt,v_north,v_up,v_east,gx,gy,gz,ax,ay,az,time,sys,com,gps,bit,seq,eph,epv,svn\n");
|
||||
gps_raw_int_csv.append("time_usec,lat,lon,alt,eph,epv,vel,cog,fix_type,satellites_visible,alt_ellipsoid,h_acc,v_acc,vel_acc,hdg_acc,yaw\n");
|
||||
global_position_int_csv.append("time_boot_ms,lat,lon,alt,relative_alt,vx,vy,vz,hdg\n");
|
||||
servo_output_raw_csv.append("time_usec,port,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12,ch13,ch14,ch15,ch16\n");
|
||||
servo_output_raw_csv[0].append("time_usec,port,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12,ch13,ch14,ch15,ch16\n");
|
||||
rc_channels_raw_csv;
|
||||
nav_controller_output_csv.append("nav_roll,nav_pitch,nav_bearing,target_bearing,wp_dist,alt_err,as_err,xtrack_err\n");
|
||||
airspeed_autocal_csv.append("vx,vy,vz,diff_pressure,EAS2TAS,ratio,state_x,state_y,state_z,Pax,Pby,Pcz\n");
|
||||
@@ -1146,24 +1150,24 @@ void MavLinkNode::StatusParse(mavlink_message_t msg)
|
||||
case MAVLINK_MSG_ID_SERVO_OUTPUT_RAW: {
|
||||
mavlink_msg_servo_output_raw_decode(&msg,&vehicle.servo_output_raw);
|
||||
|
||||
servo_output_raw_csv.append(QString::number( vehicle.servo_output_raw.time_usec)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( vehicle.servo_output_raw.port)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo1_raw)/32767.0 * 25.0)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( ((int16_t)vehicle.servo_output_raw.servo2_raw)/32767.0 * 25.0 + 0.35)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo3_raw)/32767.0 * 25.0)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( ((int16_t)vehicle.servo_output_raw.servo4_raw)/32767.0 * 35.0 / 1.12 + 1.25)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo5_raw)/32767.0 * 35.0 / 1.117 - 1.2)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number((vehicle.servo_output_raw.servo6_raw - 1000) * 0.1)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(vehicle.servo_output_raw.servo7_raw * 0.01)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(vehicle.servo_output_raw.servo8_raw)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(vehicle.servo_output_raw.servo9_raw)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(vehicle.servo_output_raw.servo10_raw)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo11_raw)/32767.0 * 35.0 / 1.117 - 1.2)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( ((int16_t)vehicle.servo_output_raw.servo12_raw)/32767.0 * 25.0 + 0.35)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo13_raw)/32767.0 * 25.0)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( ((int16_t)vehicle.servo_output_raw.servo14_raw)/32767.0 * 35.0 / 1.12 + 1.25)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number(-((int16_t)vehicle.servo_output_raw.servo15_raw)/32767.0 * 25.0)); servo_output_raw_csv.append(',');
|
||||
servo_output_raw_csv.append(QString::number( vehicle.servo_output_raw.servo16_raw)); servo_output_raw_csv.append('\n');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.time_usec)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.port)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo1_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo2_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo3_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo4_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo5_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo6_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo7_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo8_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo9_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo10_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo11_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo12_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo13_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo14_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo15_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append(',');
|
||||
servo_output_raw_csv[vehicle.servo_output_raw.port].append(QString::number(vehicle.servo_output_raw.servo16_raw)); servo_output_raw_csv[vehicle.servo_output_raw.port].append('\n');
|
||||
|
||||
|
||||
emit signal_servo_output_raw(&vehicle.servo_output_raw);
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
QByteArray ins2_csv;
|
||||
QByteArray gps_raw_int_csv;
|
||||
QByteArray global_position_int_csv;
|
||||
QByteArray servo_output_raw_csv;
|
||||
QByteArray servo_output_raw_csv[10];
|
||||
QByteArray rc_channels_raw_csv;
|
||||
QByteArray nav_controller_output_csv;
|
||||
QByteArray airspeed_autocal_csv;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user