diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 8e5164f22a2879b50e0de01faf80f776efca450e..200bf0a4bc9741efc9ec7742a4d340d7c230985f 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -138,7 +138,9 @@ FORMS += src/ui/MainWindow.ui \ src/ui/QGCRemoteControlView.ui \ src/ui/WaypointGlobalView.ui \ src/ui/SlugsDataSensorView.ui \ - src/ui/SlugsHilSim.ui + src/ui/SlugsHilSim.ui \ + src/ui/SlugsDataSensorView.ui \ + src/ui/SlugsPIDControl.ui INCLUDEPATH += src \ src/ui \ src/ui/linechart \ @@ -239,7 +241,8 @@ HEADERS += src/MG.h \ src/ui/map3D/Imagery.h \ src/comm/QGCMAVLink.h\ src/ui/SlugsDataSensorView.h \ - src/ui/SlugsHilSim.h + src/ui/SlugsHilSim.h \ + src/ui/SlugsPIDControl.h SOURCES += src/main.cc \ src/Core.cc \ src/uas/UASManager.cc \ @@ -320,7 +323,8 @@ SOURCES += src/main.cc \ src/ui/map3D/WebImage.cc \ src/ui/map3D/Imagery.cc \ src/ui/SlugsDataSensorView.cc \ - src/ui/SlugsHilSim.cc + src/ui/SlugsHilSim.cc \ + src/ui/SlugsPIDControl.cpp RESOURCES = mavground.qrc diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index e2236c0b9d4ed10cd9ca946a42eb691f94c4ffb4..3e6be1561c53f1b42ebb25778a105cebeed5311c 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -181,6 +181,9 @@ void MainWindow::buildWidgets() slugsDataWidget = new QDockWidget(tr("Slugs Data"), this); slugsDataWidget->setWidget( new SlugsDataSensorView(this)); + slugsPIDControlWidget = new QDockWidget(tr("PID Control"), this); + slugsPIDControlWidget->setWidget(new SlugsPIDControl(this)); + } @@ -917,6 +920,13 @@ void MainWindow::loadGlobalOperatorView() slugsDataWidget->show(); } + // Slugs Data View + if (slugsPIDControlWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, slugsPIDControlWidget); + slugsPIDControlWidget->show(); + } + // // UAS CONTROL diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 099bc7e004d48732dfd01c237fd0e3dc84909c5f..473074369f937a7e770e882c3e8d6c3fe501b586 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -66,6 +66,7 @@ This file is part of the QGROUNDCONTROL project #include "QMap3DWidget.h" #include "SlugsDataSensorView.h" #include "LogCompressor.h" +#include "SlugsPIDControl.h" /** @@ -180,6 +181,7 @@ protected: QPointer hsiDockWidget; QPointer rcViewDockWidget; QPointer slugsDataWidget; + QPointer slugsPIDControlWidget; // Popup widgets JoystickWidget* joystickWidget; diff --git a/src/ui/SlugsPIDControl.cpp b/src/ui/SlugsPIDControl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9e75c00ea3cfb01e79bf3587afdcfcdf9d8b245 --- /dev/null +++ b/src/ui/SlugsPIDControl.cpp @@ -0,0 +1,78 @@ +#include "SlugsPIDControl.h" +#include "ui_SlugsPIDControl.h" + + +#include +#include +#include + +SlugsPIDControl::SlugsPIDControl(QWidget *parent) : + QWidget(parent), + ui(new Ui::SlugsPIDControl) +{ + ui->setupUi(this); + //connectButtons(); + + //this call functions is only an example to view the color in the groupBox + changeRedColor(ui->AirSpeedHold_groupBox); + changeGreenColor(ui->HeightErrorLoPitch_groupBox); +} + +SlugsPIDControl::~SlugsPIDControl() +{ + delete ui; +} + +/** + * Set the background color RED of the GroupBox PID based on the send Slugs PID message + * + */ +void SlugsPIDControl::changeRedColor(QGroupBox *group) +{ + // GroupBox Color + QColor groupColor = QColor(231,72,28); + QString colorstyle; + QString borderColor = "#FA4A4F"; //"#4A4A4F"; + + groupColor = groupColor.darker(475); + + + colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }", + groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str()); + + group->setStyleSheet(colorstyle); + +} + +/** + * Set the background color GREEN of the GroupBox PID based on the send Slugs PID message + * + */ +void SlugsPIDControl::changeGreenColor(QGroupBox *group) +{ + // GroupBox Color + QColor groupColor = QColor(30,124,16); + QString colorstyle; + QString borderColor = "#24AC23"; + + groupColor = groupColor.darker(475); + + + colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }", + groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str()); + + group->setStyleSheet(colorstyle); + +} + +/** + * Connection Signal and Slot of the set and get buttons on the widget + * + */ +void SlugsPIDControl::connectButtons() +{ + //ToDo connect buttons set and get. Before create the slots + +} + + diff --git a/src/ui/SlugsPIDControl.h b/src/ui/SlugsPIDControl.h new file mode 100644 index 0000000000000000000000000000000000000000..9a62f54346a3fbbe7dcb9572b1c55f10bc18a583 --- /dev/null +++ b/src/ui/SlugsPIDControl.h @@ -0,0 +1,30 @@ +#ifndef SLUGSPIDCONTROL_H +#define SLUGSPIDCONTROL_H + +#include +#include + +namespace Ui { + class SlugsPIDControl; +} + +class SlugsPIDControl : public QWidget +{ + Q_OBJECT + +public: + explicit SlugsPIDControl(QWidget *parent = 0); + ~SlugsPIDControl(); + +protected slots: + + void changeRedColor(QGroupBox* group); + void changeGreenColor(QGroupBox* group); + + void connectButtons(); + +private: + Ui::SlugsPIDControl *ui; +}; + +#endif // SLUGSPIDCONTROL_H diff --git a/src/ui/SlugsPIDControl.ui b/src/ui/SlugsPIDControl.ui new file mode 100644 index 0000000000000000000000000000000000000000..bb4a9144781617f379c029b990685be0bf415f87 --- /dev/null +++ b/src/ui/SlugsPIDControl.ui @@ -0,0 +1,875 @@ + + + SlugsPIDControl + + + + 0 + 0 + 429 + 504 + + + + Form + + + + 2 + + + + + + + Air Speed Hold (dT) + + + + + + + + + 10 + 75 + true + + + + P + + + + + + + + 10 + 75 + true + + + + I + + + + + + + + 10 + 75 + true + + + + D + + + + + + + dT_P_set + + + + + + + dT_P_get + + + + + + + dT_I_set + + + + + + + dT_I_get + + + + + + + dT_D_set + + + + + + + dT_D_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Pitch Followei (dE) + + + + + + + + + 10 + 75 + true + + + + P + + + + + + + + 10 + 75 + true + + + + I + + + + + + + + 10 + 75 + true + + + + D + + + + + + + dE_P_set + + + + + + + dE_P_get + + + + + + + dE_I_set + + + + + + + dE_I_get + + + + + + + dE_D_set + + + + + + + dE_D_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Roll Control (dA) + + + + + + + + + 10 + 75 + true + + + + P + + + + + + + + 10 + 75 + true + + + + I + + + + + + + + 10 + 75 + true + + + + D + + + + + + + dA_P_set + + + + + + + dA_P_get + + + + + + + dA_I_set + + + + + + + dA_I_get + + + + + + + dA_D_set + + + + + + + dA_D_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + Heigth Error lo Pitch Comm + + + + + + + + + 10 + 75 + true + + + + P + + + + + + + + 10 + 75 + true + + + + I + + + + + + + HELPComm_P_set + + + + + + + HELPComm_P_get + + + + + + + HELPComm_I_set + + + + + + + HELPComm_I_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + 10 + 75 + true + + + + QFrame::Sunken + + + 5 + + + 1 + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + + 10 + 75 + true + + + + FF + + + + + + + HELPComm_FF_set + + + + + + + HELPComm_FF_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Yaw Damper (dR) + + + + + + + + + 10 + 75 + true + + + + P + + + + + + + + 10 + 75 + true + + + + I + + + + + + + + 10 + 75 + true + + + + D + + + + + + + dR_P_set + + + + + + + dR_P_get + + + + + + + dR_I_set + + + + + + + dR_I_get + + + + + + + dR_D_set + + + + + + + dR_D_get + + + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Pitch to dT FF term + + + + + + + + + 10 + 75 + true + + + + FF + + + + + + + P2dT_FF_set + + + + + + + P2dT_FF_get + + + + + + + + + + + SET + + + + + + + GET + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + +