diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui index cc8becd83ad1d6004ae17a780f538a81910a31bc..582b2adbc949d80ed9e6f9451b65477e978b6b63 100644 --- a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui @@ -7,239 +7,617 @@ <x>0</x> <y>0</y> <width>766</width> - <height>304</height> + <height>383</height> </rect> </property> <property name="windowTitle"> <string>HomogeneousMatrixCalculatorWidget</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="5"> - <widget class="QLineEdit" name="lineEditX"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLineEdit" name="lineEdit13"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="2" column="6"> - <widget class="QLineEdit" name="lineEditRY"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>rx, ry, rz</string> - </property> - </widget> - </item> - <item row="1" column="6"> - <widget class="QLineEdit" name="lineEditRX"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>X, Y, Z</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="4"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Homogenous Matrix</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLineEdit" name="lineEdit12"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="lineEdit01"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="lineEdit11"> - <property name="text"> - <string>1</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLineEdit" name="lineEdit20"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLineEdit" name="lineEdit03"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="lineEdit21"> - <property name="text"> - <string>0</string> - </property> + <item row="0" column="3"> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>2</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>XYZ/RPY</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="2"> + <widget class="QLineEdit" name="lineEditRX"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>rx, ry, rz</string> + </property> + </widget> + </item> + <item row="1" column="0" rowspan="3"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>=</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEditY"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QLineEdit" name="lineEditRZ"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <spacer name="horizontalSpacer_4"> + <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 row="2" column="2"> + <widget class="QLineEdit" name="lineEditRY"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>X, Y, Z</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="lineEditZ"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEditX"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="Multiply"> + <attribute name="title"> + <string>Multiply</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEditM0"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="2" rowspan="5"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>=</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="lineEditM3"> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLineEdit" name="lineEditR1"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEditM1"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLineEdit" name="lineEditR3"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEditM2"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="0" rowspan="5"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>*</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="lineEditR0"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLineEdit" name="lineEditR2"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="4"> + <spacer name="horizontalSpacer_2"> + <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 row="4" column="1"> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Inverse</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="3" column="2"> + <widget class="QLineEdit" name="lineEditI31"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="lineEditI11"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLineEdit" name="lineEditI32"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLineEdit" name="lineEditI01"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0" rowspan="4"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>=</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLineEdit" name="lineEditI03"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QLineEdit" name="lineEditI13"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="4"> + <widget class="QLineEdit" name="lineEditI33"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEditI10"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLineEdit" name="lineEditI22"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QLineEdit" name="lineEditI23"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLineEdit" name="lineEditI21"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="lineEditI02"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEditI20"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="5"> + <spacer name="horizontalSpacer_3"> + <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 row="0" column="1"> + <widget class="QLineEdit" name="lineEditI00"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="lineEditI30"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLineEdit" name="lineEditI12"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="1"> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> - <item row="5" column="2"> - <spacer name="verticalSpacer"> + <item row="0" column="4"> + <spacer name="horizontalSpacer"> <property name="orientation"> - <enum>Qt::Vertical</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>20</width> - <height>40</height> + <width>40</width> + <height>20</height> </size> </property> </spacer> </item> - <item row="3" column="5"> - <widget class="QLineEdit" name="lineEditZ"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="2" column="5"> - <widget class="QLineEdit" name="lineEditY"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLineEdit" name="lineEdit30"> - <property name="text"> - <string>0</string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLineEdit" name="lineEdit10"> - <property name="text"> - <string>0</string> - </property> + <item row="0" column="0"> + <widget class="QTabWidget" name="tabWidget_2"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Homogenous Matrix</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="3" column="2"> + <widget class="QLineEdit" name="lineEdit32"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLineEdit" name="lineEdit13"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLineEdit" name="lineEdit00"> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLineEdit" name="lineEdit33"> + <property name="text"> + <string>1</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLineEdit" name="lineEdit22"> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="lineEdit31"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLineEdit" name="lineEdit30"> + <property name="text"> + <string>0</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLineEdit" name="lineEdit03"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLineEdit" name="lineEdit10"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lineEdit11"> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLineEdit" name="lineEdit20"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="lineEdit12"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLineEdit" name="lineEdit23"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="lineEdit01"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLineEdit" name="lineEdit02"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="lineEdit21"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> <item row="1" column="0"> - <widget class="QLineEdit" name="lineEdit00"> - <property name="text"> - <string>1</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QLineEdit" name="lineEdit22"> - <property name="text"> - <string>1</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLineEdit" name="lineEdit02"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="lineEdit31"> - <property name="text"> - <string>0</string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QLineEdit" name="lineEdit32"> - <property name="text"> - <string>0</string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="QLineEdit" name="lineEdit23"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="0" column="7"> - <spacer name="horizontalSpacer"> + <spacer name="verticalSpacer"> <property name="orientation"> - <enum>Qt::Horizontal</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>40</width> - <height>20</height> + <width>20</width> + <height>40</height> </size> </property> </spacer> </item> - <item row="4" column="3"> - <widget class="QLineEdit" name="lineEdit33"> - <property name="text"> - <string>1</string> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="3" column="6"> - <widget class="QLineEdit" name="lineEditRZ"> - <property name="text"> - <string>0</string> - </property> - </widget> - </item> - <item row="3" column="4"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>=</string> - </property> - </widget> - </item> </layout> </widget> <resources/> diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp index 5589cf0a010133c719d969a6340cb9ccffe0ccd4..d1128c5134f6125c99dc5c41981c51c35a08cb31 100644 --- a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp @@ -24,96 +24,65 @@ #include <string> -#include <VirtualRobot/MathTools.h> #include <QDoubleValidator> +#include <QLineEdit> using namespace armarx; HomogeneousMatrixCalculatorWidgetController::HomogeneousMatrixCalculatorWidgetController() { widget.setupUi(getWidget()); - widget.lineEdit00->setValidator(new QDoubleValidator(this)); - widget.lineEdit01->setValidator(new QDoubleValidator(this)); - widget.lineEdit02->setValidator(new QDoubleValidator(this)); - widget.lineEdit03->setValidator(new QDoubleValidator(this)); - widget.lineEdit10->setValidator(new QDoubleValidator(this)); - widget.lineEdit11->setValidator(new QDoubleValidator(this)); - widget.lineEdit12->setValidator(new QDoubleValidator(this)); - widget.lineEdit13->setValidator(new QDoubleValidator(this)); - widget.lineEdit20->setValidator(new QDoubleValidator(this)); - widget.lineEdit21->setValidator(new QDoubleValidator(this)); - widget.lineEdit22->setValidator(new QDoubleValidator(this)); - widget.lineEdit23->setValidator(new QDoubleValidator(this)); - widget.lineEdit30->setValidator(new QDoubleValidator(this)); - widget.lineEdit31->setValidator(new QDoubleValidator(this)); - widget.lineEdit32->setValidator(new QDoubleValidator(this)); - widget.lineEdit33->setValidator(new QDoubleValidator(this)); - widget.lineEditX->setValidator (new QDoubleValidator(this)); - widget.lineEditY->setValidator (new QDoubleValidator(this)); - widget.lineEditZ->setValidator (new QDoubleValidator(this)); - widget.lineEditRX->setValidator(new QDoubleValidator(this)); - widget.lineEditRY->setValidator(new QDoubleValidator(this)); - widget.lineEditRZ->setValidator(new QDoubleValidator(this)); - - widget.lineEdit00->setFixedWidth(100); - widget.lineEdit01->setFixedWidth(100); - widget.lineEdit02->setFixedWidth(100); - widget.lineEdit03->setFixedWidth(100); - widget.lineEdit10->setFixedWidth(100); - widget.lineEdit11->setFixedWidth(100); - widget.lineEdit12->setFixedWidth(100); - widget.lineEdit13->setFixedWidth(100); - widget.lineEdit20->setFixedWidth(100); - widget.lineEdit21->setFixedWidth(100); - widget.lineEdit22->setFixedWidth(100); - widget.lineEdit23->setFixedWidth(100); - widget.lineEdit30->setFixedWidth(100); - widget.lineEdit31->setFixedWidth(100); - widget.lineEdit32->setFixedWidth(100); - widget.lineEdit33->setFixedWidth(100); - widget.lineEditX->setFixedWidth(100); - widget.lineEditY->setFixedWidth(100); - widget.lineEditZ->setFixedWidth(100); - widget.lineEditRX->setFixedWidth(100); - widget.lineEditRY->setFixedWidth(100); - widget.lineEditRZ->setFixedWidth(100); - - widget.lineEdit00->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit01->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit02->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit03->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit10->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit11->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit12->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit13->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit20->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit21->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit22->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit23->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit30->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit31->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit32->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEdit33->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditY->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditZ->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditRX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditRY->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - widget.lineEditRZ->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); - - connect(widget.lineEdit00,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit01,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit02,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit10,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit11,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit12,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit20,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit21,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEdit22,SIGNAL(textEdited(QString)),this,SLOT(changed4f())); - connect(widget.lineEditRX,SIGNAL(textEdited(QString)),this,SLOT(changedrpy())); - connect(widget.lineEditRY,SIGNAL(textEdited(QString)),this,SLOT(changedrpy())); - connect(widget.lineEditRZ,SIGNAL(textEdited(QString)),this,SLOT(changedrpy())); + + std::vector<QLineEdit*> edits + { + widget.lineEdit00, widget.lineEdit01, widget.lineEdit02, widget.lineEdit03, + widget.lineEdit10, widget.lineEdit11, widget.lineEdit12, widget.lineEdit13, + widget.lineEdit20, widget.lineEdit21, widget.lineEdit22, widget.lineEdit23, + widget.lineEdit30, widget.lineEdit31, widget.lineEdit32, widget.lineEdit33, + + widget.lineEditI00, widget.lineEditI01, widget.lineEditI02, widget.lineEditI03, + widget.lineEditI10, widget.lineEditI11, widget.lineEditI12, widget.lineEditI13, + widget.lineEditI20, widget.lineEditI21, widget.lineEditI22, widget.lineEditI23, + widget.lineEditI30, widget.lineEditI31, widget.lineEditI32, widget.lineEditI33, + + widget.lineEditX, widget.lineEditY, widget.lineEditZ, + widget.lineEditRX, widget.lineEditRY, widget.lineEditRZ, + + widget.lineEditM0, widget.lineEditM1, widget.lineEditM2, widget.lineEditM3, + widget.lineEditR0, widget.lineEditR1, widget.lineEditR2, widget.lineEditR3, + }; + + for (auto edit : edits) + { + edit->setValidator(new QDoubleValidator(this)); + edit->setFixedWidth(100); + edit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + } + connect(widget.lineEdit00, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit01, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit02, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit10, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit11, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit12, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit20, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit21, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + connect(widget.lineEdit22, SIGNAL(textEdited(QString)), this, SLOT(changed4f())); + + connect(widget.lineEditRX, SIGNAL(textEdited(QString)), this, SLOT(changedrpy())); + connect(widget.lineEditRY, SIGNAL(textEdited(QString)), this, SLOT(changedrpy())); + connect(widget.lineEditRZ, SIGNAL(textEdited(QString)), this, SLOT(changedrpy())); + + connect(widget.lineEditM0, SIGNAL(textEdited(QString)), this, SLOT(recalcProd())); + connect(widget.lineEditM1, SIGNAL(textEdited(QString)), this, SLOT(recalcProd())); + connect(widget.lineEditM2, SIGNAL(textEdited(QString)), this, SLOT(recalcProd())); + connect(widget.lineEditM3, SIGNAL(textEdited(QString)), this, SLOT(recalcProd())); + + connect(widget.lineEdit03, SIGNAL(textChanged(QString)), this, SLOT(recalcInvAndProd())); + connect(widget.lineEdit13, SIGNAL(textChanged(QString)), this, SLOT(recalcInvAndProd())); + connect(widget.lineEdit23, SIGNAL(textChanged(QString)), this, SLOT(recalcInvAndProd())); + } @@ -145,17 +114,24 @@ void HomogeneousMatrixCalculatorWidgetController::onConnectComponent() } -void armarx::HomogeneousMatrixCalculatorWidgetController::changed4f() +Eigen::Matrix4d HomogeneousMatrixCalculatorWidgetController::getMatrix() { Eigen::Matrix4d m; - m << widget.lineEdit00->text().toDouble(),widget.lineEdit01->text().toDouble(),widget.lineEdit02->text().toDouble(),0, - widget.lineEdit10->text().toDouble(),widget.lineEdit11->text().toDouble(),widget.lineEdit12->text().toDouble(),0, - widget.lineEdit20->text().toDouble(),widget.lineEdit21->text().toDouble(),widget.lineEdit22->text().toDouble(),0, - 0 ,0 ,0 ,1; + m << widget.lineEdit00->text().toDouble(), widget.lineEdit01->text().toDouble(), widget.lineEdit02->text().toDouble(), widget.lineEdit03->text().toDouble(), + widget.lineEdit10->text().toDouble(), widget.lineEdit11->text().toDouble(), widget.lineEdit12->text().toDouble(), widget.lineEdit13->text().toDouble(), + widget.lineEdit20->text().toDouble(), widget.lineEdit21->text().toDouble(), widget.lineEdit22->text().toDouble(), widget.lineEdit23->text().toDouble(), + widget.lineEdit30->text().toDouble(), widget.lineEdit31->text().toDouble(), widget.lineEdit32->text().toDouble(), widget.lineEdit33->text().toDouble(); + return m; +} + +void armarx::HomogeneousMatrixCalculatorWidgetController::changed4f() +{ + Eigen::Matrix4d m = getMatrix(); Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen4f2rpy(m.cast<float>()); widget.lineEditRX->setText(QString::number(rpy(0))); widget.lineEditRY->setText(QString::number(rpy(1))); widget.lineEditRZ->setText(QString::number(rpy(2))); + recalcInvAndProd(); } void armarx::HomogeneousMatrixCalculatorWidgetController::changedrpy() @@ -163,14 +139,56 @@ void armarx::HomogeneousMatrixCalculatorWidgetController::changedrpy() float r = static_cast<float>(widget.lineEditRX->text().toDouble()); float p = static_cast<float>(widget.lineEditRY->text().toDouble()); float y = static_cast<float>(widget.lineEditRZ->text().toDouble()); - Eigen::Matrix4f m = VirtualRobot::MathTools::rpy2eigen4f(r,p,y); - widget.lineEdit00->setText(QString::number(m(0,0))); - widget.lineEdit01->setText(QString::number(m(0,1))); - widget.lineEdit02->setText(QString::number(m(0,2))); - widget.lineEdit10->setText(QString::number(m(1,0))); - widget.lineEdit11->setText(QString::number(m(1,1))); - widget.lineEdit12->setText(QString::number(m(1,2))); - widget.lineEdit20->setText(QString::number(m(2,0))); - widget.lineEdit21->setText(QString::number(m(2,1))); - widget.lineEdit22->setText(QString::number(m(2,2))); + Eigen::Matrix4f m = VirtualRobot::MathTools::rpy2eigen4f(r, p, y); + widget.lineEdit00->setText(QString::number(m(0, 0))); + widget.lineEdit01->setText(QString::number(m(0, 1))); + widget.lineEdit02->setText(QString::number(m(0, 2))); + widget.lineEdit10->setText(QString::number(m(1, 0))); + widget.lineEdit11->setText(QString::number(m(1, 1))); + widget.lineEdit12->setText(QString::number(m(1, 2))); + widget.lineEdit20->setText(QString::number(m(2, 0))); + widget.lineEdit21->setText(QString::number(m(2, 1))); + widget.lineEdit22->setText(QString::number(m(2, 2))); + recalcInvAndProd(); +} + +void HomogeneousMatrixCalculatorWidgetController::recalcInv() +{ + Eigen::Matrix4d m = getMatrix().inverse(); + widget.lineEditI00->setText(QString::number(m(0, 0))); + widget.lineEditI01->setText(QString::number(m(0, 1))); + widget.lineEditI02->setText(QString::number(m(0, 2))); + widget.lineEditI03->setText(QString::number(m(0, 3))); + widget.lineEditI10->setText(QString::number(m(1, 0))); + widget.lineEditI11->setText(QString::number(m(1, 1))); + widget.lineEditI12->setText(QString::number(m(1, 2))); + widget.lineEditI13->setText(QString::number(m(1, 3))); + widget.lineEditI20->setText(QString::number(m(2, 0))); + widget.lineEditI21->setText(QString::number(m(2, 1))); + widget.lineEditI22->setText(QString::number(m(2, 2))); + widget.lineEditI23->setText(QString::number(m(2, 3))); + widget.lineEditI30->setText(QString::number(m(3, 0))); + widget.lineEditI31->setText(QString::number(m(3, 1))); + widget.lineEditI32->setText(QString::number(m(3, 2))); + widget.lineEditI33->setText(QString::number(m(3, 3))); +} + +void HomogeneousMatrixCalculatorWidgetController::recalcProd() +{ + Eigen::Vector4d v; + v << widget.lineEditM0->text().toDouble(), + widget.lineEditM1->text().toDouble(), + widget.lineEditM2->text().toDouble(), + widget.lineEditM3->text().toDouble(); + Eigen::Vector4d r = getMatrix() * v; + widget.lineEditR0->setText(QString::number(r(0))); + widget.lineEditR1->setText(QString::number(r(1))); + widget.lineEditR2->setText(QString::number(r(2))); + widget.lineEditR3->setText(QString::number(r(3))); +} + +void HomogeneousMatrixCalculatorWidgetController::recalcInvAndProd() +{ + recalcInv(); + recalcProd(); } diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h index 75b64d19eda7f1dddaa4e5c5525cd91125356b32..996e6dfb358db75365f116826554ff64dc0a4def 100644 --- a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h @@ -25,6 +25,8 @@ #include "ui_HomogeneousMatrixCalculatorWidget.h" +#include <VirtualRobot/MathTools.h> + #include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h> #include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h> @@ -52,7 +54,7 @@ namespace armarx */ class ARMARXCOMPONENT_IMPORT_EXPORT HomogeneousMatrixCalculatorWidgetController: - public armarx::ArmarXComponentWidgetController + public armarx::ArmarXComponentWidgetController { Q_OBJECT @@ -96,6 +98,7 @@ namespace armarx */ virtual void onConnectComponent(); + Eigen::Matrix4d getMatrix(); public slots: /* QT slot declarations */ @@ -107,6 +110,11 @@ namespace armarx void changedrpy(); + void recalcInv(); + void recalcProd(); + void recalcInvAndProd(); + + private: /** * Widget Form