AffordancePipelineGuiConfigDialog.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 VisionX
17* @author Peter Kaiser (peter dot kaiser at kit dot edu)
18* @date 2016
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
24
25#include <boost/algorithm/string.hpp>
26#include <boost/algorithm/string/split.hpp>
27
28#include <QMessageBox>
29#include <QPushButton>
30#include <QTimer>
31
32#include <IceUtil/UUID.h>
33
35
36#include <RobotAPI/interface/core/RobotState.h>
37
38#include <VisionX/interface/components/AffordanceExtraction.h>
39#include <VisionX/interface/components/AffordancePipelineVisualization.h>
40#include <VisionX/interface/components/PointCloudSegmenter.h>
41#include <VisionX/interface/components/PrimitiveMapper.h>
42#include <VisionX/interface/core/PointCloudProcessorInterface.h>
43#include <VisionX/interface/core/PointCloudProviderInterface.h>
44
45#include "ui_AffordancePipelineGuiConfigDialog.h"
46
47using namespace armarx;
48
50 QDialog(parent), ui(new Ui::AffordancePipelineGuiConfigDialog), uuid(IceUtil::generateUUID())
51{
52 ui->setupUi(this);
53
54 connect(this->ui->buttonBox, SIGNAL(accepted()), this, SLOT(verifyConfig()));
55 ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
56
57 pointCloudSegmenterProxyFinder =
59 primitiveExtractorProxyFinder = new IceProxyFinder<visionx::PrimitiveMapperInterfacePrx>(this);
60 affordanceExtractionProxyFinder = new IceProxyFinder<AffordanceExtractionInterfacePrx>(this);
61 pipelineVisualizationProxyFinder =
63 robotStateComponentProxyFinder = new IceProxyFinder<RobotStateComponentInterfacePrx>(this);
64
65 pointCloudSegmenterProxyFinder->setSearchMask("*");
66 primitiveExtractorProxyFinder->setSearchMask("*");
67 affordanceExtractionProxyFinder->setSearchMask("*");
68 pipelineVisualizationProxyFinder->setSearchMask("*");
69 robotStateComponentProxyFinder->setSearchMask("*");
70
71 ui->gridLayout->addWidget(pointCloudSegmenterProxyFinder, 3, 1, 1, 2);
72 ui->gridLayout->addWidget(primitiveExtractorProxyFinder, 4, 1, 1, 2);
73 ui->gridLayout->addWidget(affordanceExtractionProxyFinder, 5, 1, 1, 2);
74 ui->gridLayout->addWidget(pipelineVisualizationProxyFinder, 6, 1, 1, 2);
75 ui->gridLayout->addWidget(robotStateComponentProxyFinder, 7, 1, 1, 2);
76}
77
82
83void
85{
86 pointCloudSegmenterProxyFinder->setIceManager(getIceManager());
87 primitiveExtractorProxyFinder->setIceManager(getIceManager());
88 affordanceExtractionProxyFinder->setIceManager(getIceManager());
89 pipelineVisualizationProxyFinder->setIceManager(getIceManager());
90 robotStateComponentProxyFinder->setIceManager(getIceManager());
91}
92
93void
97
98void
100{
101 QObject::disconnect();
102}
103
104std::string
106{
107 return ui->lineEditPlatform->text().toStdString();
108}
109
110std::vector<std::string>
112{
113 std::vector<std::string> result;
114 std::string s = ui->lineEditProviderNames->text().toStdString();
115 boost::split(result, s, boost::is_any_of(","));
116 return result;
117}
118
119std::vector<std::string>
121{
122 std::vector<std::string> result;
123 std::string s = ui->lineEditProviderDisplayNames->text().toStdString();
124 boost::split(result, s, boost::is_any_of(","));
125 return result;
126}
127
128std::vector<std::string>
130{
131 std::vector<std::string> result;
132 std::string s = ui->lineEditFilteredProviderNames->text().toStdString();
133 boost::split(result, s, boost::is_any_of(","));
134 return result;
135}
136
137std::vector<std::string>
139{
140 std::vector<std::string> result;
141 std::string s = ui->lineEditConfigFiles->text().toStdString();
142 boost::split(result, s, boost::is_any_of(","));
143 return result;
144}
145
146void
148{
149 unsigned int l1 = pointCloudSegmenterProxyFinder->getSelectedProxyName().trimmed().length();
150 unsigned int l2 = primitiveExtractorProxyFinder->getSelectedProxyName().trimmed().length();
151 unsigned int l3 = affordanceExtractionProxyFinder->getSelectedProxyName().trimmed().length();
152 unsigned int l4 = pipelineVisualizationProxyFinder->getSelectedProxyName().trimmed().length();
153 unsigned int l5 = robotStateComponentProxyFinder->getSelectedProxyName().trimmed().length();
154
155 if (!l1 || !l2 || !l3 || !l4 || !l5)
156 {
157 QMessageBox::critical(this, "Invalid Configuration", "The proxy names must not be empty");
158 return;
159 }
160
161 if ((getProviderNames().size() != getProviderDisplayNames().size()) ||
162 (getProviderNames().size() != getFilteredProviderNames().size()))
163 {
164 QMessageBox::critical(
165 this, "Invalid Configuration", "The provider name lists must be of equal size");
166 return;
167 }
168
169 accept();
170}
void onInitComponent() override
Pure virtual hook for the subclass.
void onConnectComponent() override
Pure virtual hook for the subclass.
Widget to conveniently retrieve a proxy instance name of a specific interface type (the template para...
IceManagerPtr getIceManager() const
Returns the IceManager.
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.