From a8e7a65ccfc3337c32afda1e72f1acd145783c59 Mon Sep 17 00:00:00 2001 From: Fabian Reister <fabian.reister@kit.edu> Date: Tue, 24 Sep 2024 11:23:11 +0200 Subject: [PATCH] Hand Unit Gui: reworked GUI + added reloading of preshapes --- .../HandUnitPlugin/HandUnitGuiPlugin.cpp | 34 + .../HandUnitPlugin/HandUnitGuiPlugin.h | 3 +- .../HandUnitPlugin/HandUnitGuiPlugin.ui | 686 ++++++++---------- 3 files changed, 325 insertions(+), 398 deletions(-) diff --git a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.cpp b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.cpp index ea3190228..72ff523b0 100644 --- a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.cpp +++ b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.cpp @@ -57,8 +57,12 @@ namespace armarx setRightHandJointAnglesFlag(false) { // init gui + ARMARX_INFO << "Setup UI"; ui.setupUi(getWidget()); + ARMARX_INFO << "Done: Setup UI"; + + setLeftHandJointAngleUpdateTask = new PeriodicTask<HandUnitWidget>(this, &HandUnitWidget::setLeftHandJointAngles, 50); setRightHandJointAngleUpdateTask = new PeriodicTask<HandUnitWidget>(this, &HandUnitWidget::setRightHandJointAngles, 50); updateInfoTimer = new QTimer(this); @@ -185,6 +189,29 @@ namespace armarx setRightHandPreshape(ui.comboRightHandPreshapes->currentText().toUtf8().data()); } + void HandUnitWidget::reloadPreshapes() + { + ARMARX_INFO << "Reloading preshapes in robot unit ..."; + + // left hand unit + { + if(leftHandUnitProxy) + { + ARMARX_INFO << "Left hand unit: reloading preshapes."; + leftHandUnitProxy->reloadPreshapes(); + } + } + + // right hand unit + { + if(rightHandUnitProxy) + { + ARMARX_INFO << "Right hand unit: reloading preshapes."; + rightHandUnitProxy->reloadPreshapes(); + } + } + } + void HandUnitWidget::setLeftHandJointAngles() { // ARMARX_INFO << "setLeftHandJointAngles"; @@ -425,6 +452,8 @@ namespace armarx void HandUnitWidget::initGUIJointFrames() { + ARMARX_INFO << "initGUIJointFrames"; + NameValueMap currentLeftHandJointValues = leftHandUnitProxy->getCurrentJointValues(); // ARMARX_INFO << VAROUT(leftHandUnitProxy->getCurrentJointValues()); int frameLeftHandRowIdx = 0; @@ -488,6 +517,11 @@ namespace armarx } ui.comboRightHandJoints->setCurrentIndex(-1); + + + // reloading of preshapes + connect(ui.reloadPreshapesButton, SIGNAL(clicked()), this, SLOT(reloadPreshapes()), Qt::UniqueConnection); + } diff --git a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.h b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.h index 24d7900ce..dd68d856f 100644 --- a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.h +++ b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.h @@ -129,6 +129,8 @@ namespace armarx void selectLeftHandJoint(int i); void selectRightHandJoint(int i); + void reloadPreshapes(); + private: void setLeftHandPreshape(std::string preshape); void setRightHandPreshape(std::string preshape); @@ -170,4 +172,3 @@ namespace armarx }; using HandUnitGuiPluginPtr = std::shared_ptr<HandUnitWidget>; } - diff --git a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.ui b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.ui index cec1e1ea7..79ffd00e8 100644 --- a/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.ui +++ b/source/RobotAPI/gui-plugins/HandUnitPlugin/HandUnitGuiPlugin.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>637</width> - <height>396</height> + <width>987</width> + <height>802</height> </rect> </property> <property name="sizePolicy"> @@ -19,401 +19,293 @@ <property name="windowTitle"> <string>Form</string> </property> - <widget class="Line" name="lineLeftHand"> - <property name="geometry"> - <rect> - <x>146</x> - <y>35</y> - <width>16</width> - <height>25</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - <widget class="QFrame" name="frameLeftHand"> - <property name="geometry"> - <rect> - <x>9</x> - <y>156</y> - <width>301</width> - <height>231</height> - </rect> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QTableWidget" name="tableWidgetLeftHand"/> - </item> - </layout> - </widget> - <widget class="QComboBox" name="comboLeftHandPreshapes"> - <property name="geometry"> - <rect> - <x>9</x> - <y>35</y> - <width>60</width> - <height>25</height> - </rect> - </property> - </widget> - <widget class="QPushButton" name="buttonPreshapeLeftHand"> - <property name="geometry"> - <rect> - <x>71</x> - <y>35</y> - <width>80</width> - <height>25</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Preshape</string> - </property> - </widget> - <widget class="QPushButton" name="buttonOpenLeftHand"> - <property name="geometry"> - <rect> - <x>157</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Open</string> - </property> - </widget> - <widget class="QLabel" name="labelInfoLeftHand"> - <property name="geometry"> - <rect> - <x>9</x> - <y>9</y> - <width>85</width> - <height>17</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string><Info Here></string> - </property> - </widget> - <widget class="Line" name="line"> - <property name="geometry"> - <rect> - <x>310</x> - <y>0</y> - <width>20</width> - <height>401</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - <widget class="QPushButton" name="buttonCloseLeftHand"> - <property name="geometry"> - <rect> - <x>209</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - <widget class="QPushButton" name="buttonRelaxLeftHand"> - <property name="geometry"> - <rect> - <x>261</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Relax</string> - </property> - </widget> - <widget class="QComboBox" name="comboRightHandPreshapes"> - <property name="geometry"> - <rect> - <x>330</x> - <y>35</y> - <width>60</width> - <height>25</height> - </rect> - </property> - </widget> - <widget class="QPushButton" name="buttonOpenRightHand"> - <property name="geometry"> - <rect> - <x>478</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Open</string> - </property> - </widget> - <widget class="QPushButton" name="buttonPreshapeRightHand"> - <property name="geometry"> - <rect> - <x>392</x> - <y>35</y> - <width>80</width> - <height>25</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Preshape</string> - </property> - </widget> - <widget class="QPushButton" name="buttonCloseRightHand"> - <property name="geometry"> - <rect> - <x>530</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Close</string> - </property> - </widget> - <widget class="QPushButton" name="buttonRelaxRightHand"> - <property name="geometry"> - <rect> - <x>582</x> - <y>35</y> - <width>50</width> - <height>25</height> - </rect> - </property> - <property name="text"> - <string>Relax</string> - </property> - </widget> - <widget class="QLabel" name="labelInfoRightHand"> - <property name="geometry"> - <rect> - <x>330</x> - <y>9</y> - <width>85</width> - <height>17</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string><Info Here></string> - </property> - </widget> - <widget class="Line" name="lineRightHand"> - <property name="geometry"> - <rect> - <x>467</x> - <y>35</y> - <width>16</width> - <height>25</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - <widget class="QLabel" name="labelSelectLeftHandJoint"> - <property name="geometry"> - <rect> - <x>10</x> - <y>80</y> - <width>81</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Select Joint</string> - </property> - </widget> - <widget class="QComboBox" name="comboLeftHandJoints"> - <property name="geometry"> - <rect> - <x>100</x> - <y>75</y> - <width>150</width> - <height>25</height> - </rect> - </property> - </widget> - <widget class="QLCDNumber" name="lcdNumberLeftHandJointValue"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>117</y> - <width>64</width> - <height>26</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>100</height> - </size> - </property> - <property name="toolTip"> - <string/> - </property> - <property name="smallDecimalPoint"> - <bool>false</bool> - </property> - </widget> - <widget class="QSlider" name="horizontalSliderLeftHandJointPos"> - <property name="geometry"> - <rect> - <x>90</x> - <y>120</y> - <width>221</width> - <height>16</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - <widget class="QLCDNumber" name="lcdNumberRightHandJointValue"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>330</x> - <y>117</y> - <width>64</width> - <height>26</height> - </rect> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>100</height> - </size> - </property> - <property name="toolTip"> - <string/> - </property> - <property name="smallDecimalPoint"> - <bool>false</bool> - </property> - </widget> - <widget class="QLabel" name="labelSelectRightHandJoint"> - <property name="geometry"> - <rect> - <x>330</x> - <y>80</y> - <width>81</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Select Joint</string> - </property> - </widget> - <widget class="QFrame" name="frameRightHand"> - <property name="geometry"> - <rect> - <x>329</x> - <y>156</y> - <width>301</width> - <height>231</height> - </rect> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0"> - <widget class="QTableWidget" name="tableWidgetRightHand"/> - </item> - </layout> - </widget> - <widget class="QComboBox" name="comboRightHandJoints"> - <property name="geometry"> - <rect> - <x>420</x> - <y>75</y> - <width>150</width> - <height>25</height> - </rect> - </property> - </widget> - <widget class="QSlider" name="horizontalSliderRightHandJointPos"> - <property name="geometry"> - <rect> - <x>410</x> - <y>120</y> - <width>221</width> - <height>16</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> + <layout class="QGridLayout" name="gridLayout"> + <item row="3" column="4"> + <widget class="Line" name="lineLeftHand"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="3" column="13"> + <widget class="Line" name="lineRightHand"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="2" column="8" rowspan="5"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="0" column="0"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="baseContainer"> + <item> + <layout class="QVBoxLayout" name="left"> + <item> + <widget class="QLabel" name="labelInfoLeftHand"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string><Info Here></string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QComboBox" name="comboLeftHandPreshapes"/> + </item> + <item> + <widget class="QPushButton" name="buttonOpenLeftHand"> + <property name="text"> + <string>Open</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonPreshapeLeftHand"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Preshape</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonCloseLeftHand"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonRelaxLeftHand"> + <property name="text"> + <string>Relax</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="labelSelectLeftHandJoint"> + <property name="text"> + <string>Select Joint</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboLeftHandJoints"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLCDNumber" name="lcdNumberLeftHandJointValue"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>100</height> + </size> + </property> + <property name="toolTip"> + <string/> + </property> + <property name="smallDecimalPoint"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="horizontalSliderLeftHandJointPos"> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTableWidget" name="tableWidgetLeftHand"/> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="right"> + <item> + <widget class="QLabel" name="labelInfoRightHand"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string><Info Here></string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QComboBox" name="comboRightHandPreshapes"/> + </item> + <item> + <widget class="QPushButton" name="buttonOpenRightHand"> + <property name="text"> + <string>Open</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonPreshapeRightHand"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Preshape</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonCloseRightHand"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonRelaxRightHand"> + <property name="text"> + <string>Relax</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="labelSelectRightHandJoint"> + <property name="text"> + <string>Select Joint</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboRightHandJoints"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <widget class="QLCDNumber" name="lcdNumberRightHandJointValue"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>100</height> + </size> + </property> + <property name="toolTip"> + <string/> + </property> + <property name="smallDecimalPoint"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="horizontalSliderRightHandJointPos"> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTableWidget" name="tableWidgetRightHand"/> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="general"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <widget class="QPushButton" name="reloadPreshapesButton"> + <property name="text"> + <string>Reload preshapes</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </item> + </layout> </widget> <resources/> <connections/> -- GitLab