diff --git a/App/Setting/Index0/Global/GlobalSetting.cpp b/App/Setting/Index0/Global/GlobalSetting.cpp index 51a76b5..d5464c2 100644 --- a/App/Setting/Index0/Global/GlobalSetting.cpp +++ b/App/Setting/Index0/Global/GlobalSetting.cpp @@ -142,6 +142,98 @@ void GlobalSetting::getServo(void) } +void GlobalSetting::ServoParameter(QString type,QVariant data) +{ + + Config *cfg = new Config(); + + QVariant dir_la; + QVariant dir_ra; + QVariant dir_le; + QVariant dir_re; + QVariant dir_ru; + + QVariant max_la; + QVariant max_ra; + QVariant max_le; + QVariant max_re; + QVariant max_ru; + + QVariant scale_la; + QVariant scale_ra; + QVariant scale_le; + QVariant scale_re; + QVariant scale_ru; + + QVariant bias_la; + QVariant bias_ra; + QVariant bias_le; + QVariant bias_re; + QVariant bias_ru; + + cfg->getServoOffset(&dir_la,&dir_ra,&dir_le,&dir_re,&dir_ru, + &max_la,&max_ra,&max_le,&max_re,&max_ru, + &scale_la,&scale_ra,&scale_le,&scale_re,&scale_ru, + &bias_la,&bias_ra,&bias_le,&bias_re,&bias_ru); + + dir_la = 1; + dir_ra = 1; + dir_le = 1; + dir_re = 1; + dir_ru = 1; + + + if(type == "dal0") + { + bias_la = data; + } + else if(type == "dar0") + { + bias_ra = data; + } + else if(type == "del0") + { + bias_le = data; + } + else if(type == "der0") + { + bias_re = data; + } + else if(type == "dr0") + { + bias_ru = data; + } + else if(type == "k_dal") + { + scale_la = data; + } + else if(type == "k_dar") + { + scale_ra = data; + } + else if(type == "k_del") + { + scale_le = data; + } + else if(type == "k_der") + { + scale_re = data; + } + else if(type == "k_dr") + { + scale_ru = data; + } + + cfg->setServoOffset(dir_la,dir_ra,dir_le,dir_re,dir_ru, + max_la,max_ra,max_le,max_re,max_ru, + scale_la,scale_ra,scale_le,scale_re,scale_ru, + bias_la,bias_ra,bias_le,bias_re,bias_ru); + + on_pushButton_getServoOffset_clicked(); + +} + + void GlobalSetting::on_pushButton_getServoOffset_clicked() { Config *cfg = new Config(); diff --git a/App/Setting/Index0/Global/GlobalSetting.h b/App/Setting/Index0/Global/GlobalSetting.h index 8138f1a..d80cbe3 100644 --- a/App/Setting/Index0/Global/GlobalSetting.h +++ b/App/Setting/Index0/Global/GlobalSetting.h @@ -26,6 +26,7 @@ public: public slots: void MapTypes(QStringList list); + void ServoParameter(QString type,QVariant data); private slots: diff --git a/App/Setting/Index0/Global/GlobalSetting.ui b/App/Setting/Index0/Global/GlobalSetting.ui index bc895d9..38b87f9 100644 --- a/App/Setting/Index0/Global/GlobalSetting.ui +++ b/App/Setting/Index0/Global/GlobalSetting.ui @@ -54,6 +54,9 @@ + + 4 + -9999999.000000000000000 @@ -78,6 +81,9 @@ + + 4 + -9999999.000000000000000 @@ -88,6 +94,9 @@ + + 4 + -9999999.000000000000000 @@ -119,6 +128,9 @@ + + 4 + -9999999.000000000000000 @@ -174,6 +186,9 @@ + + 4 + -9999999.000000000000000 @@ -253,6 +268,9 @@ + + 4 + -9999999.000000000000000 @@ -266,6 +284,9 @@ + + 4 + -9999999.000000000000000 @@ -279,6 +300,9 @@ + + 4 + -9999999.000000000000000 @@ -292,6 +316,9 @@ + + 4 + -9999999.000000000000000 @@ -305,6 +332,9 @@ + + 4 + -9999999.000000000000000 diff --git a/App/Setting/Index1/ParameterInspector/ParameterInspector.cpp b/App/Setting/Index1/ParameterInspector/ParameterInspector.cpp index f21a846..61f2709 100644 --- a/App/Setting/Index1/ParameterInspector/ParameterInspector.cpp +++ b/App/Setting/Index1/ParameterInspector/ParameterInspector.cpp @@ -205,25 +205,20 @@ void ParameterInspector::appendParameter(mavlink_message_t msg) { emit HILMode(param_Value(param_value).toString()); } - - - //找到所有舵机参数,并发送出去 + else if((param_id(param_value.param_id) == "dal0") || + (param_id(param_value.param_id) == "dar0") || + (param_id(param_value.param_id) == "del0") || + (param_id(param_value.param_id) == "der0") || + (param_id(param_value.param_id) == "dr0") || + (param_id(param_value.param_id) == "k_dal")|| + (param_id(param_value.param_id) == "k_dar")|| + (param_id(param_value.param_id) == "k_del")|| + (param_id(param_value.param_id) == "k_der")|| + (param_id(param_value.param_id) == "k_dr")) { - /* - * del0 der0 dr0 dal0 dar0 - * k_dal k_dar k_del k_der k_dr - * - * - * - */ + emit ServoParameter(param_id(param_value.param_id),param_Value(param_value)); } - - - - - - isReflush = true; } diff --git a/App/Setting/Index1/ParameterInspector/ParameterInspector.h b/App/Setting/Index1/ParameterInspector/ParameterInspector.h index 93e9a16..cd8be71 100644 --- a/App/Setting/Index1/ParameterInspector/ParameterInspector.h +++ b/App/Setting/Index1/ParameterInspector/ParameterInspector.h @@ -128,7 +128,7 @@ signals: void APversion(QString); void HILMode(QString); - void ServoParameter(int type,int index, QVariant data);// + void ServoParameter(QString type,QVariant data);// diff --git a/App/Setting/Setting.cpp b/App/Setting/Setting.cpp index e475467..748f63b 100644 --- a/App/Setting/Setting.cpp +++ b/App/Setting/Setting.cpp @@ -37,6 +37,11 @@ Setting::Setting(QWidget *parent) : CurrentIndex = 0; emit IndexChanged(CurrentIndex); + + connect(index1->paramInspect,&ParameterInspector::ServoParameter, + index0->globalsetting,&GlobalSetting::ServoParameter); + + } Setting::~Setting() diff --git a/App/StatusUI/StatusUI.cpp b/App/StatusUI/StatusUI.cpp index 7b49925..2cb5491 100644 --- a/App/StatusUI/StatusUI.cpp +++ b/App/StatusUI/StatusUI.cpp @@ -28,9 +28,9 @@ StatusUI::StatusUI(QWidget *parent) : ui->groupBox_Warn->hide(); */ - ui->label_VerticalMode->hide(); - ui->label_HorizonMode->hide(); - ui->label_navMode->hide(); + //ui->label_VerticalMode->hide(); + //ui->label_HorizonMode->hide(); + //ui->label_navMode->hide(); int w = 150; int h = 20; diff --git a/App/ToolsUI/PowerSystem/PowerSystem.cpp b/App/ToolsUI/PowerSystem/PowerSystem.cpp index 2b6f1f9..7162b2e 100644 --- a/App/ToolsUI/PowerSystem/PowerSystem.cpp +++ b/App/ToolsUI/PowerSystem/PowerSystem.cpp @@ -147,6 +147,14 @@ PowerSystem::~PowerSystem() delete ui; } +void PowerSystem::updateUI() +{ + ScopeRPM->setGeometry(0,0,ui->frame_RPM->width(),ui->frame_RPM->height()); + ScopeTemp->setGeometry(0,0,ui->frame_Temp->width(),ui->frame_Temp->height()); + ScopeAlt->setGeometry(0,0,ui->frame_Alt->width(),ui->frame_Alt->height()); + ScopeMa->setGeometry(0,0,ui->frame_Ma->width(),ui->frame_Ma->height()); +} + void PowerSystem::resizeEvent(QResizeEvent *event) { qDebug() << "resize event"; @@ -198,6 +206,7 @@ void PowerSystem::setFloat(void) this->move((screen->availableGeometry().width()-this->width())/2,(screen->availableGeometry().height()-this->height())/2); this->show(); this->resize(m_parent->size()); + updateUI(); } else { @@ -207,7 +216,7 @@ void PowerSystem::setFloat(void) this->show(); this->resize(m_parent->size()); //qDebug() << m_parent->children(); - + updateUI(); } } diff --git a/App/ToolsUI/PowerSystem/PowerSystem.h b/App/ToolsUI/PowerSystem/PowerSystem.h index 3999242..f2b1f3b 100644 --- a/App/ToolsUI/PowerSystem/PowerSystem.h +++ b/App/ToolsUI/PowerSystem/PowerSystem.h @@ -52,6 +52,8 @@ public: void setFuel(QVariant press,QVariant value); + void updateUI(); + private: void resizeEvent(QResizeEvent *event); diff --git a/App/ToolsUI/Senser/Senser.cpp b/App/ToolsUI/Senser/Senser.cpp index 5d8cbc9..38f8c8e 100644 --- a/App/ToolsUI/Senser/Senser.cpp +++ b/App/ToolsUI/Senser/Senser.cpp @@ -106,6 +106,9 @@ Senser::Senser(QWidget *parent) : this,&Senser::chartSelect); + + + //StringModel = new QStringListModel(ui->listView_Data); ItemModel = new QStandardItemModel(ui->listView_Data); @@ -286,10 +289,21 @@ void Senser::setValue(QLabel *w,QString s) w->setText(s); } +void Senser::updateUI() +{ + attChart->setGeometry(0,0,ui->frame_Attitude->width(),ui->frame_Attitude->height()); + gyroChart->setGeometry(0,0,ui->frame_Gyro->width(),ui->frame_Gyro->height()); + accChart->setGeometry(0,0,ui->frame_Accelerate->width(),ui->frame_Accelerate->height()); + servoChart->setGeometry(0,0,ui->frame_Servo->width(),ui->frame_Servo->height()); + altChart->setGeometry(0,0,ui->frame_Altitude->width(),ui->frame_Altitude->height()); + speedChart->setGeometry(0,0,ui->frame_Speed->width(),ui->frame_Speed->height()); +} void Senser::resizeEvent(QResizeEvent *event) { + //attChart->resizeEvent(event); + attChart->setGeometry(0,0,ui->frame_Attitude->width(),ui->frame_Attitude->height()); gyroChart->setGeometry(0,0,ui->frame_Gyro->width(),ui->frame_Gyro->height()); accChart->setGeometry(0,0,ui->frame_Accelerate->width(),ui->frame_Accelerate->height()); @@ -314,6 +328,7 @@ void Senser::setFloat(void) this->move((screen->availableGeometry().width()-this->width())/2,(screen->availableGeometry().height()-this->height())/2); this->show(); this->resize(m_parent->size()); + updateUI(); } else { @@ -321,7 +336,7 @@ void Senser::setFloat(void) this->move(0,0); this->show(); this->resize(m_parent->size()); - + updateUI(); } } @@ -758,5 +773,41 @@ void Senser::setINSState(int source,int pos,state value) } } +//设置曲线 + +/* + * + attChart->setOperation(false); + 角度 + + gyroChart->setOperation(false); + 角速度 + + accChart->setOperation(false); + 加速度 + + servoChart->setOperation(false); + 舵机指令和反馈 + + altChart->setOperation(false); + 海拔 + + speedChart->setOperation(false); + 速度 + + + ScopeRPM->setSerieData(tr("物理"),t->RPM_mea); + ScopeRPM->setSerieData(tr("期望"),t->RPM_des); + + * + * + * + */ + + + + + + diff --git a/App/ToolsUI/Senser/Senser.h b/App/ToolsUI/Senser/Senser.h index 7b959f6..be33205 100644 --- a/App/ToolsUI/Senser/Senser.h +++ b/App/ToolsUI/Senser/Senser.h @@ -53,6 +53,8 @@ public: void setINSState(int source,int pos,state value); + void updateUI(); + Chart *attChart = nullptr; Chart *gyroChart = nullptr; Chart *accChart = nullptr; diff --git a/App/ToolsUI/ServoSystem/ServoSystem.cpp b/App/ToolsUI/ServoSystem/ServoSystem.cpp index bba3b60..fee3f63 100644 --- a/App/ToolsUI/ServoSystem/ServoSystem.cpp +++ b/App/ToolsUI/ServoSystem/ServoSystem.cpp @@ -342,11 +342,13 @@ void ServoSystem::setServoState(mavlink_servo_output_raw_t *t) void ServoSystem::setAPversion(QString ver) { ui->label_APVer->setText(ver); + emit showMessage(tr("飞控软件版本信息:%1").arg(ver)); } void ServoSystem::setHILMode(QString mode) { ui->label_HILMode->setText(mode); + emit showMessage((mode>0)?("进入HIL仿真"):("退出HIL仿真")); } diff --git a/App/ToolsUI/ToolsUI.cpp b/App/ToolsUI/ToolsUI.cpp index 1969790..ef493f3 100644 --- a/App/ToolsUI/ToolsUI.cpp +++ b/App/ToolsUI/ToolsUI.cpp @@ -262,11 +262,13 @@ void ToolsUI::onTabIndexChanged(const int &index)//界面选择管理 if(powersystem->parent()) { powersystem->show(); + powersystem->updateUI(); } else { powersystem->showNormal(); powersystem->activateWindow(); + powersystem->updateUI(); } } else { @@ -333,11 +335,13 @@ void ToolsUI::onTabIndexChanged(const int &index)//界面选择管理 if(senser->parent()) { senser->show(); + senser->updateUI(); } else { senser->showNormal(); senser->activateWindow(); + senser->updateUI(); } } else { @@ -598,6 +602,7 @@ void ToolsUI::on_pushButton_ShowExtern_clicked() break; case 9: senser->setFloat(); + break; } } diff --git a/opmap/mapwidget/opmapwidget.cpp b/opmap/mapwidget/opmapwidget.cpp index e60a9d3..a730c2f 100644 --- a/opmap/mapwidget/opmapwidget.cpp +++ b/opmap/mapwidget/opmapwidget.cpp @@ -1505,9 +1505,6 @@ void OPMapWidget::WPSave(QString path)//带文件目录参数 WayPointItem *w = i.value(); - qDebug() << w->Number(); - - if (w) {//逐渐往下增加 if(w->Number()>0) { @@ -1713,12 +1710,12 @@ void OPMapWidget::WPUpload(void) if(list.size() <= 0) { - emit showMessage(tr("please create a plan")); + emit showMessage("请先载入任务航线"); return; } - emit showMessage(tr("start to send mossion %1").arg(list.size())); + emit showMessage(tr("开始上传航点,总数%1").arg(list.size())); //选择当前ID号 @@ -1747,14 +1744,16 @@ void OPMapWidget::WPUpload(void) { QString str; - str.append(tr("send way point %1").arg(seq)); + //str.append(tr("send way point %1").arg(seq)); + str.append("上传航点"); + str.append(QString::number(seq)); emit showMessage(str); } else { QString str; - str.append(tr("fail to send %1").arg(seq)); + str.append(tr("上传失败%1").arg(seq)); emit showMessage(str); } @@ -1838,8 +1837,8 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par // << QThread::currentThreadId(); - emit showMessage(tr("recieve way point %1").arg(seq + 1)); - + //emit showMessage(tr("recieve way point %1").arg(seq + 1)); + emit showMessage(tr("收到航点 %1").arg(seq + 1)); //qDebug() << "receivers Point" << x * 10e-8 << y * 10e-8 << 10e-8;