diff --git a/source/RobotAPI/gui-plugins/CMakeLists.txt b/source/RobotAPI/gui-plugins/CMakeLists.txt index 4f734de78a1c293dd98674e699077c75cb62d588..9095676c94a21da7a8b8615a22fcef619a778c92 100644 --- a/source/RobotAPI/gui-plugins/CMakeLists.txt +++ b/source/RobotAPI/gui-plugins/CMakeLists.txt @@ -14,3 +14,5 @@ add_subdirectory(ViewSelection) add_subdirectory(LaserScannerPlugin) add_subdirectory(RobotUnitPlugin) + +add_subdirectory(HomogeneousMatrixCalculator) \ No newline at end of file diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/CMakeLists.txt b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..11fcc53e37344c679033345e425527e9a29af94e --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/CMakeLists.txt @@ -0,0 +1,35 @@ + +armarx_set_target("HomogeneousMatrixCalculatorGuiPlugin") + +find_package(Qt4 COMPONENTS QtCore QtGui QtDesigner) + +armarx_build_if(QT_FOUND "Qt not available") +armarx_build_if(Simox_FOUND "VirtualRobot not available") +armarx_build_if(ArmarXGui_FOUND "ArmarXGui not available") + +if(QT_FOUND AND Simox_FOUND) + include_directories(${QT_USE_FILE} ${Simox_INCLUDE_DIRS}) +endif() + +set(SOURCES + HomogeneousMatrixCalculatorGuiPlugin.cpp + HomogeneousMatrixCalculatorWidgetController.cpp +) + +set(HEADERS + HomogeneousMatrixCalculatorGuiPlugin.h + HomogeneousMatrixCalculatorWidgetController.h +) + +set(GUI_MOC_HDRS HomogeneousMatrixCalculatorWidgetController.h) + +set(GUI_UIS + HomogeneousMatrixCalculatorWidget.ui +) + +# Add more libraries you depend on here, e.g. ${QT_LIBRARIES}. +set(COMPONENT_LIBS ${QT_LIBRARIES} ${Simox_LIBRARIES}) + +if(ArmarXGui_FOUND) + armarx_gui_library(HomogeneousMatrixCalculatorGuiPlugin "${SOURCES}" "${GUI_MOC_HDRS}" "${GUI_UIS}" "" "${COMPONENT_LIBS}") +endif() diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.cpp b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f55672ead4789aa417a511df25d6f2b14f1bf5cd --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.cpp @@ -0,0 +1,34 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * \package RobotAPI::gui-plugins::HomogeneousMatrixCalculatorGuiPlugin + * \author Raphael ( ufdrv at student dot kit dot edu ) + * \date 2017 + * \copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "HomogeneousMatrixCalculatorGuiPlugin.h" + +#include "HomogeneousMatrixCalculatorWidgetController.h" + +using namespace armarx; + +HomogeneousMatrixCalculatorGuiPlugin::HomogeneousMatrixCalculatorGuiPlugin() +{ + addWidget < HomogeneousMatrixCalculatorWidgetController > (); +} + +Q_EXPORT_PLUGIN2(armarx_gui_HomogeneousMatrixCalculatorGuiPlugin, HomogeneousMatrixCalculatorGuiPlugin) diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.h b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.h new file mode 100644 index 0000000000000000000000000000000000000000..d9bb1a09d3451a8822703ecf2eb6f4c34f41f973 --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorGuiPlugin.h @@ -0,0 +1,51 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * \package RobotAPI::gui-plugins::HomogeneousMatrixCalculator + * \author Raphael ( ufdrv at student dot kit dot edu ) + * \date 2017 + * \copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_RobotAPI_HomogeneousMatrixCalculator_GuiPlugin_H +#define _ARMARX_RobotAPI_HomogeneousMatrixCalculator_GuiPlugin_H + +#include <ArmarXCore/core/system/ImportExportComponent.h> +#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h> +#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h> + +namespace armarx +{ + /** + * \class HomogeneousMatrixCalculatorGuiPlugin + * \ingroup ArmarXGuiPlugins + * \brief HomogeneousMatrixCalculatorGuiPlugin brief description + * + * Detailed description + */ + class ARMARXCOMPONENT_IMPORT_EXPORT HomogeneousMatrixCalculatorGuiPlugin: + public armarx::ArmarXGuiPlugin + { + public: + /** + * All widgets exposed by this plugin are added in the constructor + * via calls to addWidget() + */ + HomogeneousMatrixCalculatorGuiPlugin(); + }; +} + +#endif diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..cc8becd83ad1d6004ae17a780f538a81910a31bc --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidget.ui @@ -0,0 +1,344 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>HomogeneousMatrixCalculatorWidget</class> + <widget class="QWidget" name="HomogeneousMatrixCalculatorWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>766</width> + <height>304</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> + </widget> + </item> + <item row="5" column="2"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</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> + </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"> + <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="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/> + <connections> + <connection> + <sender>lineEdit03</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEditX</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>391</x> + <y>40</y> + </hint> + <hint type="destinationlabel"> + <x>602</x> + <y>44</y> + </hint> + </hints> + </connection> + <connection> + <sender>lineEdit13</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEditY</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>373</x> + <y>72</y> + </hint> + <hint type="destinationlabel"> + <x>578</x> + <y>76</y> + </hint> + </hints> + </connection> + <connection> + <sender>lineEdit23</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEditZ</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>380</x> + <y>111</y> + </hint> + <hint type="destinationlabel"> + <x>608</x> + <y>111</y> + </hint> + </hints> + </connection> + <connection> + <sender>lineEditX</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEdit03</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>579</x> + <y>57</y> + </hint> + <hint type="destinationlabel"> + <x>442</x> + <y>57</y> + </hint> + </hints> + </connection> + <connection> + <sender>lineEditY</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEdit13</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>614</x> + <y>89</y> + </hint> + <hint type="destinationlabel"> + <x>389</x> + <y>89</y> + </hint> + </hints> + </connection> + <connection> + <sender>lineEditZ</sender> + <signal>textEdited(QString)</signal> + <receiver>lineEdit23</receiver> + <slot>setText(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>608</x> + <y>125</y> + </hint> + <hint type="destinationlabel"> + <x>356</x> + <y>120</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5589cf0a010133c719d969a6340cb9ccffe0ccd4 --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.cpp @@ -0,0 +1,176 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * \package RobotAPI::gui-plugins::HomogeneousMatrixCalculatorWidgetController + * \author Raphael ( ufdrv at student dot kit dot edu ) + * \date 2017 + * \copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "HomogeneousMatrixCalculatorWidgetController.h" + +#include <string> + +#include <VirtualRobot/MathTools.h> + +#include <QDoubleValidator> + +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())); +} + + +HomogeneousMatrixCalculatorWidgetController::~HomogeneousMatrixCalculatorWidgetController() +{ + +} + + +void HomogeneousMatrixCalculatorWidgetController::loadSettings(QSettings* settings) +{ + +} + +void HomogeneousMatrixCalculatorWidgetController::saveSettings(QSettings* settings) +{ + +} + + +void HomogeneousMatrixCalculatorWidgetController::onInitComponent() +{ + +} + + +void HomogeneousMatrixCalculatorWidgetController::onConnectComponent() +{ + +} + +void armarx::HomogeneousMatrixCalculatorWidgetController::changed4f() +{ + 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; + 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))); +} + +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))); +} diff --git a/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h new file mode 100644 index 0000000000000000000000000000000000000000..75b64d19eda7f1dddaa4e5c5525cd91125356b32 --- /dev/null +++ b/source/RobotAPI/gui-plugins/HomogeneousMatrixCalculator/HomogeneousMatrixCalculatorWidgetController.h @@ -0,0 +1,118 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::gui-plugins::HomogeneousMatrixCalculatorWidgetController + * @author Raphael ( ufdrv at student dot kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_RobotAPI_HomogeneousMatrixCalculator_WidgetController_H +#define _ARMARX_RobotAPI_HomogeneousMatrixCalculator_WidgetController_H + +#include "ui_HomogeneousMatrixCalculatorWidget.h" + +#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h> +#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h> + +#include <ArmarXCore/core/system/ImportExportComponent.h> + +namespace armarx +{ + /** + \page ArmarXGui-GuiPlugins-HomogeneousMatrixCalculator HomogeneousMatrixCalculator + \brief The HomogeneousMatrixCalculator allows visualizing ... + + \image html HomogeneousMatrixCalculator.png + The user can + + API Documentation \ref HomogeneousMatrixCalculatorWidgetController + + \see HomogeneousMatrixCalculatorGuiPlugin + */ + + /** + * \class HomogeneousMatrixCalculatorWidgetController + * \brief HomogeneousMatrixCalculatorWidgetController brief one line description + * + * Detailed description + */ + class ARMARXCOMPONENT_IMPORT_EXPORT + HomogeneousMatrixCalculatorWidgetController: + public armarx::ArmarXComponentWidgetController + { + Q_OBJECT + + public: + /** + * Controller Constructor + */ + explicit HomogeneousMatrixCalculatorWidgetController(); + + /** + * Controller destructor + */ + virtual ~HomogeneousMatrixCalculatorWidgetController(); + + /** + * @see ArmarXWidgetController::loadSettings() + */ + virtual void loadSettings(QSettings* settings); + + /** + * @see ArmarXWidgetController::saveSettings() + */ + virtual void saveSettings(QSettings* settings); + + /** + * Returns the Widget name displayed in the ArmarXGui to create an + * instance of this class. + */ + virtual QString getWidgetName() const + { + return "Util.HomogeneousMatrixCalculator"; + } + + /** + * \see armarx::Component::onInitComponent() + */ + virtual void onInitComponent(); + + /** + * \see armarx::Component::onConnectComponent() + */ + virtual void onConnectComponent(); + + public slots: + /* QT slot declarations */ + + signals: + /* QT signal declarations */ + + private slots: + void changed4f(); + + void changedrpy(); + + private: + /** + * Widget Form + */ + Ui::HomogeneousMatrixCalculatorWidget widget; + }; +} + +#endif