KinematicUnitConfigDialog.cpp
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package ArmarX::
17* @author Mirko Waechter ( mirko.waechter at kit dot edu)
18* @date 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
24
25#include <QMessageBox>
26#include <QPushButton>
27#include <QTimer>
28
29#include <RobotAPI/gui-plugins/KinematicUnitPlugin/ui_KinematicUnitConfigDialog.h>
30
31
32// ArmarX
33#include <IceUtil/UUID.h>
34
36
37#include <RobotAPI/interface/core/RobotState.h>
38#include <RobotAPI/interface/units/KinematicUnitInterface.h>
39
40using namespace armarx;
41
43 QDialog(parent), ui(new Ui::KinematicUnitConfigDialog), uuid(IceUtil::generateUUID())
44{
45 ui->setupUi(this);
46
47 connect(this->ui->buttonBox, SIGNAL(accepted()), this, SLOT(verifyConfig()));
48 ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
49 ui->buttonBox->button(QDialogButtonBox::Cancel)->setDefault(false);
50 ui->buttonBox->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
51 proxyFinder = new IceProxyFinder<KinematicUnitInterfacePrx>(this);
52 proxyFinder->setSearchMask("*KinematicUnit|KinematicUnit*");
53 ui->gridLayout->addWidget(proxyFinder, 0, 1, 1, 2);
54
55 connect(proxyFinder->getProxyNameComboBox(),
56 SIGNAL(currentIndexChanged(int)),
57 this,
58 SLOT(selectionChanged(int)));
59 connect(proxyFinder->getProxyNameComboBox(),
60 SIGNAL(editTextChanged(QString)),
61 this,
62 SLOT(proxyNameChanged(QString)));
63}
64
69
70void
72{
73 proxyFinder->setIceManager(getIceManager());
74}
75
76void
80
81void
83{
84 QObject::disconnect();
85}
86
87void
89{
90 if (proxyFinder->getSelectedProxyName().trimmed().length() == 0)
91 {
92 QMessageBox::critical(this, "Invalid Configuration", "The proxy name must not be empty");
93 }
94 else
95 {
96 this->accept();
97 }
98}
99
100void
101KinematicUnitConfigDialog::updateSubconfig(std::string kinematicUnitName)
102{
103
104 try
105 {
106 ARMARX_INFO << "Connecting to KinematicUnitProxy " << kinematicUnitName;
107
108 KinematicUnitInterfacePrx kinematicUnitInterfacePrx =
109 getProxy<KinematicUnitInterfacePrx>(kinematicUnitName);
110 std::string topicName = kinematicUnitInterfacePrx->getReportTopicName();
111 std::string robotNodeSetName = kinematicUnitInterfacePrx->getRobotNodeSetName();
112 std::string rfile = kinematicUnitInterfacePrx->getRobotFilename();
113 ui->labelTopic->setText(QString(topicName.c_str()));
114 ui->labelRobotModel->setText(QString(rfile.c_str()));
115 ui->labelRNS->setText(QString(robotNodeSetName.c_str()));
116 }
117 catch (...)
118 {
119 ARMARX_INFO << "Could not connect to KinematicUnitProxy " << kinematicUnitName;
120 }
121}
122
123void
125{
126 ARMARX_LOG << "Selected entry:" << nr;
127 ui->labelTopic->setText("");
128 ui->labelRobotModel->setText("");
129 ui->labelRNS->setText("");
130 if (nr < 0)
131 {
132 return;
133 }
134 std::string kinematicUnitName = proxyFinder->getSelectedProxyName().toStdString();
135
136 updateSubconfig(kinematicUnitName);
137}
138
139void
141{
142 ui->labelTopic->setText("");
143 ui->labelRobotModel->setText("");
144 ui->labelRNS->setText("");
145 updateSubconfig(kinematicUnitName.toStdString());
146}
Widget to conveniently retrieve a proxy instance name of a specific interface type (the template para...
void onInitComponent() override
Pure virtual hook for the subclass.
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
void updateSubconfig(std::string kinematicUnitName)
IceManagerPtr getIceManager() const
Returns the IceManager.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_LOG
Definition Logging.h:165
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.