26 #include <QCoreApplication>
27 #include <VirtualRobot/XML/RobotIO.h>
33 #include <RobotAPI/interface/core/RobotState.h>
60 QMetaObject::invokeMethod(
this,
"initWidget");
66 QMetaObject::invokeMethod(
this,
"connectWidget");
71 viewControllerPtr.reset();
72 toolBarControllerPtr.reset();
73 widget.robotVisualization->~QWidget();
74 this->robotVisualizationControllerPtr.reset();
75 mementoControllerPtr.reset();
76 settingControllerPtr.reset();
77 shortcutControllerPtr.reset();
78 tcpInformationControllerPtr.reset();
79 tcpSelectionControllerPtr.reset();
80 trajectoryControllerPtr.reset();
81 transitionControllerPtr.reset();
82 waypointControllerPtr.reset();
83 exportDialogControllerPtr.reset();
84 importDialogControllerPtr.reset();
85 robotVisualizationControllerPtr.reset();
86 environmentControllerPtr.reset();
94 this->exportDialogControllerPtr = std::make_shared<ExportDialogController>();
95 this->importDialogControllerPtr = std::make_shared<ImportDialogController>();
96 this->mementoControllerPtr = std::make_shared<MementoController>(
97 widget.undoButton, widget.redoButton);
98 this->robotVisualizationControllerPtr = std::make_shared<RobotVisualizationController>(widget.robotVisualization);
99 this->robotVisualizationControllerPtr->addConnection(this->robotVisualizationControllerPtr);
102 this->settingControllerPtr = std::make_shared<SettingController>(settingTabPtr);
103 this->shortcutControllerPtr = std::make_shared<ShortcutController>(
getWidget().
data());
105 this->tcpInformationControllerPtr = std::make_shared<TCPInformationController>(
107 this->tcpSelectionControllerPtr = std::make_shared<TCPSelectionController>(
108 widget.currentTPComboBox);
111 this->toolBarControllerPtr = std::make_shared<ToolBarController>(toolBarPtr);
112 widget.toolBar->raise();
113 this->trajectoryControllerPtr = std::make_shared<TrajectoryController>();
116 this->transitionControllerPtr = std::make_shared<TransitionController>(
119 this->viewControllerPtr = std::make_shared<ViewController>(perspectivesPtr);
120 widget.perspectives->raise();
123 this->waypointControllerPtr = std::make_shared<WaypointController>(waypointTabPtr);
124 this->environmentControllerPtr = std::make_shared<EnvironmentController>();
132 QObject::connect(environmentControllerPtr.get(), SIGNAL(environmentChanged(
EnvironmentPtr)),
133 exportDialogControllerPtr.get(), SLOT(environmentChanged(
EnvironmentPtr)));
134 QObject::connect(environmentControllerPtr.get(), SIGNAL(environmentChanged(
EnvironmentPtr)),
135 importDialogControllerPtr.get(), SLOT(environmentChanged(
EnvironmentPtr)));
136 QObject::connect(environmentControllerPtr.get(), SIGNAL(environmentChanged(
EnvironmentPtr)),
137 robotVisualizationControllerPtr.get(), SLOT(environmentChanged(
EnvironmentPtr)));
138 QObject::connect(environmentControllerPtr.get(), SIGNAL(environmentChanged(
EnvironmentPtr)),
139 trajectoryControllerPtr.get(), SLOT(environmentChanged(
EnvironmentPtr)));
140 QObject::connect(environmentControllerPtr.get(), SIGNAL(environmentChanged(
EnvironmentPtr)),
141 settingControllerPtr.get(), SLOT(environmentChanged(
EnvironmentPtr)));
146 QObject::connect(exportDialogControllerPtr.get(), SIGNAL(exportDesignerTrajectory(
int)),
147 trajectoryControllerPtr.get(), SLOT(exportTrajectory(
int)));
148 QObject::connect(exportDialogControllerPtr.get(), SIGNAL(exportDesignerTrajectory()),
149 trajectoryControllerPtr.get(), SLOT(exportTrajectory()));
160 QObject::connect(mementoControllerPtr.get(), SIGNAL(undo()), trajectoryControllerPtr.get(), SLOT(undo()));
161 QObject::connect(mementoControllerPtr.get(), SIGNAL(redo()), trajectoryControllerPtr.get(), SLOT(redo()));
165 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(manipulatorChanged(
Eigen::Matrix4f)),
166 tcpInformationControllerPtr.get(), SLOT(setDesiredPose(
Eigen::Matrix4f)));
167 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(tcpPoseChanged(
Eigen::Matrix4f)),
168 tcpInformationControllerPtr.get(), SLOT(setCurrentPose(
Eigen::Matrix4f)));
169 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(poseReachable(
bool)),
170 tcpInformationControllerPtr.get(), SLOT(setReachable(
bool)));
172 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(wayPointSelected(
int)),
173 waypointControllerPtr.get(), SLOT(updateSelectedWaypoint(
int)));
175 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
176 waypointControllerPtr.get(), SLOT(enableDeleteButton(
bool)));
177 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
178 waypointControllerPtr.get(), SLOT(enableAddButton(
bool)));
179 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
180 waypointControllerPtr.get(), SLOT(enableWaypointListLineEdit(
bool)));
182 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
183 waypointControllerPtr.get(), SLOT(enableAddButton(
bool)));
185 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
186 toolBarControllerPtr.get(), SLOT(enableAddButton(
bool)));
187 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
188 toolBarControllerPtr.get(), SLOT(enableDeleteChangeButton(
bool)));
189 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
190 toolBarControllerPtr.get(), SLOT(enablePreviewAllButton(
bool)));
191 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
192 toolBarControllerPtr.get(), SLOT(enablePreviewButton(
bool)));
193 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerPlaying(
bool)),
194 toolBarControllerPtr.get(), SLOT(enableStopButton(
bool)));
196 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
197 settingControllerPtr.get(), SLOT(enableSelectRobotButton(
bool)));
198 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
199 settingControllerPtr.get(), SLOT(enableExportButtons(
bool)));
200 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
201 settingControllerPtr.get(), SLOT(enableImportTCPCollision(
bool)));
203 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
204 mementoControllerPtr.get(), SLOT(enableRedoButtonVisualization(
bool)));
205 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
206 mementoControllerPtr.get(), SLOT(enableUndoButton(
bool)));
208 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
209 shortcutControllerPtr.get(), SLOT(enableAddShortcut(
bool)));
210 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
211 shortcutControllerPtr.get(), SLOT(enableDeleteChangeShortcut(
bool)));
212 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
213 shortcutControllerPtr.get(), SLOT(enablePreviewAllShortcut(
bool)));
214 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
215 shortcutControllerPtr.get(), SLOT(enablePreviewShortcut(
bool)));
216 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
217 shortcutControllerPtr.get(), SLOT(enableRedoShortcut(
bool)));
218 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
219 shortcutControllerPtr.get(), SLOT(enableUndoShortcut(
bool)));
220 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerPlaying(
bool)),
221 shortcutControllerPtr.get(), SLOT(enableStopPreviewShortcut(
bool)));
223 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
224 tcpSelectionControllerPtr.get(), SLOT(enableSelectedTCP(
bool)));
226 QObject::connect(robotVisualizationControllerPtr.get(), SIGNAL(trajectoryPlayerNotPlaying(
bool)),
227 transitionControllerPtr.get(), SLOT(enableAll(
bool)));
232 QObject::connect(settingControllerPtr.get(), SIGNAL(changedTCP(QString)),
233 trajectoryControllerPtr.get(), SLOT(updateTCP(QString)));
234 QObject::connect(settingControllerPtr.get(), SIGNAL(setActiveColModelName(QString)),
235 trajectoryControllerPtr.get(), SLOT(setActiveColModelName(QString)));
236 QObject::connect(settingControllerPtr.get(), SIGNAL(setBodyColModelsNames(QStringList)),
237 trajectoryControllerPtr.get(), SLOT(setBodyColModelsNames(QStringList)));
239 QObject::connect(settingControllerPtr.get(), SIGNAL(openRobotSelection()),
240 environmentControllerPtr.get(), SLOT(openRobotFileDialog()));
242 QObject::connect(settingControllerPtr.get(), SIGNAL(openShortcut()),
243 shortcutControllerPtr.get(), SLOT(open()));
245 QObject::connect(settingControllerPtr.get(), SIGNAL(convertToMMM()),
246 exportDialogControllerPtr.get(), SLOT(exportMMM()));
248 QObject::connect(settingControllerPtr.get(), SIGNAL(openImport()),
249 importDialogControllerPtr.get(), SLOT(open()));
254 QObject::connect(shortcutControllerPtr.get(), SIGNAL(addedWaypoint(
int,
bool)),
255 trajectoryControllerPtr.get(), SLOT(addWaypoint(
int,
bool)));
256 QObject::connect(shortcutControllerPtr.get(), SIGNAL(deletedWaypoint(
int)),
257 trajectoryControllerPtr.get(), SLOT(deleteWaypoint(
int)));
258 QObject::connect(shortcutControllerPtr.get(), SIGNAL(changeWaypoint(
int)),
259 trajectoryControllerPtr.get(), SLOT(updateWaypoint(
int)));
260 QObject::connect(shortcutControllerPtr.get(), SIGNAL(undo()),
261 trajectoryControllerPtr.get(), SLOT(undo()));
262 QObject::connect(shortcutControllerPtr.get(), SIGNAL(redo()),
263 trajectoryControllerPtr.get(), SLOT(redo()));
264 QObject::connect(shortcutControllerPtr.get(), SIGNAL(playPreviewAllSignal()),
265 trajectoryControllerPtr.get(), SLOT(playTrajectories()));
267 QObject::connect(shortcutControllerPtr.get(), SIGNAL(playPreviewSignal()),
268 robotVisualizationControllerPtr.get(), SLOT(playTrajectory()));
269 QObject::connect(shortcutControllerPtr.get(), SIGNAL(changedPerspective(
int)),
270 robotVisualizationControllerPtr.get(), SLOT(setCamera(
int)));
272 QObject::connect(shortcutControllerPtr.get(), SIGNAL(addedWaypointPressed(
bool)),
273 robotVisualizationControllerPtr.get(), SLOT(enableLeftMouse(
bool)));
274 QObject::connect(shortcutControllerPtr.get(), SIGNAL(stopPreviewSignal()),
275 robotVisualizationControllerPtr.get(), SLOT(trajectoryPlayerStopped()));
280 QObject::connect(tcpSelectionControllerPtr.get(), SIGNAL(changedSelectedTCP(QString)),
281 trajectoryControllerPtr.get(), SLOT(updateTCP(QString)));
282 QObject::connect(tcpSelectionControllerPtr.get(), SIGNAL(changedSelectedTCP(QString)),
283 settingControllerPtr.get(), SLOT(selectTCP(QString)));
289 QObject::connect(toolBarControllerPtr.get(), SIGNAL(addedWaypoint(
int,
bool)),
290 trajectoryControllerPtr.get(), SLOT(addWaypoint(
int,
bool)));
291 QObject::connect(toolBarControllerPtr.get(), SIGNAL(deletedWaypoint(
int)),
292 trajectoryControllerPtr.get(), SLOT(deleteWaypoint(
int)));
293 QObject::connect(toolBarControllerPtr.get(), SIGNAL(changeWaypoint(
int)),
294 trajectoryControllerPtr.get(), SLOT(updateWaypoint(
int)));
296 QObject::connect(toolBarControllerPtr.get(), SIGNAL(notifyAllPreview()),
297 trajectoryControllerPtr.get(), SLOT(playTrajectories()));
299 QObject::connect(toolBarControllerPtr.get(), SIGNAL(notifyPreview()),
300 robotVisualizationControllerPtr.get(), SLOT(playTrajectory()));
301 QObject::connect(toolBarControllerPtr.get(), SIGNAL(notifyStopPreview()),
302 robotVisualizationControllerPtr.get(), SLOT(trajectoryPlayerStopped()));
307 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(addWaypointGui(
int, std::vector<double>,
int,
bool)),
308 waypointControllerPtr.get(), SLOT(addWaypoint(
int, std::vector<double>,
int,
bool)));
309 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(changeWaypointGui(
int, std::vector<double>,
int,
bool)),
310 waypointControllerPtr.get(), SLOT(setWaypointData(
int, std::vector<double>,
int,
bool)));
311 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeWaypointGui(
int)),
312 waypointControllerPtr.get(), SLOT(removeWaypoint(
int)));
313 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeTransitionWaypointGui()),
314 waypointControllerPtr.get(), SLOT(clearWaypointList()));
315 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableDeleteChange(
bool)),
316 waypointControllerPtr.get(), SLOT(enableDeleteButton(
bool)));
317 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableAdd(
bool)),
318 waypointControllerPtr.get(), SLOT(enableAddButton(
bool)));
320 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(addTransitionGui(
int,
double,
double,
int)),
321 transitionControllerPtr.get(), SLOT(addTransition(
int,
double,
double,
int)));
322 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(changeTransitionGui(
int,
double,
double,
int)),
323 transitionControllerPtr.get(), SLOT(setTransitionData(
int,
double,
double,
int)));
324 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeTransitionGui(
int)),
325 transitionControllerPtr.get(), SLOT(removeTransition(
int)));
326 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeTransitionWaypointGui()),
327 transitionControllerPtr.get(), SLOT(clearTransitionList()));
329 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(newTrajectory(QString)),
330 tcpSelectionControllerPtr.get(), SLOT(addTrajectory(QString)));
331 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(updateSelectedTCP(QString)),
332 tcpSelectionControllerPtr.get(), SLOT(updateSelectedTCP(QString)));
333 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeTrajectory(QString)),
334 tcpSelectionControllerPtr.get(), SLOT(removeTrajectory(QString)));
335 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeAllTrajectories()),
336 tcpSelectionControllerPtr.get(), SLOT(removeAllTrajectories()));
338 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(updateSelectedTCP(QString)),
339 settingControllerPtr.get(), SLOT(selectTCP(QString)));
340 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableIKSolutionButton(
bool)),
341 settingControllerPtr.get(), SLOT(enableIKSolutionButton(
bool)));
342 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableExportButtons(
bool)),
343 settingControllerPtr.get(), SLOT(enableExportButtons(
bool)));
345 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableRedo(
bool)),
346 mementoControllerPtr.get(), SLOT(enableRedoButton(
bool)));
347 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableUndo(
bool)),
348 mementoControllerPtr.get(), SLOT(enableUndoButton(
bool)));
350 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(exportTrajectory(std::vector<DesignerTrajectoryPtr>)),
351 exportDialogControllerPtr.get(), SLOT(exportTrajectory(std::vector<DesignerTrajectoryPtr>)));
355 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(removeTransitionWaypointGui()),
356 robotVisualizationControllerPtr.get(), SLOT(clearView()));
359 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(playTrajectories(std::vector<DesignerTrajectoryPtr>)),
360 robotVisualizationControllerPtr.get(), SLOT(playTrajectories(std::vector<DesignerTrajectoryPtr>)));
361 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(rnsChanged(VirtualRobot::RobotNodeSetPtr)),
362 robotVisualizationControllerPtr.get(), SLOT(kinematicChainChanged(VirtualRobot::RobotNodeSetPtr)));
364 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableDeleteChange(
bool)),
365 toolBarControllerPtr.get(), SLOT(enableDeleteChangeButton(
bool)));
366 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableAdd(
bool)),
367 toolBarControllerPtr.get(), SLOT(enableAddButton(
bool)));
368 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enablePreview(
bool)),
369 toolBarControllerPtr.get(), SLOT(enablePreviewButton(
bool)));
370 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enablePreviewAll(
bool)),
371 toolBarControllerPtr.get(), SLOT(enablePreviewAllButton(
bool)));
373 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableDeleteChange(
bool)),
374 shortcutControllerPtr.get(), SLOT(enableDeleteChangeShortcut(
bool)));
375 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableAdd(
bool)),
376 shortcutControllerPtr.get(), SLOT(enableAddShortcut(
bool)));
377 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enablePreview(
bool)),
378 shortcutControllerPtr.get(), SLOT(enablePreviewShortcut(
bool)));
379 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enablePreviewAll(
bool)),
380 shortcutControllerPtr.get(), SLOT(enablePreviewAllShortcut(
bool)));
381 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableRedo(
bool)),
382 shortcutControllerPtr.get(), SLOT(enableRedoShortcut(
bool)));
383 QObject::connect(trajectoryControllerPtr.get(), SIGNAL(enableUndo(
bool)),
384 shortcutControllerPtr.get(), SLOT(enableUnoShortcut(
bool)));
389 QObject::connect(transitionControllerPtr.get(), SIGNAL(changedDuration(
int,
double)),
390 trajectoryControllerPtr.get(), SLOT(updateTransition(
int,
double)));
391 QObject::connect(transitionControllerPtr.get(), SIGNAL(changedInterpolation(
int,
int)),
392 trajectoryControllerPtr.get(), SLOT(updateTransition(
int,
int)));
394 QObject::connect(transitionControllerPtr.get(), SIGNAL(selectedTransitionChanged(
int)),
395 robotVisualizationControllerPtr.get(), SLOT(selectedTransitionChanged(
int)));
400 QObject::connect(viewControllerPtr.get(), SIGNAL(changedPerspective(
int)),
401 robotVisualizationControllerPtr.get(), SLOT(setCamera(
int)));
402 QObject::connect(viewControllerPtr.get(), SIGNAL(addView()),
403 robotVisualizationControllerPtr.get(), SLOT(addView()));
404 QObject::connect(viewControllerPtr.get(), SIGNAL(removeView()),
405 robotVisualizationControllerPtr.get(), SLOT(removeView()));
411 QObject::connect(waypointControllerPtr.get(), SIGNAL(changedWaypoint(
int, std::vector<double>)),
412 trajectoryControllerPtr.get(), SLOT(updateWaypoint(
int, std::vector<double>)));
413 QObject::connect(waypointControllerPtr.get(), SIGNAL(changedWaypoint(
int,
int)),
414 trajectoryControllerPtr.get(), SLOT(updateWaypoint(
int,
int)));
415 QObject::connect(waypointControllerPtr.get(), SIGNAL(changedWaypoint(
int,
bool)),
416 trajectoryControllerPtr.get(), SLOT(updateWaypoint(
int,
bool)));
417 QObject::connect(waypointControllerPtr.get(), SIGNAL(addedWaypoint(
int,
bool)),
418 trajectoryControllerPtr.get(), SLOT(addWaypoint(
int,
bool)));
419 QObject::connect(waypointControllerPtr.get(), SIGNAL(deletedWaypoint(
int)),
420 trajectoryControllerPtr.get(), SLOT(deleteWaypoint(
int)));
421 QObject::connect(waypointControllerPtr.get(), SIGNAL(enableIKSolutionButton(
bool)),
422 settingControllerPtr.get(), SLOT(enableIKSolutionButton(
bool)));
423 QObject::connect(waypointControllerPtr.get(), SIGNAL(setCurrentIndex(
int)),
424 toolBarControllerPtr.get(), SLOT(setCurrentWaypoint(
int)));
425 QObject::connect(waypointControllerPtr.get(), SIGNAL(setCurrentIndex(
int)),
426 shortcutControllerPtr.get(), SLOT(setCurrentWaypoint(
int)));
428 QObject::connect(waypointControllerPtr.get(), SIGNAL(setCurrentIndexRobotVisualization(
int)),
429 robotVisualizationControllerPtr.get(), SLOT(selectedWayPointChanged(
int)));
434 if (robotStateComponent)
436 environmentControllerPtr->loadRobotFromProxy(robotStateComponent->getRobotFilename());
441 environmentControllerPtr->loadArmar3();