2407 lines
75 KiB
C++
2407 lines
75 KiB
C++
#include "mainwindow.h"
|
||
#include "QPushButton"
|
||
#include "QAction"
|
||
|
||
#include "QHBoxLayout"
|
||
|
||
//从0开始
|
||
bool getBit(uint32_t d,int32_t pos)
|
||
{
|
||
bool bit = false;
|
||
|
||
bit = (d >> pos) & 0x00000001;
|
||
|
||
return bit;
|
||
}
|
||
|
||
float to360deg(float raw)
|
||
{
|
||
float angle = 0;
|
||
|
||
if(raw > 360)
|
||
{
|
||
int a = (int)raw/360;
|
||
raw = raw - a *360;
|
||
}
|
||
else if(raw < -360)
|
||
{
|
||
int a = (int)raw/360;
|
||
raw = raw - a *360;
|
||
}
|
||
|
||
//0~360
|
||
if(raw < 0)
|
||
{
|
||
raw += 360;
|
||
}
|
||
|
||
angle = raw;
|
||
|
||
return angle;
|
||
}
|
||
|
||
|
||
|
||
|
||
MainWindow::MainWindow(QWidget *parent)
|
||
: QMainWindow(parent)
|
||
{
|
||
//构建日志目录
|
||
QDir *logdir = new QDir;
|
||
if(!logdir->exists("./log"))
|
||
{
|
||
qDebug() << "make dir log";
|
||
logdir->mkdir("./log");//如果文件夹不存在就新建
|
||
}
|
||
|
||
//构建Tlog目录
|
||
QDir *Tlogdir = new QDir;
|
||
if(!Tlogdir->exists("./log/tlog"))
|
||
{
|
||
qDebug() << "make dir tlog";
|
||
Tlogdir->mkdir("./log/tlog");//如果文件夹不存在就新建
|
||
}
|
||
|
||
//构建CSV目录
|
||
QDir *csvlog = new QDir;
|
||
if(!csvlog->exists("./log/csv"))
|
||
{
|
||
qDebug() << "make dir csv";
|
||
csvlog->mkdir("./log/csv");//如果文件夹不存在就新建
|
||
}
|
||
|
||
//构建文本日志目录
|
||
QDir *textlog = new QDir;
|
||
if(!textlog->exists("./log/textlog"))
|
||
{
|
||
qDebug() << "make dir textlog";
|
||
textlog->mkdir("./log/textlog");//如果文件夹不存在就新建
|
||
}
|
||
|
||
|
||
setFocusPolicy(Qt::StrongFocus);
|
||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||
|
||
|
||
/*
|
||
//设置优先生成,然后对全局进行设置
|
||
setting = new Setting(this);
|
||
setting->hide();
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
|
||
tts = new QTextToSpeech(this);
|
||
|
||
//config
|
||
|
||
config = new Config();
|
||
|
||
|
||
|
||
//ui initial
|
||
//menubar
|
||
menuBarUI = new MenuBarUI(this);
|
||
|
||
connect(menuBarUI,SIGNAL(IndexChanged(int)),
|
||
this,SLOT(onTabIndexChanged(int)));
|
||
|
||
|
||
//---------------
|
||
//设置优先生成,然后对全局进行设置
|
||
setting = new Setting(this);
|
||
setting->hide();
|
||
|
||
/*
|
||
connect(setting->index0->globalsetting,&GlobalSetting::setGCSID,
|
||
dlink->mavlinknode,&MavLinkNode::setGCSID,Qt::DirectConnection);
|
||
*/
|
||
|
||
|
||
//自检
|
||
checkUI = new CheckUI(this);
|
||
checkUI->hide();
|
||
|
||
//信息
|
||
toolsui = new ToolsUI(this);
|
||
toolsui->hide();
|
||
|
||
//状态
|
||
|
||
statusui = new StatusUI(this);
|
||
statusui->hide();
|
||
|
||
healthui = new HealthUI(this);
|
||
healthui->hide();
|
||
|
||
|
||
//指令
|
||
commandUI = new CommandUI(this);
|
||
|
||
|
||
|
||
|
||
dlink = new DLink();
|
||
|
||
map = new mapcontrol::OPMapWidget(this);
|
||
|
||
map->SetShowHome(false);
|
||
map->SetShowCompass(false);
|
||
map->SetUseOpenGL(true);
|
||
|
||
map->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||
|
||
/*
|
||
QVariant maptype;
|
||
config->getMapType(&maptype);
|
||
|
||
if(!maptype.toString().isNull())
|
||
{
|
||
//map->SetMapType(mapcontrol::Helper::MapTypeFromString(maptype.toString()));
|
||
//map->SetMapType(mapcontrol::Helper::MapTypeFromString("BingHybrid"));
|
||
}
|
||
else
|
||
{
|
||
//map->SetMapType(mapcontrol::Helper::MapTypeFromString("BingHybrid"));
|
||
}
|
||
*/
|
||
|
||
map->SetMapType(mapcontrol::Helper::MapTypeFromString("BingHybrid"));
|
||
|
||
map->setWPLock(true);
|
||
map->setFocus();
|
||
map->setMouseTracking(true);
|
||
|
||
map->setGeometry(0,
|
||
0,
|
||
this->width(),
|
||
this->height());
|
||
|
||
map->SetZoom(4);
|
||
|
||
map->SetCurrentPosition(internals::PointLatLng(33,106));
|
||
qDebug() << "map start";
|
||
|
||
|
||
copk = new Cockpit(this);
|
||
copk->setGeometry(this->width() - copk->width(),0,400,350);
|
||
|
||
qDebug() << "copk start";
|
||
|
||
missionUI = new propertyui(this);
|
||
missionUI->hide();
|
||
|
||
qDebug() << "missionUI start";
|
||
|
||
qRegisterMetaType<uint8_t>("uint8_t");
|
||
qRegisterMetaType<uint16_t>("uint16_t");
|
||
qRegisterMetaType<uint32_t>("uint32_t");
|
||
|
||
//commandbox ----- dlink
|
||
|
||
connect(toolsui->servosystem,SIGNAL(cmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),
|
||
dlink->mavlinknode->Commander,SLOT(WriteCmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||
toolsui->servosystem,SLOT(addVehicles(int,int)));
|
||
|
||
connect(toolsui->servosystem,SIGNAL(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),
|
||
dlink->mavlinknode->Parameter,SLOT(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),Qt::DirectConnection);
|
||
|
||
connect(commandUI,SIGNAL(Accepted(bool,uint16_t,uint8_t)),
|
||
toolsui->servosystem,SLOT(commandAccepted(bool,uint16_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
//command ----- map
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||
commandUI,SLOT(addVehicles(int,int)));
|
||
|
||
connect(map,SIGNAL(PointNumber(QList<int>)),
|
||
commandUI,SLOT(setPointCount(QList<int>)));
|
||
|
||
|
||
connect(map,SIGNAL(uav_selected(int,int)),
|
||
commandUI,SLOT(CurrentUAV(int,int)));
|
||
|
||
|
||
/*
|
||
connect(map,&mapcontrol::OPMapWidget::PointNumber,
|
||
commandUI,&CommandUI::setPointCount,Qt::DirectConnection);
|
||
*/
|
||
|
||
//this ----- dlink
|
||
connect(dlink->mavlinknode,SIGNAL(beep(int)),
|
||
this,SLOT(beep(int)));
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(CommuniationLost(bool)),
|
||
this,SLOT(setCommunicationLostState(bool)));
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(updateDlink(float,uint64_t,uint64_t)),
|
||
this,SLOT(updateDlink(float,uint64_t,uint64_t)));
|
||
|
||
connect(dlink,SIGNAL(byteCount(int,int)),
|
||
this,SLOT(dlinkCount(int,int)));
|
||
|
||
|
||
|
||
|
||
|
||
//this ----- map
|
||
connect(map,SIGNAL(TotalDistanceUpdate(double)),
|
||
this,SLOT(TotalDistance(double)));
|
||
|
||
|
||
|
||
connect(this,SIGNAL(currentGroup(int)),
|
||
map,SLOT(groupchanged(int))),
|
||
|
||
|
||
|
||
//tools ----- map
|
||
connect(dlink->mavlinknode,SIGNAL(recievemsg(mavlink_message_t)),
|
||
toolsui->index0->mavlinkinspector,SLOT(receiveMessage(mavlink_message_t)));
|
||
|
||
//dlink ----- tools
|
||
connect(toolsui->index2,SIGNAL(setPlay(bool)),
|
||
dlink->mavlinknode->replay,SLOT(startReplay(bool)),Qt::DirectConnection);
|
||
|
||
connect(toolsui->index2,SIGNAL(setFileName(QString)),
|
||
dlink->mavlinknode,SLOT(setLogfile(QString)),Qt::DirectConnection);
|
||
|
||
connect(toolsui->index2,SIGNAL(setPercentage(float)),
|
||
dlink->mavlinknode->replay,SLOT(setPercentage(float)),Qt::DirectConnection);
|
||
|
||
|
||
connect(toolsui->index2,SIGNAL(setMultiple(double)),
|
||
dlink->mavlinknode->replay,SLOT(setMultiple(double)),Qt::DirectConnection);
|
||
|
||
connect(dlink->mavlinknode->replay,SIGNAL(currentPercentage(float)),
|
||
toolsui->index2,SLOT(setCurrentPercentage(float)));
|
||
|
||
connect(dlink->mavlinknode->replay,SIGNAL(replayComplete()),
|
||
toolsui->index2,SLOT(ReplayComplete()));
|
||
|
||
|
||
//dlink --- toolui-index3
|
||
connect(dlink->mavlinknode,SIGNAL(Recieve(QString)),
|
||
toolsui->index3,SLOT(Recieve(QString)));
|
||
|
||
connect(toolsui->index3,SIGNAL(Terminal_Transmit(QString)),
|
||
dlink->mavlinknode,SLOT(Transmit(QString)),Qt::DirectConnection);
|
||
|
||
|
||
|
||
|
||
//setting ----- map
|
||
connect(setting->index0->globalsetting,SIGNAL(getMapTypes()),
|
||
map,SLOT(getMapTypes()));
|
||
|
||
connect(map,SIGNAL(MapTypes(QStringList)),
|
||
setting->index0->globalsetting,SLOT(MapTypes(QStringList)));
|
||
|
||
connect(setting->index0->globalsetting,SIGNAL(setMapTypes(QVariant)),
|
||
map,SLOT(setMapTypes(QVariant)));
|
||
|
||
|
||
connect(setting->index0->globalsetting,&GlobalSetting::setServo,
|
||
this,&MainWindow::setServoOffset);
|
||
|
||
|
||
connect(setting->index0->globalsetting,SIGNAL(mapCache(bool,qreal,qreal,qreal,qreal,qint8)),
|
||
map,SLOT(userRipMap(bool,qreal,qreal,qreal,qreal,qint8)));
|
||
|
||
|
||
connect(map,SIGNAL(ripfinished()),
|
||
setting->index0->globalsetting,SLOT(setripfinished()));
|
||
|
||
|
||
connect(map,SIGNAL(percentageChanged(int)),
|
||
setting->index0->globalsetting,SLOT(SetPercentage(int)));
|
||
|
||
connect(map,SIGNAL(numberOfTilesChanged(int,int)),
|
||
setting->index0->globalsetting,SLOT(SetNumberOfTiles(int,int)));
|
||
|
||
connect(map,SIGNAL(providerChanged(QString,int)),
|
||
setting->index0->globalsetting,SLOT(SetProvider(QString,int)));
|
||
|
||
|
||
|
||
//command ----- dlink
|
||
connect(commandUI,SIGNAL(cmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),
|
||
dlink->mavlinknode->Commander,SLOT(WriteCmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
|
||
connect(dlink->mavlinknode->Commander,SIGNAL(commandAccepted(bool,uint16_t,uint8_t)),
|
||
commandUI,SLOT(commandAccepted(bool,uint16_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
|
||
connect(commandUI,SIGNAL(WriteParam(uint8_t,uint8_t,QVariant,QVariant,QVariant)),
|
||
dlink->mavlinknode->Parameter,SLOT(WriteCmd2(uint8_t,uint8_t,QVariant,QVariant,QVariant)),Qt::DirectConnection);
|
||
|
||
|
||
//check ----- dlink
|
||
connect(checkUI,SIGNAL(cmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),
|
||
dlink->mavlinknode->Commander,SLOT(WriteCmd_long(float,float,float,float,float,float,float,uint16_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
qRegisterMetaType<mavlink_message_t>("mavlink_message_t");
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(recievemsg(mavlink_message_t)),
|
||
checkUI,SLOT(RecieveMsg(mavlink_message_t)));
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||
checkUI,SLOT(addVehicles(int,int)));
|
||
|
||
//setting ----- dlink
|
||
connect(dlink,SIGNAL(PortConnected(QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant)),
|
||
setting->index0->link,SIGNAL(PortConnect(QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant)));
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(state_updated()),
|
||
this,SLOT(updateUI()));
|
||
|
||
connect(setting->index0->link,SIGNAL(connectSignal(QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant)),
|
||
dlink,SLOT(connectSignal(QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant,QVariant)));
|
||
|
||
|
||
|
||
connect(dlink->mavlinknode->Parameter,SIGNAL(RecieveValue(mavlink_message_t)),
|
||
setting->index1->paramInspect,SLOT(appendParameter(mavlink_message_t)));
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||
setting->index1->paramInspect,SLOT(addVehicles(int,int)));
|
||
|
||
connect(setting->index1->paramInspect,SIGNAL(ReadCmd(uint8_t,uint8_t,uint8_t)),
|
||
dlink->mavlinknode->Parameter,SLOT(ReadCmd(uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
connect(setting->index1->paramInspect,SIGNAL(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),
|
||
dlink->mavlinknode->Parameter,SLOT(WriteCmd(uint8_t,uint8_t,const char*,uint8_t,float)),Qt::DirectConnection);
|
||
|
||
//mision ----- map
|
||
connect(map, SIGNAL(WPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||
missionUI,SLOT(setWayPointProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)));
|
||
|
||
connect(missionUI,SIGNAL(WayPointPropertyChanged(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||
map,SIGNAL(setWPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)));
|
||
|
||
|
||
connect(missionUI,SIGNAL(WPnearPoint(int)),
|
||
map,SLOT(WPnearPoint(int)));
|
||
|
||
connect(missionUI,SIGNAL(WPotherPoint(int)),
|
||
map,SLOT(WPotherPoint(int)));
|
||
|
||
connect(missionUI,SIGNAL(WPDelete()),
|
||
map,SLOT(WPDelete()));
|
||
|
||
connect(missionUI,SIGNAL(WPInsert()),
|
||
map,SLOT(WPInsert()));
|
||
|
||
connect(missionUI,SIGNAL(WPUpload()),
|
||
map,SLOT(WPUpload()));
|
||
|
||
connect(missionUI,SIGNAL(WPDownload()),
|
||
map,SLOT(WPDownload()));
|
||
|
||
connect(missionUI,SIGNAL(WPSave(QString)),
|
||
map,SLOT(WPSave(QString)));
|
||
|
||
connect(missionUI,SIGNAL(WPLoad(QString)),
|
||
map,SLOT(WPLoad(QString)));
|
||
|
||
connect(missionUI,SIGNAL(WPGroup(int)),
|
||
map,SLOT(WPGroup(int)));
|
||
|
||
connect(missionUI,SIGNAL(WPDeleteAll()),
|
||
map,SLOT(WPDeleteAll()));
|
||
|
||
connect(missionUI,SIGNAL(WPAdd()),
|
||
map,SLOT(WPAdd()));
|
||
|
||
|
||
connect(map,SIGNAL(allPoint(QMap<int,int>)),
|
||
missionUI,SLOT(setallPoint(QMap<int,int>)));
|
||
|
||
connect(missionUI,SIGNAL(searchall()),
|
||
map,SLOT(WPsearchall()));
|
||
|
||
|
||
connect(missionUI,SIGNAL(getAllPoints(int)),
|
||
map,SLOT(getAllPoints(int)));
|
||
|
||
|
||
connect(map,SIGNAL(settableGroup(int)),
|
||
missionUI,SIGNAL(settableGroup(int)));
|
||
|
||
connect(map,SIGNAL(measureState(bool)),
|
||
missionUI,SLOT(measureState(bool)));
|
||
|
||
connect(map,SIGNAL(settableClicked()),
|
||
missionUI,SLOT(on_pushButton_Table_clicked()));
|
||
|
||
connect(map,SIGNAL(setrulerClicked()),
|
||
missionUI,SLOT(on_pushButton_Ruler_clicked()));
|
||
|
||
|
||
connect(map,SIGNAL(mousePosition(qreal,qreal)),
|
||
missionUI,SIGNAL(mousePosition(qreal,qreal)));
|
||
|
||
connect(missionUI,SIGNAL(exitRuler()),
|
||
map,SLOT(ruler_clicked()));
|
||
|
||
|
||
connect(map,SIGNAL(createFenceCircle(int,qreal,bool,qreal,qreal)),
|
||
missionUI,SIGNAL(createFenceCircle(int,qreal,bool,qreal,qreal)));
|
||
|
||
connect(map,SIGNAL(createFencePolygon(int,qreal,bool,QList<QPointF>)),
|
||
missionUI,SIGNAL(createFencePolygon(int,qreal,bool,QList<QPointF>)));
|
||
|
||
|
||
connect(missionUI,SIGNAL(setFenceCircle(int,qreal,bool,qreal,qreal)),
|
||
map,SLOT(setFenceCircle(int,qreal,bool,qreal,qreal)));
|
||
|
||
connect(missionUI,SIGNAL(setFencePolygon(int,qreal,bool,QList<QPointF>)),
|
||
map,SLOT(setFencePolygon(int,qreal,bool,QList<QPointF>)));
|
||
|
||
connect(missionUI,SIGNAL(addCircle()),
|
||
map,SLOT(addCircle()));
|
||
|
||
connect(missionUI,SIGNAL(addPolygon()),
|
||
map,SLOT(addPolygon()));
|
||
|
||
connect(missionUI,SIGNAL(delFence(int)),
|
||
map,SLOT(delFence(int)));
|
||
|
||
|
||
connect(map,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)),
|
||
missionUI,SIGNAL(updateFenceCircle(int,qreal,bool,qreal,qreal)));
|
||
|
||
connect(map,SIGNAL(updateFencePolygon(int,qreal,bool,QList<QPointF>)),
|
||
missionUI,SIGNAL(updateFencePolygon(int,qreal,bool,QList<QPointF>)));
|
||
|
||
|
||
connect(map,SIGNAL(currentPointSeleted(int,int)),
|
||
missionUI,SIGNAL(currentPointSeleted(int,int)),Qt::DirectConnection);
|
||
|
||
|
||
connect(missionUI,SIGNAL(getCurrentPoint(int)),
|
||
map,SLOT(getCurrentPoint(int)),Qt::DirectConnection);
|
||
|
||
|
||
connect(map,SIGNAL(FenceGroupChanged(int,int)),
|
||
missionUI,SIGNAL(FenceGroupChanged(int,int)),Qt::DirectConnection);
|
||
|
||
connect(map,SIGNAL(clearTable()),
|
||
missionUI,SLOT(clearTable()),Qt::DirectConnection);
|
||
|
||
|
||
connect(map,SIGNAL(MeasurePosition(int,qreal,qreal)),
|
||
missionUI,SIGNAL(MeasurePosition(int,qreal,qreal)),Qt::DirectConnection);
|
||
|
||
connect(map,SIGNAL(Lineinfo(qreal,qreal)),
|
||
missionUI,SIGNAL(Lineinfo(qreal,qreal)),Qt::DirectConnection);
|
||
|
||
|
||
connect(missionUI,SIGNAL(valuechanged(int,qreal)),
|
||
map,SLOT(MeasureValueChanged(int,qreal)));
|
||
|
||
|
||
connect(map,SIGNAL(closeMissionDialog(bool)),
|
||
missionUI,SLOT(closeMissionDialog(bool)),Qt::DirectConnection);
|
||
|
||
|
||
//dlink ----- map
|
||
connect(map,SIGNAL(signal_WPDownload(uint8_t,uint8_t,int)),
|
||
dlink->mavlinknode->Mission,SLOT(ReadCmd(uint8_t,uint8_t,int)),Qt::DirectConnection);
|
||
|
||
connect(map,SIGNAL(signal_WPUpload(uint8_t,uint8_t,uint32_t,int)),
|
||
dlink->mavlinknode->Mission,SLOT(WriteCmd(uint8_t,uint8_t,uint32_t,int)),Qt::DirectConnection);
|
||
|
||
|
||
//生成航线必须在map线程完成,因此不能直接连接
|
||
//停下来让ui、运行一下
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(receivedPoint(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||
map,SLOT(receivedPoint(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),Qt::BlockingQueuedConnection);
|
||
|
||
connect(map,SIGNAL(WPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||
dlink->mavlinknode->Mission,SLOT(transmitPoint(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);
|
||
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(clearWaypoint()),
|
||
map,SLOT(WPDeleteAll()));
|
||
|
||
|
||
connect(dlink->mavlinknode,SIGNAL(addVehicles(int,int)),
|
||
map,SLOT(addUAV(int,int)));
|
||
|
||
connect(map,SIGNAL(uav_selected(int,int)),
|
||
dlink->mavlinknode,SLOT(setCurrentSelected(int,int)),Qt::DirectConnection);
|
||
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(sendItemOK(uint16_t,bool)),
|
||
map,SLOT(WPSendItemOK(uint16_t,bool)));
|
||
|
||
connect(map,SIGNAL(sendFence(qreal,qreal,qreal,qreal,uint16_t,uint16_t,uint16_t,uint16_t,uint16_t)),
|
||
dlink->mavlinknode->Mission,SLOT(sendFence(qreal,qreal,qreal,qreal,uint16_t,uint16_t,uint16_t,uint16_t,uint16_t)),Qt::DirectConnection);
|
||
|
||
|
||
connect(map,SIGNAL(getMissionFromVehicle(int)),
|
||
dlink->mavlinknode->Mission,SLOT(checkoutVehicle(int)),Qt::DirectConnection);
|
||
|
||
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(vehicleChanged(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||
map,SLOT(vehicleChanged(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)));
|
||
|
||
|
||
//map ----- commandui
|
||
connect(map,SIGNAL(setCurrent(int,int)),
|
||
commandUI,SLOT(missionConfirm(int,int)));
|
||
|
||
|
||
connect(commandUI,SIGNAL(SetCurrentPoint(int)),
|
||
dlink->mavlinknode->Mission,SLOT(SetCurrentPoint(int)),Qt::DirectConnection);
|
||
|
||
connect(commandUI,SIGNAL(getAllPoint(int)),
|
||
map,SLOT(find_PointNumber(int)));
|
||
|
||
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)),
|
||
map,SLOT(WPSetCurrent(int)));
|
||
|
||
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)),
|
||
menuBarUI,SLOT(setTargetPoint(int)));
|
||
|
||
/*
|
||
connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)),
|
||
toolsui->diagram,SLOT(setTargetPoint(int)));
|
||
*/
|
||
|
||
|
||
//=======setting=====tools====
|
||
connect(setting->index1->paramInspect,SIGNAL(APversion(QString)),
|
||
toolsui->servosystem,SLOT(setAPversion(QString)));
|
||
|
||
connect(setting->index1->paramInspect,SIGNAL(HILMode(QString)),
|
||
toolsui->servosystem,SLOT(setHILMode(QString)));
|
||
|
||
|
||
connect(setting->index0->globalsetting,&GlobalSetting::setServo,
|
||
toolsui->servosystem,&ServoSystem::setServoOffset);
|
||
|
||
|
||
//==== showmessage=====
|
||
connect(toolsui->servosystem,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
connect(commandUI,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
connect(copk,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
connect(dlink,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
connect(map,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
connect(setting->index1->paramInspect,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
|
||
connect(setting->index0->globalsetting,SIGNAL(showMessage(QString,int)),this,SLOT(showMessage(QString,int)));
|
||
|
||
|
||
|
||
//connect(menuBarUI,SIGNAL(NewMessage(QString)),toolsui->index1,SLOT(setLog(QString)),Qt::DirectConnection);
|
||
|
||
qDebug() << "main window start";
|
||
//监测ssl,用于网络连接
|
||
qDebug()<<"QSslSocket="<<QSslSocket::sslLibraryBuildVersionString();
|
||
qDebug() << "OpenSSL支持情况:" << QSslSocket::supportsSsl();
|
||
|
||
showMessage("SslSocket库版本:" + QSslSocket::sslLibraryBuildVersionString());
|
||
showMessage((QSslSocket::supportsSsl())?("OpenSSL:支持"):("OpenSSL:不支持,地图缓存可能会受到影响"));
|
||
|
||
|
||
|
||
Timer_1s = new QTimer();
|
||
Timer_1s->setInterval(1000);
|
||
connect(Timer_1s,&QTimer::timeout,
|
||
this,&MainWindow::Timer_1s_out);
|
||
|
||
|
||
|
||
FlightTime = new QDateTime();
|
||
//FlightTime->setTime(QDateTime::currentDateTime().time());
|
||
|
||
StartupTime = new QDateTime();
|
||
//StartupTime->setTime(QDateTime::currentDateTime().time());
|
||
|
||
|
||
|
||
connect(setting->index0->globalsetting,&GlobalSetting::setGCSID,
|
||
dlink->mavlinknode,&MavLinkNode::setGCSID,Qt::DirectConnection);
|
||
|
||
connect(setting->index0->globalsetting,&GlobalSetting::setHeartBeat,
|
||
dlink->mavlinknode,&MavLinkNode::setHeartbeat,Qt::DirectConnection);
|
||
|
||
|
||
//设置地面站ID
|
||
setting->index0->globalsetting->getGCSID();
|
||
setting->index0->globalsetting->getServo();
|
||
|
||
setting->index0->globalsetting->getHeartBeat();
|
||
|
||
}
|
||
|
||
MainWindow::~MainWindow()
|
||
{
|
||
if(tts)
|
||
{
|
||
tts->stop();
|
||
delete tts;
|
||
tts = nullptr;
|
||
}
|
||
|
||
if(map)
|
||
{
|
||
map->close();
|
||
delete map;
|
||
}
|
||
|
||
if(dlink)
|
||
{
|
||
//dlink->stopPort();
|
||
delete dlink;
|
||
}
|
||
|
||
if(copk)
|
||
{
|
||
copk->close();
|
||
delete copk;
|
||
}
|
||
|
||
QCoreApplication::quit();//退出所有窗口
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void MainWindow::closeEvent(QCloseEvent *event)
|
||
{
|
||
event->accept();
|
||
QCoreApplication::quit();//退出所有
|
||
}
|
||
|
||
void MainWindow::resizeEvent(QResizeEvent *event)
|
||
{
|
||
qDebug() << event;
|
||
|
||
Q_UNUSED(event)
|
||
|
||
|
||
menuBarUI->setGeometry(0,0,this->width(),100);
|
||
|
||
qDebug() << "resize";
|
||
|
||
setting->setGeometry(0,menuBarUI->height(),
|
||
this->width(),this->height() - menuBarUI->height());
|
||
|
||
checkUI->setGeometry(0,menuBarUI->height(),
|
||
this->width(),this->height() - menuBarUI->height());
|
||
|
||
|
||
map->setGeometry(0,menuBarUI->height(),
|
||
this->width()- copk->width() - statusui->width(),this->height() - menuBarUI->height());
|
||
|
||
|
||
|
||
//if(MainIndex == 5)//renwu
|
||
{
|
||
if(statusui->isHidden())
|
||
map->setGeometry(0,menuBarUI->height(),
|
||
this->width()- copk->width(),this->height() - menuBarUI->height());
|
||
}
|
||
|
||
if(MainIndex == 2)//renwu
|
||
{
|
||
if(statusui->isHidden())
|
||
{
|
||
if(missionUI->isHidden())
|
||
{
|
||
map->setGeometry(0,menuBarUI->height(),
|
||
this->width(),this->height() - menuBarUI->height());//隐藏missionUI
|
||
}
|
||
else
|
||
{
|
||
map->setGeometry(0,menuBarUI->height(),
|
||
this->width()- copk->width(),this->height() - menuBarUI->height());//显示missionUI
|
||
}
|
||
|
||
}
|
||
}
|
||
/*
|
||
if(MainIndex == 2)//renwu
|
||
{
|
||
qDebug() << "renwu";
|
||
map->setGeometry(0,menuBarUI->height(),
|
||
this->width(),this->height() - menuBarUI->height());
|
||
}
|
||
*/
|
||
|
||
|
||
copk->setGeometry(this->width() - copk->width(),menuBarUI->height(),
|
||
copk->width(),copk->height());
|
||
|
||
healthui->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height(),
|
||
copk->width(),healthui->height());
|
||
|
||
|
||
statusui->setGeometry(map->width(),
|
||
menuBarUI->height(),
|
||
statusui->width(),//copk->width() * 1.0,
|
||
this->height() - menuBarUI->height());
|
||
|
||
|
||
missionUI->setGeometry(this->width() - copk->width(),menuBarUI->height(),
|
||
copk->width(),this->height() - menuBarUI->height());
|
||
|
||
|
||
|
||
if(!healthui->isHidden())
|
||
{
|
||
commandUI->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height() + healthui->height(),
|
||
copk->width(),this->height() - menuBarUI->height() - copk->height() - healthui->height());
|
||
}
|
||
else
|
||
{
|
||
commandUI->setGeometry(this->width() - copk->width(),menuBarUI->height() + copk->height(),
|
||
copk->width(),this->height() - menuBarUI->height() - copk->height());
|
||
}
|
||
|
||
|
||
toolsui->setGeometry(0,menuBarUI->height(),
|
||
this->width(),this->height() - menuBarUI->height());
|
||
|
||
update();
|
||
}
|
||
|
||
//这个是不必要的,因为每个部件都有自己相应的动作
|
||
void MainWindow::mousePressEvent(QMouseEvent* event)
|
||
{
|
||
if(event->buttons() == Qt::MiddleButton)
|
||
{
|
||
if(!healthui->isHidden())
|
||
{
|
||
healthui->hide();
|
||
}
|
||
else
|
||
{
|
||
healthui->show();
|
||
}
|
||
}
|
||
|
||
resizeEvent(nullptr);
|
||
|
||
}
|
||
|
||
void MainWindow::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
||
{
|
||
qInfo() << "key" << event;
|
||
//qDebug() << event;
|
||
switch(event->key())
|
||
{
|
||
case Qt::Key_Up:
|
||
qDebug() << "Key_Up";
|
||
break;
|
||
case Qt::Key_Down:
|
||
qDebug() << "Key_Down";
|
||
break;
|
||
case Qt::Key_Left:
|
||
qDebug() << "Key_Left";
|
||
break;
|
||
case Qt::Key_Right:
|
||
qDebug() << "Key_Right";
|
||
break;
|
||
case Qt::Key_D:
|
||
if(event->modifiers() == Qt::AltModifier)
|
||
{
|
||
qInfo() << "alt + D";
|
||
}
|
||
break;
|
||
case Qt::Key_U :
|
||
{
|
||
if(event->modifiers() == Qt::AltModifier)
|
||
{
|
||
qInfo() << "atl + U";
|
||
}
|
||
}break;
|
||
case Qt::Key_P :
|
||
{
|
||
if(event->modifiers() == Qt::AltModifier)
|
||
{//下载参数
|
||
qInfo() << "atl + P";
|
||
}
|
||
}break;
|
||
case Qt::Key_O :
|
||
{
|
||
if(event->modifiers() == Qt::AltModifier)
|
||
{//上传参数
|
||
qInfo() << "atl + O";
|
||
}
|
||
}break;
|
||
case Qt::Key_S:
|
||
break;
|
||
case Qt::Key_W:
|
||
break;
|
||
case Qt::Key_K :
|
||
{
|
||
if(event->modifiers() == Qt::ControlModifier)
|
||
{
|
||
|
||
}
|
||
}
|
||
break;
|
||
case Qt::Key_Space :
|
||
{
|
||
//map->setcu
|
||
map->SetCurrentPosition();
|
||
//根据选中的飞机设置当前位置
|
||
}
|
||
break;
|
||
case Qt::Key_Equal :
|
||
{
|
||
if(event->modifiers() == Qt::ShiftModifier)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
map->SetZoom(map->ZoomReal() + 1);
|
||
}
|
||
}
|
||
break;
|
||
case Qt::Key_Plus :
|
||
{
|
||
if(event->modifiers() == Qt::ShiftModifier)
|
||
{
|
||
|
||
}
|
||
}
|
||
break;
|
||
case Qt::Key_Minus:
|
||
{
|
||
if(event->modifiers() == Qt::ShiftModifier)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
map->SetZoom(map->ZoomReal() - 1);
|
||
}
|
||
}
|
||
break;
|
||
case Qt::Key_C:
|
||
{
|
||
if(event->modifiers() == Qt::AltModifier)
|
||
{
|
||
map->DeleteTrail();
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
|
||
QWidget::keyPressEvent(event);
|
||
}
|
||
|
||
bool MainWindow::event(QEvent *event)
|
||
{
|
||
return QWidget::event(event);
|
||
}
|
||
|
||
|
||
void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
||
{
|
||
//记录主界面目录
|
||
MainIndex = index;
|
||
//设置
|
||
if(index == 0) setting->show();
|
||
else setting->hide();
|
||
|
||
//自检
|
||
if(index == 1) checkUI->show();
|
||
else checkUI->hide();
|
||
|
||
//任务
|
||
if(index == 2)
|
||
{
|
||
map->setWPLock(false);
|
||
map->setWPCreate(true);
|
||
//missionUI->show();
|
||
missionUI->hide();
|
||
|
||
}
|
||
else
|
||
{
|
||
map->setWPLock(true);
|
||
map->setWPCreate(false);
|
||
missionUI->hide();
|
||
}
|
||
|
||
if((index == 2)||(index == 3)||(index == 5)) map->show();
|
||
else map->hide();
|
||
|
||
|
||
//飞行
|
||
if(index == 3)
|
||
{
|
||
copk->show();
|
||
commandUI->show();
|
||
//statusui->show();
|
||
healthui->show();
|
||
|
||
}
|
||
else
|
||
{
|
||
copk->hide();
|
||
commandUI->hide();
|
||
//statusui->hide();
|
||
healthui->hide();
|
||
}
|
||
|
||
|
||
//信息
|
||
if(index == 4) toolsui->show();
|
||
else toolsui->hide();
|
||
|
||
|
||
if(index == 5)
|
||
{
|
||
if(statusui->isHidden())
|
||
{
|
||
copk->show();
|
||
commandUI->show();
|
||
statusui->show();
|
||
healthui->show();
|
||
}
|
||
else
|
||
{
|
||
copk->show();
|
||
commandUI->show();
|
||
statusui->hide();
|
||
healthui->show();
|
||
}
|
||
|
||
|
||
//得到航线组数,数据为1,2,3,4
|
||
//emit currentGroup(group + 1);
|
||
}
|
||
else
|
||
{
|
||
statusui->hide();
|
||
}
|
||
|
||
|
||
resizeEvent(nullptr);
|
||
}
|
||
|
||
|
||
|
||
void MainWindow::showMessage(const QString &message, int TimeOut)
|
||
{
|
||
menuBarUI->showMessage(message,TimeOut);
|
||
|
||
toolsui->index1->setLog(message);
|
||
}
|
||
|
||
void MainWindow::beep(int id)
|
||
{
|
||
Q_UNUSED(id)
|
||
QApplication::beep();
|
||
}
|
||
|
||
|
||
void MainWindow::setCommunicationLostState(bool flag)
|
||
{
|
||
static bool last = false;
|
||
|
||
isCommunicationLost = flag;
|
||
|
||
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
|
||
|
||
if(flag == true)//通讯丢失
|
||
{
|
||
if(last != flag)
|
||
{
|
||
showMessage(tr("Communication Lost"),3000);
|
||
tts->say(tr("Communication Lost"));
|
||
}
|
||
|
||
healthui->setState(1,HealthUI::state::failure);
|
||
healthui->setState(2,HealthUI::state::failure);
|
||
healthui->setState(4,HealthUI::state::failure);
|
||
healthui->setState(3,HealthUI::state::failure);
|
||
healthui->setState(5,HealthUI::state::failure);
|
||
healthui->setState(6,HealthUI::state::failure);
|
||
healthui->setState(7,HealthUI::state::failure);
|
||
healthui->setState(8,HealthUI::state::failure);
|
||
healthui->setState(9,HealthUI::state::failure);
|
||
healthui->setState(10,HealthUI::state::failure);
|
||
healthui->setState(11,HealthUI::state::failure);
|
||
healthui->setState(12,HealthUI::state::failure);
|
||
healthui->setState(13,HealthUI::state::failure);
|
||
healthui->setState(14,HealthUI::state::failure);
|
||
healthui->setState(15,HealthUI::state::failure);
|
||
healthui->setState(16,HealthUI::state::failure);
|
||
healthui->setState(17,HealthUI::state::failure);
|
||
healthui->setState(18,HealthUI::state::failure);
|
||
healthui->setState(19,HealthUI::state::failure);
|
||
healthui->setState(20,HealthUI::state::failure);
|
||
|
||
healthui->setState(21,HealthUI::state::failure);
|
||
healthui->setState(22,HealthUI::state::failure);
|
||
healthui->setState(23,HealthUI::state::failure);
|
||
healthui->setState(24,HealthUI::state::failure);
|
||
healthui->setState(25,HealthUI::state::failure);
|
||
|
||
healthui->setState(26,HealthUI::state::failure);
|
||
healthui->setState(27,HealthUI::state::failure);
|
||
healthui->setState(28,HealthUI::state::failure);
|
||
healthui->setState(29,HealthUI::state::failure);
|
||
healthui->setState(30,HealthUI::state::failure);
|
||
|
||
healthui->setState(31,HealthUI::state::failure);
|
||
healthui->setState(32,HealthUI::state::failure);
|
||
healthui->setState(33,HealthUI::state::failure);
|
||
healthui->setState(34,HealthUI::state::failure);
|
||
healthui->setState(35,HealthUI::state::failure);
|
||
|
||
|
||
healthui->setState(36,HealthUI::state::failure);
|
||
healthui->setState(37,HealthUI::state::failure);
|
||
healthui->setState(38,HealthUI::state::failure);
|
||
healthui->setState(39,HealthUI::state::failure);
|
||
healthui->setState(40,HealthUI::state::failure);
|
||
|
||
}
|
||
else
|
||
{
|
||
if(last != flag)
|
||
{
|
||
showMessage(tr("Communication Regain"),3000);
|
||
tts->say(tr("Communication Regain"));
|
||
}
|
||
}
|
||
|
||
last = flag;
|
||
}
|
||
|
||
|
||
void MainWindow::updateDlink(float rssi,uint64_t in,uint64_t out)
|
||
{
|
||
statusui->setDlink(1,QString::number(rssi,'f',0),
|
||
tr("R:%1 / T:%2").arg(QString::number(in)).arg(QString::number(dlinkout)));
|
||
}
|
||
|
||
|
||
void MainWindow::dlinkCount(int in,int out)
|
||
{
|
||
dlinkout = out;
|
||
}
|
||
|
||
|
||
|
||
void MainWindow::setServoOffset(QVariant dirla, QVariant dirra, QVariant dirle, QVariant dirre, QVariant dirru,
|
||
QVariant maxla, QVariant maxra, QVariant maxle, QVariant maxre, QVariant maxru,
|
||
QVariant scalela, QVariant scalera, QVariant scalele, QVariant scalere, QVariant scaleru,
|
||
QVariant la, QVariant ra,QVariant le, QVariant re,QVariant ru)
|
||
{
|
||
dir_la = dirla;
|
||
dir_ra = dirra;
|
||
dir_le = dirle;
|
||
dir_re = dirre;
|
||
dir_ru = dirru;
|
||
|
||
max_la = maxla;
|
||
max_ra = maxra;
|
||
max_le = maxle;
|
||
max_re = maxre;
|
||
max_ru = maxru;
|
||
|
||
scale_la = scalela;
|
||
scale_ra = scalera;
|
||
scale_le = scalele;
|
||
scale_re = scalere;
|
||
scale_ru = scaleru;
|
||
|
||
bias_la = la;
|
||
bias_ra = ra;
|
||
bias_le = le;
|
||
bias_re = re;
|
||
bias_ru = ru;
|
||
}
|
||
|
||
// 16~20Hz左右 运行频率可能太高
|
||
void MainWindow::updateUI()//事件驱动式更新数据
|
||
{
|
||
static uint32_t custommode_old = 0;
|
||
static uint8_t state_old = 0;
|
||
bool isCustomChanged = false;
|
||
bool isStateChanged = false;
|
||
|
||
static quint64 lastTime = QDateTime::currentMSecsSinceEpoch();
|
||
|
||
static qint64 frq_time = 0;
|
||
if((QDateTime::currentMSecsSinceEpoch() - frq_time) <= 200)
|
||
{
|
||
return;
|
||
}
|
||
frq_time = QDateTime::currentMSecsSinceEpoch();
|
||
|
||
int currentUAV = map->getUAVCurrent();
|
||
|
||
|
||
if(currentUAV < 1)//滤掉错值
|
||
{
|
||
return;
|
||
}
|
||
|
||
|
||
//经纬度大于正常值,将舍弃 更新所有飞机的信息,
|
||
foreach (MavLinkNode::_vehicle v, dlink->mavlinknode->vehicleList) {
|
||
double lat = (double)(v.gps_raw_int.lat * 10e-8);
|
||
double lng = (double)(v.gps_raw_int.lon * 10e-8);
|
||
|
||
if(((lat > -90)&&(lat < 90))&&((lng > -180)&&(lng < 180)))
|
||
{
|
||
map->setUAVPos(v.sysid,
|
||
v.compid,
|
||
(double)(v.gps_raw_int.lat * 10e-8),
|
||
(double)(v.gps_raw_int.lon * 10e-8),
|
||
(double)(v.gps_raw_int.alt * 10e-4));
|
||
}
|
||
|
||
map->setUAVHeading(v.sysid,
|
||
v.compid,
|
||
v.attitude.yaw * 57.3);
|
||
|
||
|
||
map->setUAVSpeed(v.sysid,
|
||
v.compid,
|
||
v.emb_atom_com.mach,
|
||
v.vfr_hud.airspeed);
|
||
}
|
||
|
||
//只更新当前选择的飞机信息
|
||
MavLinkNode::_vehicle vehicle = dlink->mavlinknode->vehicleList.value(currentUAV);
|
||
|
||
|
||
|
||
copk->setAttitude(vehicle.attitude.pitch * 57.3,
|
||
vehicle.attitude.roll * 57.3,
|
||
vehicle.attitude.yaw * 57.3);
|
||
|
||
|
||
copk->setAltitude(vehicle.global_position_int.alt * 10e-4);
|
||
copk->setAltitudeTarget(vehicle.global_position_int.alt * 10e-4
|
||
+vehicle.nav_controller_output.alt_error);
|
||
|
||
switch (copk->AltitudeFlag()) {
|
||
default:
|
||
case 0://绝对
|
||
copk->setHeight(vehicle.global_position_int.alt * 10e-4);
|
||
|
||
break;
|
||
case 1://相对
|
||
copk->setHeight(vehicle.global_position_int.relative_alt * 10e-4);
|
||
|
||
break;
|
||
case 2://气压
|
||
copk->setHeight(vehicle.vfr_hud.alt);
|
||
|
||
break;
|
||
|
||
}
|
||
|
||
|
||
//vehicle.vfr_hud.airspeed //表速
|
||
//vehicle.gps_raw_int.vel//地速
|
||
|
||
copk->setAirSpeed(vehicle.emb_atom_com.Airspeed,5);//真空速
|
||
copk->setAirSpeedTarget(vehicle.emb_atom_com.Airspeed
|
||
+vehicle.nav_controller_output.aspd_error,5);
|
||
|
||
//c t g m
|
||
switch (copk->AirSpeedFlag()) {
|
||
case 0:
|
||
copk->setSpeed(vehicle.vfr_hud.airspeed,copk->AirSpeedFlag());//表速
|
||
break;
|
||
case 1:
|
||
copk->setSpeed(vehicle.emb_atom_com.Airspeed,copk->AirSpeedFlag());//真空速
|
||
break;
|
||
case 2:
|
||
copk->setSpeed(vehicle.gps_raw_int.vel * 0.01,copk->AirSpeedFlag());//地速
|
||
break;
|
||
case 3:
|
||
copk->setSpeed(vehicle.emb_atom_com.mach,copk->AirSpeedFlag());//马赫
|
||
break;
|
||
|
||
}
|
||
|
||
copk->setAOA(vehicle.emb_atom_com.alpha);
|
||
copk->setOL(vehicle.ins1.az/(-9.8));
|
||
|
||
|
||
copk->setVerticalSpeed(-vehicle.global_position_int.vz * 10e-3);//速度朝下为正
|
||
|
||
|
||
|
||
copk->setAlt_err(vehicle.nav_controller_output.alt_error);//高度差 飞机在航线下面为正
|
||
copk->setXTrack(vehicle.nav_controller_output.xtrack_error);//侧偏距 飞机在航线右侧为正
|
||
|
||
copk->setRollTarget(vehicle.nav_controller_output.nav_roll);//
|
||
copk->setPitchTarget(vehicle.nav_controller_output.nav_pitch);//
|
||
copk->setYawTarget(vehicle.nav_controller_output.nav_bearing);//
|
||
|
||
|
||
|
||
QString gps_str;
|
||
gps_str.clear();
|
||
|
||
switch (vehicle.gps_raw_int.fix_type) {
|
||
case 1:
|
||
gps_str.append(tr("未定位"));
|
||
break;
|
||
case 2:
|
||
case 3:
|
||
gps_str.append(tr("%1D[%2颗]").arg(vehicle.gps_raw_int.fix_type).arg(vehicle.gps_raw_int.satellites_visible));
|
||
break;
|
||
case 4:
|
||
gps_str.append(tr("fix[%1颗]").arg(vehicle.gps_raw_int.satellites_visible));
|
||
break;
|
||
case 5:
|
||
gps_str.append(tr("float[%1颗]").arg(vehicle.gps_raw_int.satellites_visible));
|
||
break;
|
||
default:
|
||
gps_str.append(tr("err[%1颗]").arg(vehicle.gps_raw_int.satellites_visible));
|
||
break;
|
||
}
|
||
|
||
copk->setGPS(gps_str);
|
||
|
||
|
||
//QApplication::processEvents();
|
||
|
||
/*
|
||
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();
|
||
|
||
uint8_t state = 0;
|
||
|
||
state = (vehicle.heartbeat.base_mode&MAV_MODE_FLAG::MAV_MODE_FLAG_SAFETY_ARMED);
|
||
|
||
if(state != state_old)
|
||
{
|
||
isStateChanged = true;
|
||
|
||
//解锁后清除航迹
|
||
if(state == MAV_MODE_FLAG::MAV_MODE_FLAG_SAFETY_ARMED)
|
||
{
|
||
|
||
FlightTime->setTime(QDateTime::currentDateTime().time());
|
||
|
||
map->DeleteTrail();
|
||
|
||
StartPoint = map->CurrentPosition();
|
||
|
||
}
|
||
else
|
||
{
|
||
/*
|
||
if(menuBarUI)
|
||
menuBarUI->setArm(false);
|
||
*/
|
||
}
|
||
}
|
||
else
|
||
{
|
||
isStateChanged = false;
|
||
}
|
||
state_old = state;
|
||
|
||
|
||
switch (state) {
|
||
case MAV_MODE_FLAG_SAFETY_ARMED:
|
||
arm_str.append(tr("ARM"));
|
||
menuBarUI->setFlightTime(QTime::fromMSecsSinceStartOfDay(FlightTime->time().msecsTo(QDateTime::currentDateTime().time())));//飞行时长
|
||
//toolsui->diagram->setTime(4,QTime::fromMSecsSinceStartOfDay(FlightTime->time().msecsTo(QDateTime::currentDateTime().time())));//飞行时长
|
||
break;
|
||
case 0:
|
||
arm_str.append(tr("DISARM"));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
copk->setState(arm_str);
|
||
|
||
uint32_t custommode = vehicle.heartbeat.custom_mode;
|
||
|
||
if(custommode != custommode_old)
|
||
{
|
||
isCustomChanged = true;
|
||
}
|
||
else
|
||
{
|
||
isCustomChanged = false;
|
||
}
|
||
custommode_old = custommode;
|
||
|
||
|
||
QString mode_str;
|
||
switch (custommode) {
|
||
case 1<<16:
|
||
mode_str.append(tr("MANUAL"));
|
||
break;
|
||
case 2<<16:
|
||
mode_str.append(tr("ALTCTL"));
|
||
break;
|
||
case 3<<16:
|
||
mode_str.append(tr("POSCTL"));
|
||
break;
|
||
case 4<<16:
|
||
mode_str.append(tr("AUTO"));
|
||
break;
|
||
case 5<<16:
|
||
mode_str.append(tr("ACRO"));
|
||
break;
|
||
case 6<<16:
|
||
mode_str.append(tr("OFFBOARD"));
|
||
break;
|
||
case 7<<16:
|
||
mode_str.append(tr("STABILIZED"));
|
||
break;
|
||
case 8<<16:
|
||
mode_str.append(tr("RATTITUDE"));
|
||
break;
|
||
case 9<<16:
|
||
mode_str.append(tr("STANDBY"));
|
||
break;
|
||
case 10<<16:
|
||
mode_str.append(tr("BIT"));
|
||
break;
|
||
case (4<<16)+(1<<24):
|
||
mode_str.append(tr("AUTO_READY"));
|
||
break;
|
||
case (4<<16)+(2<<24):
|
||
mode_str.append(tr("AUTO_TAKEOFF"));
|
||
break;
|
||
case (4<<16)+(3<<24):
|
||
mode_str.append(tr("AUTO_LOITER"));
|
||
break;
|
||
case (4<<16)+(4<<24):
|
||
mode_str.append(tr("AUTO_MISSION"));
|
||
break;
|
||
case (4<<16)+(5<<24):
|
||
mode_str.append(tr("AUTO_RTL"));
|
||
break;
|
||
case (4<<16)+(6<<24):
|
||
mode_str.append(tr("AUTO_LAND"));
|
||
break;
|
||
case (4<<16)+(7<<24):
|
||
mode_str.append(tr("AUTO_RTGS"));
|
||
break;
|
||
case (4<<16)+(8<<24):
|
||
mode_str.append(tr("AUTO_FOLLOW_TARGET"));
|
||
break;
|
||
default:
|
||
mode_str.append(QString::number(custommode));
|
||
break;
|
||
}
|
||
copk->setMode(mode_str);
|
||
|
||
|
||
//这里会一直生成一个,导致无法释放
|
||
if(isStateChanged == true)
|
||
{
|
||
|
||
tts->say(arm_str);
|
||
}
|
||
|
||
if(isCustomChanged == true)
|
||
{
|
||
mode_str.append(tr("flight mode"));
|
||
tts->say(mode_str);
|
||
}
|
||
|
||
|
||
|
||
uint32_t health = vehicle.sys_status.onboard_control_sensors_health;
|
||
uint32_t enable = vehicle.sys_status.onboard_control_sensors_enabled;
|
||
uint32_t present = vehicle.sys_status.onboard_control_sensors_present;
|
||
|
||
uint64_t time;
|
||
uint64_t date;
|
||
|
||
|
||
if(getBit(health,12)?(true):(false))
|
||
{
|
||
time = ((uint64_t)vehicle.ins1.time)% 1000000;
|
||
date = ((uint64_t)vehicle.ins1.time)/ 1000000;
|
||
}
|
||
else
|
||
{
|
||
time = ((uint64_t)vehicle.ins2.time)% 1000000;
|
||
date = ((uint64_t)vehicle.ins2.time)/ 1000000;
|
||
}
|
||
|
||
menuBarUI->setTargetAlt(vehicle.sys_status.load);
|
||
|
||
uint8_t hour = time / 10000;
|
||
|
||
if(hour >= 24){
|
||
hour -= 24;
|
||
}
|
||
|
||
uint8_t min = (time % 10000)/100;
|
||
uint8_t sec = time % 100;
|
||
|
||
QString tim_str;
|
||
|
||
tim_str.append(QString::number(hour));
|
||
tim_str.append(":");
|
||
tim_str.append(QString::number(min));
|
||
tim_str.append(":");
|
||
tim_str.append(QString::number(sec));
|
||
|
||
menuBarUI->setTagetAirspeed(tim_str);
|
||
|
||
menuBarUI->setX(vehicle.nav_controller_output.xtrack_error);
|
||
|
||
menuBarUI->setwp_Dist(((float)vehicle.nav_controller_output.wp_dist) * 0.01);
|
||
|
||
|
||
/*
|
||
//实测,r,le,e,la,a
|
||
//有符号16位,-32767 ~ 32767
|
||
le = vehicle.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(&vehicle.turbinstate);
|
||
toolsui->powersystem->setCCMState(&vehicle.ccmstate);
|
||
|
||
toolsui->powersystem->setMa(vehicle.emb_atom_com.mach);
|
||
toolsui->powersystem->setAlt(vehicle.gps_raw_int.alt * 10e-4);
|
||
|
||
|
||
toolsui->powersystem->setFuel(QString::number(vehicle.ccmstate.volts[2],'f',0),
|
||
QString::number(vehicle.ccmstate.fuel_level * 10.0 / 65536.0f,'f',1));
|
||
|
||
toolsui->servosystem->setBUMState(&vehicle.bmustate);
|
||
toolsui->servosystem->setCCMState(&vehicle.ccmstate);
|
||
//在这里设置
|
||
toolsui->servosystem->setServoState(&vehicle.servo_output_raw);
|
||
|
||
|
||
|
||
|
||
bool v28_Low = false,v56_Low = false;
|
||
v28_Low = (((float)vehicle.bmustate.BAT1_remain_perc * 0.1) < 10)?(false):(true);
|
||
v56_Low = (((float)vehicle.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);
|
||
|
||
//两秒检测一次,如果两秒内,数据变化,说明在加热
|
||
static qint64 echo_time = 0;
|
||
static uint8_t echo_seq_old = 0;
|
||
static uint8_t echo_count = 0;
|
||
if((QDateTime::currentMSecsSinceEpoch() - echo_time) >= 2000)
|
||
{
|
||
//qDebug() << "echo" <<vehicle.ccmstate.echo_seq << echo_seq_old;
|
||
|
||
if(vehicle.ccmstate.echo_seq != echo_seq_old)
|
||
{
|
||
echo_count++;
|
||
if(echo_count >= 3)
|
||
{
|
||
echo_count = 3;
|
||
toolsui->servosystem->setCheckState(4,1);//空速管加热
|
||
healthui->setState(7,HealthUI::state::success);//AIR
|
||
}
|
||
echo_seq_old = vehicle.ccmstate.echo_seq;
|
||
}
|
||
else
|
||
{
|
||
toolsui->servosystem->setCheckState(4,0);//空速管不加热
|
||
healthui->setState(7,HealthUI::state::inital);//AIR
|
||
echo_count = 0;
|
||
}
|
||
|
||
echo_time = QDateTime::currentMSecsSinceEpoch();
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//qDebug() << health << QString::number(health,16);
|
||
|
||
// 0000 0000 0000 0000 0000 0000 0000 0000
|
||
// 选通内置(1)| |fl ccm ecu bmu sbg 内置
|
||
|
||
|
||
//qDebug() << getBit(0x00000001,0) << getBit(0x00000002,0);
|
||
//0 ok,1 fail ,2 warn
|
||
|
||
toolsui->servosystem->setCheckState(5,(getBit(enable,8))?(1):(0));
|
||
|
||
|
||
if(isCommunicationLost == false)
|
||
{
|
||
|
||
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(4,getBit(health,8)?(getBit(health,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//BMU
|
||
healthui->setState(3,getBit(health,9)?(getBit(health,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//ECU
|
||
healthui->setState(5,getBit(health,10)?(getBit(health,4)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//CCM
|
||
healthui->setState(6,(dlink->mavlinknode->isCommunicationLost)?(HealthUI::state::failure):(HealthUI::state::success));//DLINK
|
||
|
||
// 22 23 24 25 26 27 28 29
|
||
// 5525D 5803A 5607A 4525D atteck slide 解码 通讯
|
||
//healthui->setState(7,getBit(health,29)?(getBit(health,28)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//AIR
|
||
healthui->setState(8,getBit(health,5)?(getBit(health,11)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//FL
|
||
|
||
|
||
|
||
|
||
|
||
toolsui->servosystem->setCheckState(6,getBit(health,22)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
toolsui->servosystem->setCheckState(7,getBit(health,23)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
toolsui->servosystem->setCheckState(8,getBit(health,24)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
toolsui->servosystem->setCheckState(9,getBit(health,25)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
toolsui->servosystem->setCheckState(10,getBit(health,26)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
toolsui->servosystem->setCheckState(11,getBit(health,27)?(HealthUI::state::failure):(HealthUI::state::success));
|
||
|
||
|
||
|
||
/*
|
||
qDebug() << getBit(health,22)
|
||
<< getBit(health,23)
|
||
<< getBit(health,24)
|
||
<< getBit(health,25)
|
||
<< getBit(health,26)
|
||
<< getBit(health,27);
|
||
*/
|
||
|
||
/*
|
||
sbus = feedback (ra)
|
||
sbus = feedback (re)
|
||
sbus = feedback (ru)
|
||
sbus = feedback (la)
|
||
15 sbus = feedback (le)
|
||
health = 0 le la ru re ra //顺序和上面sbus一样
|
||
GBIT zero SBIT
|
||
*/
|
||
|
||
//舵机反馈是有符号16b/
|
||
|
||
uint16_t servoHealt = vehicle.servo_output_raw.servo10_raw;
|
||
|
||
//3 0 4 1 2
|
||
//1 4 0 3 2
|
||
|
||
healthui->setState(11,getBit(health,16)?(getBit(servoHealt,1)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LA
|
||
healthui->setState(12,getBit(health,13)?(getBit(servoHealt,4)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RA
|
||
healthui->setState(13,getBit(health,17)?(getBit(servoHealt,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//LE
|
||
healthui->setState(14,getBit(health,14)?(getBit(servoHealt,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RE
|
||
healthui->setState(15,getBit(health,15)?(getBit(servoHealt,2)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//RU
|
||
|
||
|
||
//19~24
|
||
|
||
if(((vehicle.turbinstate.SysState & 0x000F) == 0x04) ||
|
||
((vehicle.turbinstate.SysState & 0x000F) == 0x00))
|
||
{
|
||
healthui->setState(21,HealthUI::state::failure);//停车
|
||
}
|
||
else
|
||
{
|
||
healthui->setState(21,HealthUI::state::inital);//停车
|
||
}
|
||
|
||
//healthui->setState(21,((vehicle.turbinstate.SysState & 0x000F) == 0x04)?(HealthUI::state::failure):(HealthUI::state::inital));//停车
|
||
healthui->setState(22,getBit(health,18)?(HealthUI::state::failure):(HealthUI::state::inital));//开伞
|
||
healthui->setState(23,getBit(health,19)?(HealthUI::state::failure):(HealthUI::state::inital));//开气囊
|
||
healthui->setState(24,getBit(health,20)?(HealthUI::state::failure):(HealthUI::state::inital));//充气
|
||
healthui->setState(25,getBit(health,21)?(HealthUI::state::failure):(HealthUI::state::inital));//抛伞
|
||
|
||
//healthui->setState(26,((vehicle.turbinstate.SysState & 0x000F) >= 0x0d)?(HealthUI::state::success):(HealthUI::state::inital));//开加力
|
||
|
||
if((vehicle.turbinstate.SysState & 0x000F) >= 0x0d)
|
||
{
|
||
uint8_t sta = vehicle.turbinstate.SysState & 0x000F;
|
||
|
||
switch (sta) {
|
||
case 0x0d:
|
||
healthui->setValueState(26,tr("开加力"));
|
||
break;
|
||
case 0x0e:
|
||
healthui->setValueState(26,tr("半加力"));
|
||
break;
|
||
case 0x0f:
|
||
healthui->setValueState(26,tr("全加力"));
|
||
break;
|
||
default:
|
||
healthui->setValueState(26,tr("关加力"));
|
||
break;
|
||
}
|
||
|
||
healthui->setState(26,HealthUI::state::success);//开加力
|
||
}
|
||
else
|
||
{
|
||
healthui->setState(26,HealthUI::state::inital);//开加力
|
||
healthui->setValueState(26,tr("关加力"));
|
||
}
|
||
|
||
|
||
if(getBit(enable,6))//从0开始,获取第6位
|
||
{
|
||
healthui->setState(27,HealthUI::state::failure);//伞舱
|
||
healthui->setValueState(27,tr("伞舱开"));
|
||
}
|
||
else
|
||
{
|
||
healthui->setState(27,HealthUI::state::success);//伞舱
|
||
healthui->setValueState(27,tr("伞舱关"));
|
||
}
|
||
|
||
|
||
//healthui->setState(26,(((vehicle.servo_output_raw.servo6_raw - 1000)/10) > 110)?(HealthUI::state::success):(HealthUI::state::inital));//开加力
|
||
|
||
switch (vehicle.ins1.sys_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
healthui->setState(9,HealthUI::state::success);
|
||
healthui->setValueState(9,tr("INS解算正常"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
healthui->setState(9,HealthUI::state::failure);
|
||
healthui->setValueState(9,tr("INS星数不足"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
healthui->setState(9,HealthUI::state::failure);
|
||
healthui->setValueState(9,tr("INS内部错误"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
healthui->setState(9,HealthUI::state::failure);
|
||
healthui->setValueState(9,tr("INS速度超限"));
|
||
}break;
|
||
}
|
||
|
||
switch (vehicle.ins2.sys_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
healthui->setState(10,HealthUI::state::success);
|
||
healthui->setValueState(10,tr("SBG解算正常"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
healthui->setState(10,HealthUI::state::failure);
|
||
healthui->setValueState(10,tr("SBG星数不足"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
healthui->setState(10,HealthUI::state::failure);
|
||
healthui->setValueState(10,tr("SBG内部错误"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
healthui->setState(10,HealthUI::state::failure);
|
||
healthui->setValueState(10,tr("SBG速度超限"));
|
||
}break;
|
||
}
|
||
|
||
|
||
healthui->setState(28,getBit(health,31)?(HealthUI::state::inital):(HealthUI::state::failure));//上行有效
|
||
|
||
healthui->setState(29,getBit(health,30)?(HealthUI::state::success):(HealthUI::state::inital));
|
||
//healthui->setValueState(29,getBit(health,30)?(tr("记录已打开")):(tr("")));//sel
|
||
|
||
healthui->setState(30,getBit(health,12)?(HealthUI::state::warning):(HealthUI::state::success));//sel
|
||
healthui->setValueState(30,getBit(health,12)?(tr("连接内置惯导")):(tr("连接SBG")));//sel
|
||
|
||
|
||
//31-40
|
||
healthui->setState(31,getBit(enable,4)?(getBit(enable,3)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//内置记录
|
||
healthui->setState(32,getBit(enable,5)?(HealthUI::state::success):(HealthUI::state::failure));//内置写入
|
||
healthui->setState(33,getBit(enable,1)?(getBit(enable,0)?(HealthUI::state::success):(HealthUI::state::warning)):(HealthUI::state::failure));//外置记录
|
||
healthui->setState(34,getBit(enable,2)?(HealthUI::state::success):(HealthUI::state::failure));//外置写入
|
||
|
||
healthui->setState(35,getBit(enable,7)?(HealthUI::state::success):(HealthUI::state::failure));//sel
|
||
healthui->setValueState(35,getBit(enable,7)?(tr("安控区内")):(tr("安控区外")));//sel
|
||
|
||
|
||
|
||
//get 9-10
|
||
//得到航线组数,数据为1,2,3,4
|
||
//group = (int)(getBit(enable,11) << 2) | (int)(getBit(enable,10) << 1) | (int)(getBit(enable,9));
|
||
|
||
//group = vehicle.
|
||
|
||
|
||
/*
|
||
if(group_old != group)//有变化的时候就发出去
|
||
{
|
||
emit currentGroup(group + 2);
|
||
showMessage(tr("mission group has changed, current group is %1").arg(group));
|
||
}
|
||
|
||
group_old = group;
|
||
|
||
|
||
menuBarUI->setMissionGroup(group);
|
||
*/
|
||
|
||
|
||
}
|
||
|
||
|
||
QString AFCS_VERT = 0;
|
||
QString AFCS_LAT = 0;
|
||
|
||
|
||
//处理横纵模态
|
||
|
||
//取个位
|
||
switch (present%10 ) {
|
||
default:
|
||
case 0:
|
||
AFCS_VERT = tr("VERT_OFF");
|
||
break;
|
||
case 1:
|
||
AFCS_VERT = tr("VNAV2THT");
|
||
break;
|
||
case 2:
|
||
AFCS_VERT = tr("HDOT2THT");
|
||
break;
|
||
case 3:
|
||
AFCS_VERT = tr("GAMMA2THT");
|
||
break;
|
||
case 4:
|
||
AFCS_VERT = tr("AS2THT");
|
||
break;
|
||
case 5:
|
||
AFCS_VERT = tr("H2THT");
|
||
break;
|
||
case 6:
|
||
AFCS_VERT = tr("AGL2THT");
|
||
break;
|
||
}
|
||
|
||
//qDebug() << "vert" << present%10;
|
||
|
||
//取十位
|
||
present = present / 10;//去除个位
|
||
switch (present%10 ) {
|
||
default:
|
||
case 0:
|
||
AFCS_LAT = tr("LAT_OFF");
|
||
break;
|
||
case 1:
|
||
AFCS_LAT = tr("LNAV2PHI");
|
||
break;
|
||
case 2:
|
||
AFCS_LAT = tr("PSI2PHI");
|
||
break;
|
||
}
|
||
|
||
//qDebug() << "LAT" << present%10;
|
||
|
||
//===================status ui =============================================
|
||
statusui->setMode(1,mode_str,0);
|
||
statusui->setMode(2,AFCS_VERT,AFCS_LAT);
|
||
|
||
//========================
|
||
|
||
statusui->setState(1,QString::number(vehicle.ins1.az,'f',1),0);
|
||
statusui->setState(2,QString::number(vehicle.ins1.ay,'f',1),0);
|
||
|
||
statusui->setState(3,QString::number(vehicle.attitude.roll * 57.3,'f',1),
|
||
QString::number(vehicle.nav_controller_output.nav_roll,'f',1));
|
||
|
||
statusui->setState(4,QString::number(vehicle.attitude.pitch * 57.3,'f',1),
|
||
QString::number(vehicle.nav_controller_output.nav_pitch,'f',1));
|
||
|
||
statusui->setState(5,QString::number(to360deg(vehicle.gps_raw_int.cog * 0.01),'f',1),
|
||
QString::number(to360deg(vehicle.nav_controller_output.nav_bearing),'f',1));
|
||
|
||
statusui->setState(6,QString::number(vehicle.gps_raw_int.alt * 10e-4,'f',1),
|
||
QString::number(vehicle.gps_raw_int.alt * 10e-4
|
||
+vehicle.nav_controller_output.alt_error,'f',1));
|
||
|
||
statusui->setState(7,QString::number(vehicle.vfr_hud.airspeed,'f',1),
|
||
QString::number(vehicle.vfr_hud.airspeed
|
||
+vehicle.nav_controller_output.aspd_error,'f',1));
|
||
|
||
statusui->setState(8,QString::number(vehicle.emb_atom_com.Airspeed,'f',1),
|
||
QString::number(vehicle.emb_atom_com.Airspeed
|
||
+vehicle.nav_controller_output.aspd_error,'f',1));
|
||
|
||
statusui->setState(9,QString::number(vehicle.gps_raw_int.vel * 10e-3,'f',1),tr(" "));
|
||
|
||
statusui->setState(10,QString::number(vehicle.emb_atom_com.mach,'f',2),tr(" "));
|
||
|
||
statusui->setState(11,QString::number(-vehicle.global_position_int.vz * 10e-3,'f',1),tr(" "));
|
||
|
||
|
||
|
||
|
||
|
||
if(toolsui->senser)
|
||
{
|
||
|
||
toolsui->senser->setAltChart("海拔高度",vehicle.global_position_int.alt * 10e-4,2);
|
||
toolsui->senser->setAltChart("气压高度",vehicle.vfr_hud.alt,1);
|
||
|
||
|
||
toolsui->senser->setAttChart("滚转角度值",vehicle.attitude.roll*57.3,3);
|
||
toolsui->senser->setAttChart("俯仰角度值",vehicle.attitude.pitch*57.3,1);
|
||
|
||
|
||
toolsui->senser->setGyroChart("滚转角速度",vehicle.attitude.rollspeed * 57.3,3);
|
||
toolsui->senser->setGyroChart("俯仰角速度",vehicle.attitude.pitchspeed * 57.3,1);
|
||
toolsui->senser->setGyroChart("偏航角速度",vehicle.attitude.yawspeed * 57.3,2);
|
||
|
||
|
||
toolsui->senser->setAccChart("轴向加速度",vehicle.ins1.ax,3);
|
||
//toolsui->senser->setAccChart("外置ax",vehicle.ins2.ax,3);
|
||
toolsui->senser->setAccChart("侧向加速度",vehicle.ins1.ay,1);
|
||
//toolsui->senser->setAccChart("外置ay",vehicle.ins2.ay,1);
|
||
toolsui->senser->setAccChart("法向加速度",vehicle.ins1.az,2);
|
||
//toolsui->senser->setAccChart("外置az",vehicle.ins2.az,2);
|
||
|
||
toolsui->senser->setSpeedChart("地速",vehicle.gps_raw_int.vel * 10e-3,3);
|
||
toolsui->senser->setSpeedChart("真空速",vehicle.emb_atom_com.Airspeed,2);
|
||
toolsui->senser->setSpeedChart("表速",vehicle.vfr_hud.airspeed,0);
|
||
toolsui->senser->setSpeedChart("目标表速",vehicle.vfr_hud.airspeed
|
||
+vehicle.nav_controller_output.aspd_error,1);
|
||
|
||
|
||
}
|
||
|
||
|
||
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 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 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;
|
||
|
||
|
||
statusui->setServo(1,QString::number(la_command,'f',2),
|
||
QString::number(la_angle,'f',2));
|
||
statusui->setServo(2,QString::number(ra_command,'f',2),
|
||
QString::number(ra_angle,'f',2));
|
||
statusui->setServo(3,QString::number(le_command,'f',2),
|
||
QString::number(le_angle,'f',2));
|
||
statusui->setServo(4,QString::number(re_command,'f',2),
|
||
QString::number(re_angle,'f',2));
|
||
statusui->setServo(5,QString::number(ru_command,'f',2),
|
||
QString::number(ru_angle,'f',2));
|
||
|
||
|
||
|
||
if(toolsui->senser)
|
||
{
|
||
//toolsui->senser->setServoChart("左副翼",la_angle);
|
||
//toolsui->senser->setServoChart("左副翼角度",la_command);
|
||
toolsui->senser->setServoChart("右副翼舵",ra_angle,3);
|
||
//toolsui->senser->setServoChart("右副翼角度",ra_command);
|
||
//toolsui->senser->setServoChart("左升降",le_angle);
|
||
//toolsui->senser->setServoChart("左升降角度",le_command);
|
||
toolsui->senser->setServoChart("右升降舵",re_angle,1);
|
||
//toolsui->senser->setServoChart("右升降角度",re_command);
|
||
toolsui->senser->setServoChart("方向舵",ru_angle,2);
|
||
//toolsui->senser->setServoChart("方向舵角度",ru_command);
|
||
}
|
||
|
||
|
||
statusui->setEngine(1,QString::number((vehicle.servo_output_raw.servo6_raw - 1000) * 0.1,'f',0),
|
||
QString::number(vehicle.turbinstate.RPM_mea,'f',0));
|
||
|
||
statusui->setEngine(2,QString::number(vehicle.ccmstate.fuel_level * 10.0 / 65536.0f,'f',1),
|
||
QString::number(vehicle.servo_output_raw.servo7_raw * 0.01,'f',1));//剩余油量
|
||
statusui->setEngine(3,QString::number(vehicle.ccmstate.volts[2],'f',0),0);//油压
|
||
|
||
statusui->setEngine(4,QString::number(vehicle.ccmstate.temp[1] * 0.1,'f',1),//温度
|
||
QString::number(vehicle.ccmstate.temp[0] * 0.1,'f',1));
|
||
|
||
|
||
statusui->setBattery(1,QString::number(vehicle.bmustate.BAT1_group_voltage_mv * 0.001,'f',1),
|
||
QString::number((float)((int16_t)vehicle.bmustate.BAT1_group_current_dA) *0.1f,'f',1));
|
||
|
||
statusui->setBattery(2,QString::number(vehicle.bmustate.BAT2_group_voltage_mv * 0.001,'f',1),
|
||
QString::number((float)((int16_t)vehicle.bmustate.BAT2_group_current_dA) *0.1f,'f',1));
|
||
|
||
|
||
|
||
if((isEngineStartUp == false)&&(vehicle.turbinstate.RPM_mea >= 10000))
|
||
{
|
||
StartupTime->setTime(QDateTime::currentDateTime().time());
|
||
isEngineStartUp = true;
|
||
}
|
||
else if((isEngineStartUp == true)&&(vehicle.turbinstate.RPM_mea < 8000))
|
||
{
|
||
isEngineStartUp = false;
|
||
}
|
||
|
||
if(isEngineStartUp == true)
|
||
{
|
||
//toolsui->diagram->setTime(3,QTime::fromMSecsSinceStartOfDay(StartupTime->time().msecsTo(QDateTime::currentDateTime().time())));//开车时长
|
||
}
|
||
|
||
|
||
QString bit1;
|
||
switch (vehicle.ins1.BIT & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
bit1.append(tr("未初始化"));
|
||
//toolsui->senser->setINSState(1,2,ToolsU);
|
||
}break;
|
||
case 1:
|
||
{
|
||
bit1.append(tr("垂直陀螺"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
bit1.append(tr("AHRS"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
bit1.append(tr("速度导航"));
|
||
}break;
|
||
case 4:
|
||
{
|
||
bit1.append(tr("位置导航"));
|
||
}break;
|
||
}
|
||
|
||
QString att1;
|
||
if(vehicle.ins1.BIT & 0x10)
|
||
{
|
||
att1.append(tr("正常"));
|
||
}
|
||
else{
|
||
att1.append(tr("无效"));
|
||
}
|
||
|
||
QString heading1;
|
||
if(vehicle.ins1.BIT & 0x20)
|
||
{
|
||
heading1.append(tr("正常"));
|
||
}
|
||
else{
|
||
heading1.append(tr("无效"));
|
||
}
|
||
|
||
QString spd1;
|
||
if(vehicle.ins1.BIT & 0x40)
|
||
{
|
||
spd1.append(tr("正常"));
|
||
}
|
||
else{
|
||
spd1.append(tr("无效"));
|
||
}
|
||
|
||
QString pos1;
|
||
if(vehicle.ins1.BIT & 0x80)
|
||
{
|
||
pos1.append(tr("正常"));
|
||
}
|
||
else{
|
||
pos1.append(tr("无效"));
|
||
}
|
||
|
||
|
||
|
||
QString sys1;
|
||
switch (vehicle.ins1.sys_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
sys1.append(tr("解算正常"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
sys1.append(tr("卫星数不足"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
sys1.append(tr("内部错误"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
sys1.append(tr("速度超限"));
|
||
}break;
|
||
}
|
||
|
||
|
||
QString com1;
|
||
switch (vehicle.ins1.com_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
com1.append(tr("无效"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
com1.append(tr("未知"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
com1.append(tr("多普勒"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
com1.append(tr("微分"));
|
||
}break;
|
||
}
|
||
|
||
|
||
QString gps1;
|
||
switch (vehicle.ins1.gps_status) {
|
||
case 0:
|
||
gps1.append(tr("未定位"));
|
||
case 1:
|
||
gps1.append(tr("未知"));
|
||
break;
|
||
case 2:
|
||
gps1.append(tr("单点"));
|
||
break;
|
||
case 3:
|
||
gps1.append(tr("伪距差分"));
|
||
break;
|
||
case 4:
|
||
gps1.append(tr("SBAS广域差分"));
|
||
break;
|
||
case 5:
|
||
gps1.append(tr("广域差分"));
|
||
break;
|
||
case 6:
|
||
gps1.append(tr("RTK_FLOAT"));
|
||
break;
|
||
case 7:
|
||
gps1.append(tr("RTK_INT"));
|
||
break;
|
||
case 8:
|
||
gps1.append(tr("PPP_FLOAT"));
|
||
break;
|
||
case 9:
|
||
gps1.append(tr("PPP_INT"));
|
||
break;
|
||
case 10:
|
||
gps1.append(tr("FIXED"));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
|
||
|
||
|
||
toolsui->senser->setINS(1,1,QString::number(vehicle.ins1.satellites_visible));
|
||
toolsui->senser->setINS(1,2,bit1);//bit
|
||
toolsui->senser->setINS(1,3,att1);//bit1
|
||
toolsui->senser->setINS(1,4,heading1);//bit2
|
||
toolsui->senser->setINS(1,5,spd1);//bit3
|
||
toolsui->senser->setINS(1,6,pos1);//bit4
|
||
toolsui->senser->setINS(1,7,sys1);//sys
|
||
toolsui->senser->setINS(1,8,com1);//com
|
||
toolsui->senser->setINS(1,9,gps1);//gps
|
||
toolsui->senser->setINS(1,10,QString::number(vehicle.ins1.lon,'f',8));
|
||
toolsui->senser->setINS(1,11,QString::number(vehicle.ins1.lat,'f',8));
|
||
toolsui->senser->setINS(1,12,QString::number(vehicle.ins1.alt,'f',1));
|
||
toolsui->senser->setINS(1,13,QString::number(sqrt(pow(vehicle.ins1.v_north,2) +
|
||
pow(vehicle.ins1.v_east,2) +
|
||
pow(vehicle.ins1.v_up,2)),'f',1));
|
||
toolsui->senser->setINS(1,14,QString::number(vehicle.ins1.roll * 57.3,'f',1));
|
||
toolsui->senser->setINS(1,15,QString::number(vehicle.ins1.pitch * 57.3,'f',1));
|
||
toolsui->senser->setINS(1,16,QString::number(to360deg(vehicle.ins1.yaw * 57.3),'f',1));
|
||
|
||
if((vehicle.ins1.v_east != 0)||
|
||
(vehicle.ins1.v_north != 0))
|
||
{
|
||
toolsui->senser->setINS(1,17,QString::number(to360deg(atan2(vehicle.ins1.v_east,
|
||
vehicle.ins1.v_north) * 57.3),'f',1));
|
||
}
|
||
|
||
toolsui->senser->setINS(1,18,QString::number(vehicle.ins1.gx,'f',1));
|
||
toolsui->senser->setINS(1,19,QString::number(vehicle.ins1.gy,'f',1));
|
||
toolsui->senser->setINS(1,20,QString::number(vehicle.ins1.gz,'f',1));
|
||
toolsui->senser->setINS(1,21,QString::number(vehicle.ins1.ax,'f',1));
|
||
toolsui->senser->setINS(1,22,QString::number(vehicle.ins1.ay,'f',1));
|
||
toolsui->senser->setINS(1,23,QString::number(vehicle.ins1.az,'f',1));
|
||
|
||
|
||
|
||
QString bit2;
|
||
switch (vehicle.ins2.BIT & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
bit2.append(tr("未初始化"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
bit2.append(tr("垂直陀螺"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
bit2.append(tr("AHRS"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
bit2.append(tr("速度导航"));
|
||
}break;
|
||
case 4:
|
||
{
|
||
bit2.append(tr("位置导航"));
|
||
}break;
|
||
}
|
||
|
||
QString att2;
|
||
if(vehicle.ins2.BIT & 0x10)
|
||
{
|
||
att2.append(tr("正常"));
|
||
}
|
||
else{
|
||
att2.append(tr("无效"));
|
||
}
|
||
|
||
QString heading2;
|
||
if(vehicle.ins2.BIT & 0x20)
|
||
{
|
||
heading2.append(tr("正常"));
|
||
}
|
||
else{
|
||
heading2.append(tr("无效"));
|
||
}
|
||
|
||
QString spd2;
|
||
if(vehicle.ins2.BIT & 0x40)
|
||
{
|
||
spd2.append(tr("正常"));
|
||
}
|
||
else{
|
||
spd2.append(tr("无效"));
|
||
}
|
||
|
||
QString pos2;
|
||
if(vehicle.ins2.BIT & 0x80)
|
||
{
|
||
pos2.append(tr("正常"));
|
||
}
|
||
else{
|
||
pos2.append(tr("无效"));
|
||
}
|
||
|
||
|
||
|
||
QString sys2;
|
||
switch (vehicle.ins2.sys_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
sys2.append(tr("解算正常"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
sys2.append(tr("卫星数不足"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
sys2.append(tr("内部错误"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
sys2.append(tr("速度超限"));
|
||
}break;
|
||
}
|
||
|
||
|
||
QString com2;
|
||
switch (vehicle.ins2.com_status & 0x0F) {
|
||
default:
|
||
case 0:
|
||
{
|
||
com2.append(tr("无效"));
|
||
}break;
|
||
case 1:
|
||
{
|
||
com2.append(tr("未知"));
|
||
}break;
|
||
case 2:
|
||
{
|
||
com2.append(tr("多普勒"));
|
||
}break;
|
||
case 3:
|
||
{
|
||
com2.append(tr("微分"));
|
||
}break;
|
||
}
|
||
|
||
|
||
QString gps2;
|
||
switch (vehicle.ins2.gps_status) {
|
||
case 0:
|
||
gps2.append(tr("未定位"));
|
||
case 1:
|
||
gps2.append(tr("未知"));
|
||
break;
|
||
case 2:
|
||
gps2.append(tr("单点"));
|
||
break;
|
||
case 3:
|
||
gps2.append(tr("伪距差分"));
|
||
break;
|
||
case 4:
|
||
gps2.append(tr("SBAS广域差分"));
|
||
break;
|
||
case 5:
|
||
gps2.append(tr("广域差分"));
|
||
break;
|
||
case 6:
|
||
gps2.append(tr("RTK_FLOAT"));
|
||
break;
|
||
case 7:
|
||
gps2.append(tr("RTK_INT"));
|
||
break;
|
||
case 8:
|
||
gps2.append(tr("PPP_FLOAT"));
|
||
break;
|
||
case 9:
|
||
gps2.append(tr("PPP_INT"));
|
||
break;
|
||
case 10:
|
||
gps2.append(tr("FIXED"));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
|
||
|
||
toolsui->senser->setINS(2,1,QString::number(vehicle.ins2.satellites_visible));
|
||
toolsui->senser->setINS(2,2,bit2);
|
||
toolsui->senser->setINS(2,3,att2);//bit1
|
||
toolsui->senser->setINS(2,4,heading2);//bit2
|
||
toolsui->senser->setINS(2,5,spd2);//bit3
|
||
toolsui->senser->setINS(2,6,pos2);//bit4
|
||
toolsui->senser->setINS(2,7,sys2);
|
||
toolsui->senser->setINS(2,8,com2);
|
||
toolsui->senser->setINS(2,9,gps2);
|
||
toolsui->senser->setINS(2,10,QString::number(vehicle.ins2.lon,'f',8));
|
||
toolsui->senser->setINS(2,11,QString::number(vehicle.ins2.lat,'f',8));
|
||
toolsui->senser->setINS(2,12,QString::number(vehicle.ins2.alt,'f',1));
|
||
toolsui->senser->setINS(2,13,QString::number(sqrt(pow(vehicle.ins2.v_north,2) +
|
||
pow(vehicle.ins2.v_east,2) +
|
||
pow(vehicle.ins2.v_up,2)),'f',1));
|
||
toolsui->senser->setINS(2,14,QString::number(vehicle.ins2.roll * 57.3,'f',1));
|
||
toolsui->senser->setINS(2,15,QString::number(vehicle.ins2.pitch * 57.3,'f',1));
|
||
toolsui->senser->setINS(2,16,QString::number(to360deg(vehicle.ins2.yaw * 57.3),'f',1));
|
||
|
||
if((vehicle.ins2.v_east != 0)||
|
||
(vehicle.ins2.v_north != 0))
|
||
{
|
||
toolsui->senser->setINS(2,17,QString::number(to360deg(atan2(vehicle.ins2.v_east,
|
||
vehicle.ins2.v_north) * 57.3),'f',1));
|
||
}
|
||
|
||
toolsui->senser->setINS(2,18,QString::number(vehicle.ins2.gx,'f',1));
|
||
toolsui->senser->setINS(2,19,QString::number(vehicle.ins2.gy,'f',1));
|
||
toolsui->senser->setINS(2,20,QString::number(vehicle.ins2.gz,'f',1));
|
||
toolsui->senser->setINS(2,21,QString::number(vehicle.ins2.ax,'f',1));
|
||
toolsui->senser->setINS(2,22,QString::number(vehicle.ins2.ay,'f',1));
|
||
toolsui->senser->setINS(2,23,QString::number(vehicle.ins2.az,'f',1));
|
||
|
||
|
||
|
||
toolsui->senser->setDAS(1,3,QString::number(vehicle.vfr_hud.alt,'f',1));
|
||
toolsui->senser->setDAS(1,4,QString::number(vehicle.vfr_hud.airspeed,'f',1));
|
||
toolsui->senser->setDAS(1,5,QString::number(vehicle.emb_atom_com.Airspeed,'f',1));
|
||
toolsui->senser->setDAS(1,6,QString::number(vehicle.emb_atom_com.mach,'f',3));
|
||
toolsui->senser->setDAS(1,7,QString::number(vehicle.emb_atom_com.qbar * 0.01,'f',3));
|
||
toolsui->senser->setDAS(1,8,QString::number(vehicle.emb_atom_com.ps * 0.01,'f',3));
|
||
|
||
toolsui->senser->setDAS(2,1,QString::number(vehicle.emb_atom_com.alpha,'f',1));
|
||
toolsui->senser->setDAS(2,2,QString::number(vehicle.emb_atom_com.beta,'f',1));
|
||
//toolsui->senser->setDAS(2,3,QString::number(vehicle.emb_atom_com.));
|
||
toolsui->senser->setDAS(2,4,QString::number(vehicle.vfr_hud.airspeed,'f',1));
|
||
toolsui->senser->setDAS(2,7,QString::number(vehicle.scaled_pressure.press_diff,'f',3));
|
||
toolsui->senser->setDAS(2,8,QString::number(dlink->mavlinknode->vehicle.scaled_pressure.press_abs,'f',3));
|
||
|
||
|
||
//qDebug() << "nsecsElapsed" << ElapsedTimer.nsecsElapsed();
|
||
|
||
}
|
||
|
||
void MainWindow::Timer_1s_out(void)
|
||
{
|
||
|
||
}
|
||
|
||
|
||
void MainWindow::TotalDistance(double value)
|
||
{
|
||
/*
|
||
if(MainIndex == 2)//任务界面
|
||
{
|
||
QString message;
|
||
|
||
message.append(tr("<h6>总航程:<font color=red>%1</font>米\t</h6>").arg(value));
|
||
message.append(tr("<h6>最远距离:<font color=red>%1</font>米\t</h6>").arg(0));
|
||
message.append(tr("<h6>预计飞行时间:<font color=red>%1</font>小时\t</h6>").arg(0));
|
||
|
||
showMessage(message);
|
||
|
||
}
|
||
*/
|
||
|
||
}
|
||
|