From c2ec60f5ce2ec88644644d2118cbcb75b5a451d9 Mon Sep 17 00:00:00 2001 From: beuchatp <beuchatp@control.ee.ethz.ch> Date: Wed, 22 May 2019 10:18:51 +0200 Subject: [PATCH] Added destination labels to tuning controller --- .../forms/tuningcontrollertab.ui | 184 +++++++++++++++++- .../src/tuningcontrollertab.cpp | 30 +++ 2 files changed, 213 insertions(+), 1 deletion(-) diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/tuningcontrollertab.ui b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/tuningcontrollertab.ui index 28732632..54f3db1f 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/tuningcontrollertab.ui +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/tuningcontrollertab.ui @@ -860,6 +860,188 @@ </property> </widget> </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QFrame" name="frame_A_left"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:green;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_23"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Destination A</string> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="frame_A_right"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:green;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QFrame" name="frame_B_left"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:green;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_24"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Destination B</string> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="frame_B_right"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color:green;</string> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + </widget> + </item> <item> <spacer name="horizontalSpacer"> <property name="orientation"> @@ -878,7 +1060,7 @@ <item row="9" column="1"> <widget class="QLabel" name="label_20"> <property name="text"> - <string>step 2: click toggle button to test the performance</string> + <string>step 2: click toggle button to change the destination</string> </property> </widget> </item> diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/tuningcontrollertab.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/tuningcontrollertab.cpp index ad36c34d..6c1bf28f 100644 --- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/tuningcontrollertab.cpp +++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/tuningcontrollertab.cpp @@ -55,6 +55,12 @@ TuningControllerTab::TuningControllerTab(QWidget *parent) : ui->lineEdit_setpoint->setText( QString::number( m_current_setpoint, 'f', DECIMAL_PLACES_SETPOINT) ); + ui->frame_A_left->setVisible(false); + ui->frame_A_right->setVisible(false); + ui->frame_B_left->setVisible(false); + ui->frame_B_right->setVisible(false); + + #ifdef CATKIN_MAKE //ros::init(); @@ -324,13 +330,37 @@ void TuningControllerTab::on_button_setpoint_toggle_clicked() float new_setpoint = 0.0; if (setpoint_copy < SETPOINT_X_MINUS) + { new_setpoint = SETPOINT_X_MINUS; + ui->frame_A_left->setVisible(true); + ui->frame_A_right->setVisible(true); + ui->frame_B_left->setVisible(false); + ui->frame_B_right->setVisible(false); + } else if (setpoint_copy < 0.0) + { new_setpoint = SETPOINT_X_PLUS; + ui->frame_A_left->setVisible(false); + ui->frame_A_right->setVisible(false); + ui->frame_B_left->setVisible(true); + ui->frame_B_right->setVisible(true); + } else if (setpoint_copy > SETPOINT_X_PLUS) + { new_setpoint = SETPOINT_X_PLUS; + ui->frame_A_left->setVisible(false); + ui->frame_A_right->setVisible(false); + ui->frame_B_left->setVisible(true); + ui->frame_B_right->setVisible(true); + } else + { new_setpoint = SETPOINT_X_MINUS; + ui->frame_A_left->setVisible(true); + ui->frame_A_right->setVisible(true); + ui->frame_B_left->setVisible(false); + ui->frame_B_right->setVisible(false); + } ui->lineEdit_setpoint->setText( QString::number( new_setpoint, 'f', DECIMAL_PLACES_SETPOINT) ); float lineEdit_as_float_rounded = (ui->lineEdit_setpoint->text()).toFloat(); -- GitLab