PriorMemoryEditorPlugin.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 // Dialogs
27 #include <MemoryX/gui-plugins/PriorMemoryEditor/ui_PriorEditorConfigDialog.h>
29 #include "CollectionCreateDialog.h"
30 #include <MemoryX/gui-plugins/PriorMemoryEditor/ui_CollectionCreateDialog.h>
31 
32 // ArmarX core
34 #include <ArmarXCore/interface/core/Log.h>
37 
38 // Qt headers
39 #include <Qt>
40 #include <QtGlobal>
41 #include <QSpinBox>
42 #include <QSlider>
43 #include <QPushButton>
44 #include <QStringList>
45 #include <QTableView>
46 #include <QCheckBox>
47 #include <QBrush>
48 #include <QMessageBox>
49 #include <QStandardItemModel>
50 
51 // Coin3D headers
52 #include <Inventor/SoDB.h>
53 #include <Inventor/Qt/SoQt.h>
54 #include <Inventor/nodes/SoUnits.h>
55 
56 // System
57 #include <stdio.h>
58 #include <string>
59 #include <string.h>
60 #include <stdlib.h>
61 #include <iostream>
62 #include <math.h>
63 
64 // Boost
65 #include <filesystem>
66 
67 // Simox-VirtualRobot
68 #include <VirtualRobot/XML/RobotIO.h>
69 #include <VirtualRobot/XML/ObjectIO.h>
70 #include <VirtualRobot/ManipulationObject.h>
71 #include <VirtualRobot/Grasping/GraspSet.h>
72 #include <VirtualRobot/Grasping/Grasp.h>
73 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
74 
75 // MemoryX
81 
82 using namespace memoryx;
83 using namespace memoryx::EntityWrappers;
84 using namespace VirtualRobot;
85 
86 namespace fs = std::filesystem;
87 
88 #define DEFAULT_SETTINGS_PLUGIN_NAME "PriorMemoryEditorPlugin"
89 #define DEFAULT_SETTINGS_PRIORMEMORY_NAME "PriorKnowledge"
90 
91 namespace TreeItemType
92 {
94  {
95  eItemObject = QTreeWidgetItem::UserType + 1,
96  eItemAttr = QTreeWidgetItem::UserType + 2,
97  eItemValue = QTreeWidgetItem::UserType + 3
98  };
99 }
100 
102 {
103  addWidget<PriorEditorController>();
104 }
105 
106 
108  connected(false)
109 {
110  visu = nullptr;
111  show3DViewer = false;
112 
113  ui.setupUi(getWidget());
114  treeCurrentItemChanged(nullptr, nullptr);
115 
116  collCreateDialog = new CollectionCreateDialog();
117  collCreateDialog->setCollectionPrefix(memoryx::PRIOR_COLLECTION_PREFIX);
118  getWidget()->setEnabled(false);
119 }
120 
122 {
123  ARMARX_TRACE;
124  verbose = true;
125 
126  visu = new SoSeparator();
127  visu->ref();
128 
129  connectSlots();
130 
131  ARMARX_INFO << "PriorMemory: " << settings_priorMemory;
132 
133  usingProxy(settings_priorMemory);
134  usingProxy("CommonStorage");
135  if (!settings_robotStateComponentProxyName.empty())
136  {
137  usingProxy(settings_robotStateComponentProxyName);
138  }
139 }
140 
142 {
143  ARMARX_TRACE;
144  memoryPrx = getProxy<PriorKnowledgeInterfacePrx>(settings_priorMemory);
145  classesSegmentPrx = memoryPrx->getObjectClassesSegment();
146  databasePrx = memoryPrx->getCommonStorage();
147  if (!settings_robotStateComponentProxyName.empty())
148  {
149  getProxy(robotStateComponent, settings_robotStateComponentProxyName);
150  }
151 
152  fileManager.reset(new GridFileManager(databasePrx));
153 
154  ui.editHost->setText(QString::fromStdString(databasePrx->getMongoHostAndPort()));
155 
156  connected = databasePrx->isConnected();
157 
158  refreshControls();
159  refreshCollectionList();
160  setCurrentCollection(classesSegmentPrx->getWriteCollectionNS());
161  enableMainWidgetAsync(true);
162 }
163 
165 {
166  ARMARX_TRACE;
167  dialog->close();
168  collCreateDialog->close();
169  connected = false;
170  refreshControls();
171  enableMainWidgetAsync(false);
172 }
173 
175 {
176  ARMARX_TRACE;
177  clearObjects();
178 
179  if (visu)
180  {
181  visu->unref();
182  }
183 }
184 
185 QPointer<QDialog> PriorEditorController::getConfigDialog(QWidget* parent)
186 {
187  if (!dialog)
188  {
189  dialog = new PriorEditorConfigDialog(getIceManager(), parent);
190  dialog->ui->editPriorMemoryEditorName->setText(QString::fromStdString(DEFAULT_SETTINGS_PLUGIN_NAME));
191  dialog->ui->editPriorMemoryName->setText(QString::fromStdString(DEFAULT_SETTINGS_PRIORMEMORY_NAME));
192  }
193 
194  return qobject_cast<PriorEditorConfigDialog*>(dialog);
195 }
196 
198 {
199  ARMARX_VERBOSE << "PriorEditorController::configured()";
200  settings_mongoHost = dialog->ui->editMongoHost->text().toStdString();
201  settings_mongoUser = dialog->ui->editMongoUser->text().toStdString();
202  settings_mongoPass = dialog->ui->editMongoPass->text().toStdString();
203  settings_priorMemory = dialog->ui->editPriorMemoryName->text().toStdString();
204  this->setInstanceName(dialog->ui->editPriorMemoryEditorName->text());
205  settings_robotStateComponentProxyName = dialog->proxyFinder->getSelectedProxyName().toStdString();
206 
207  // ???
208  // databasePrx->reconnect(ui.editHost->text().toStdString(), settings_mongoUser, settings_mongoPass);
209 }
210 
211 
212 void PriorEditorController::loadSettings(QSettings* settings)
213 {
214  /*robotFile = settings->value("RobotFile", QString::fromStdString(robotFile_default)).toString().toStdString();
215  objectFile = settings->value("ObjectFile", QString::fromStdString(objectFile_default)).toString().toStdString();
216  show3DViewer = settings->value("ViewerEnabled", "false") == "true";*/
217 }
218 
219 void PriorEditorController::saveSettings(QSettings* settings)
220 {
221  /*settings->setValue("RobotFile", QString::fromStdString(robotFile));
222  settings->setValue("ObjectFile", QString::fromStdString(objectFile));
223  settings->setValue("ViewerEnabled", QString(show3DViewer?"true":"false"));*/
224 }
225 
226 
228 {
229  ARMARX_TRACE;
230  if (visu)
231  {
232  std::cout << "returning scene=" << visu->getName() << std::endl;
233  }
234 
235  return visu;
236 }
237 
239 {
240  ARMARX_TRACE;
241  connect(ui.btnReconnect, SIGNAL(clicked()), this, SLOT(reconnect()));
242 
243  connect(ui.btnAddCollection, SIGNAL(clicked()), this, SLOT(addCollection()));
244  connect(ui.btnRefetch, SIGNAL(clicked()), this, SLOT(refetchData()));
245 
246  connect(ui.cbCollection, SIGNAL(currentIndexChanged(int)),
247  this, SLOT(collectionChanged()), Qt::QueuedConnection);
248 
249  connect(ui.btnShowVisu, SIGNAL(clicked()), this, SLOT(showObjectClassVisu()));
250  connect(ui.btnShowColl, SIGNAL(clicked()), this, SLOT(showObjectClassColl()));
251  connect(ui.btnEdit, SIGNAL(clicked()), this, SLOT(editObjectClass()));
252  connect(ui.btnAdd, SIGNAL(clicked()), this, SLOT(addObjectClass()));
253  connect(ui.btnRemove, SIGNAL(clicked()), this, SLOT(removeObjectClass()));
254  connect(this, SIGNAL(objectsLoaded()), this, SLOT(clearVisualization()), Qt::QueuedConnection);
255  // connect(this, SIGNAL(objectChanged(QString, bool)), this, SLOT(updateObjectVisu(QString, bool)), Qt::QueuedConnection);
256 
257  connect(ui.treeWidgetEntities, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
258  this, SLOT(treeCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
259  connect(ui.treeWidgetEntities, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
260  this, SLOT(treeItemDoubleClicked(QTreeWidgetItem*, int)));
261 }
262 
264 {
265  ARMARX_TRACE;
266  clearObjects();
267  connected = databasePrx->reconnect(ui.editHost->text().toStdString(), settings_mongoUser, settings_mongoPass);
268  refreshControls();
269 
270  if (!connected)
271  {
272  QMessageBox msgBox;
273  msgBox.setText("Error connecting to MongoDB! \nCheck if mongod is running on " + ui.editHost->text());
274  msgBox.setIcon(QMessageBox::Critical);
275  msgBox.exec();
276  }
277 
278  refreshCollectionList();
279 }
280 
281 void PriorEditorController::setCurrentCollection(const std::string& collNS)
282 {
283  ARMARX_TRACE;
284  ui.cbCollection->setCurrentIndex(ui.cbCollection->findText(QString::fromStdString(collNS)));
285 }
286 
288 {
289  ARMARX_TRACE;
290  const std::string collName = ui.cbCollection->currentText().toStdString();
291 
292  if (!collName.empty())
293  {
294  CollectionInterfacePrx coll = databasePrx->requestCollection(collName);
295  classesSegmentPrx->setWriteCollection(coll);
296  refetchData();
297  }
298 }
299 
301 {
302  ARMARX_TRACE;
303  const NameList dbNames = databasePrx->getDBNames();
304  collCreateDialog->setDatabases(dbNames);
305  int result = collCreateDialog->exec();
306 
307  if (result == QDialog::Accepted)
308  {
309  const std::string collectionNS = collCreateDialog->getDBName() + "." + collCreateDialog->getCollectionName();
310  ui.cbCollection->addItem(QString::fromStdString(collectionNS));
311  setCurrentCollection(collectionNS);
312  }
313 }
314 
316 {
317  ARMARX_TRACE;
318  const std::string collName = ui.cbCollection->currentText().toStdString();
319  ARMARX_INFO << "Refetching data from DB from collection '" << collName << "'";
320  std::unique_lock lock(mutexEntities);
321  clearObjects();
322 
323  auto collection = databasePrx->requestCollection(collName);
324  auto ids = collection->findAllIds();
325  ARMARX_INFO << "Found " << ids.size() << " entities";
326 
327  // classesSegmentPrx->addReadCollection(collName);
328  for (const auto& id : ids)
329  {
330  EntityBasePtr entity = classesSegmentPrx->getEntityById(id);
331 
332  if (!entity)
333  {
334  ARMARX_WARNING << "Could not find entity with id " << id << " in collection " << collName;
335  }
336 
337  const ObjectClassPtr objClass = ObjectClassPtr::dynamicCast(entity);
338 
339  if (objClass)
340  {
341  updateObject(objClass);
342  }
343  else
344  {
345  ARMARX_WARNING << "Failed to cast to ObjectClass: " << entity->getName() << ", " << entity->getId() << ", " << entity->ice_id();
346  }
347  }
348 
349 
350  ui.treeWidgetEntities->sortByColumn(0, Qt::AscendingOrder);
351 
352  emit objectsLoaded();
353 }
354 
355 void PriorEditorController::refreshCollectionList()
356 {
357  ARMARX_TRACE;
358  ui.cbCollection->clear();
359 
360  if (!connected)
361  {
362  return;
363  }
364 
365  auto activeReadCollectionNames = memoryPrx->getObjectClassesSegment()->getReadCollectionsNS();
366  const NameList dbNames = databasePrx->getDBNames();
367  int firstActiveCollection = -1;
368 
369  for (std::string const& dbName : dbNames)
370  {
371  const NameList collNames = databasePrx->getCollectionNames(dbName);
372 
373  for (std::string const& collName : collNames)
374  {
375  std::string fullCollName = dbName + "." + collName;
376  if (memoryPrx->isPriorCollection(fullCollName))
377  {
378  if (std::find(activeReadCollectionNames.begin(), activeReadCollectionNames.end(), fullCollName) != activeReadCollectionNames.end())
379  {
380  ui.cbCollection->addItem(QString::fromStdString(fullCollName));
381 
382  if (firstActiveCollection == -1)
383  {
384  firstActiveCollection = ui.cbCollection->count() - 1;
385  }
386  }
387  else
388  {
389  ui.cbCollection->addItem(QString::fromStdString(collName + "(not selected in PriorKnowledge config)"));
390  const QStandardItemModel* model = qobject_cast<const QStandardItemModel*>(ui.cbCollection->model());
392  QStandardItem* item = model->item(model->rowCount() - 1);
394 
395  item->setFlags(item->flags() & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled)
396  );
397  // visually disable by greying out - works only if combobox has been painted already and palette returns the wanted color
398  item->setData(ui.cbCollection->palette().color(QPalette::Disabled, QPalette::Text)
399  , // clear item data in order to use default color
400  Qt::TextColorRole);
401  }
402  }
403  }
404  }
405 
406  if (ui.cbCollection->currentIndex() >= 0)
407  {
408  const QStandardItemModel* model = qobject_cast<const QStandardItemModel*>(ui.cbCollection->model());
410  QStandardItem* item = model->item(ui.cbCollection->currentIndex());
412 
413  if (!(item->flags() & Qt::ItemIsEnabled))
414  {
415  ui.cbCollection->setCurrentIndex(firstActiveCollection);
416  }
417  }
418  else
419  {
420  ui.cbCollection->setCurrentIndex(firstActiveCollection);
421  }
422 
423 }
424 
426 {
427  ARMARX_TRACE;
428  doEditClass(true);
429 }
430 
432 {
433  ARMARX_TRACE;
434  doEditClass(false);
435 }
436 
437 void PriorEditorController::doEditClass(bool isNew)
438 {
439  ARMARX_TRACE;
440  ARMARX_INFO << "Opening edit dialog...";
441 
442  // init object class
443  const std::string clsId = getSelectedClassId();
444  ObjectClassPtr objectClass;
445 
446  if (isNew)
447  {
448  objectClass = new ObjectClass();
449  objectClass->addWrapper(new SimoxObjectWrapper(fileManager));
450  objectClass->addWrapper(new ObjectRecognitionWrapper());
451  objectClass->addWrapper(new TexturedRecognitionWrapper(fileManager));
452  objectClass->addWrapper(new SegmentableRecognitionWrapper(fileManager));
453  objectClass->addWrapper(new HandMarkerBallWrapper(fileManager));
454  objectClass->addWrapper(new ArMarkerWrapper(fileManager));
455  }
456  else
457  {
458  objectClass = currentObjectClasses[clsId];
459  }
460 
461 
462  // create dialog
463  ObjectClassEditDialog* classEditDialog = new ObjectClassEditDialog(robotStateComponent);
464 
465  if (!isNew)
466  {
467  // do not allow changeing of existing classes names
468  classEditDialog->setClassNameEditable(false);
469  classEditDialog->updateGui(objectClass);
470  }
471 
472  int result = classEditDialog->exec();
473 
474  if (result == QDialog::Accepted)
475  {
476  ARMARX_INFO << "Saving changes to object class...";
478 
479  classEditDialog->updateEntity(objectClass, getFilesDBName());
480 
481  // update memory segment
482  if (isNew)
483  {
484  const std::string id = classesSegmentPrx->addEntity(objectClass);
485  objectClass->setId(id);
486  currentObjectClasses[id] = objectClass;
487  }
488  else
489  {
490  classesSegmentPrx->updateEntity(objectClass->getId(), objectClass);
491  }
492 
493  updateObjectInTree(objectClass);
494  classEditDialog->updateGui(objectClass);
495  }
496 
497  delete classEditDialog;
498 }
499 
501 {
502  ARMARX_TRACE;
503  const std::string clsName = getSelectedClassName();
504  const std::string clsId = getSelectedClassId();
505 
506  if (clsId.empty())
507  {
508  return;
509  }
510 
511  QMessageBox msgBox;
512  msgBox.setText("Delete object class " + QString(clsName.c_str()) + "?");
513  msgBox.setIcon(QMessageBox::Question);
514  msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
515  int ret = msgBox.exec();
516 
517  if (ret == QMessageBox::Yes)
518  {
519  ObjectEntryMap::iterator it = currentObjectClasses.find(clsId);
520 
521  if (it != currentObjectClasses.end())
522  {
523  it->second->getWrapper<SimoxObjectWrapper>()->clear();
524  currentObjectClasses.erase(it);
525  }
526 
527  classesSegmentPrx->removeEntity(clsId);
528  QTreeWidgetItem* selItem = ui.treeWidgetEntities->currentItem();
529 
530  if (selItem)
531  {
532  delete ui.treeWidgetEntities->takeTopLevelItem(ui.treeWidgetEntities->indexOfTopLevelItem(selItem));
533  }
534 
536  }
537 }
538 
539 std::string PriorEditorController::getSelectedClassId()
540 {
541  ARMARX_TRACE;
542  QTreeWidgetItem* selItem = ui.treeWidgetEntities->currentItem();
543 
544  if (selItem && selItem->type() == TreeItemType::eItemObject)
545  {
546  return selItem->text(1).toStdString();
547  }
548  else
549  {
550  return "";
551  }
552 }
553 
554 std::string PriorEditorController::getSelectedClassName()
555 {
556  ARMARX_TRACE;
557  QTreeWidgetItem* selItem = ui.treeWidgetEntities->currentItem();
558 
559  if (selItem && selItem->type() == TreeItemType::eItemObject)
560  {
561  return selItem->text(0).toStdString();
562  }
563  else
564  {
565  return "";
566  }
567 }
568 
569 void PriorEditorController::refreshControls()
570 {
571  ARMARX_TRACE;
572  ui.lblConnected->setText(QString::fromStdString(connected ? "Connected" : "Disconnected"));
573  ui.lblConnected->setStyleSheet(QString::fromStdString(connected ? "color: rgb(0, 170, 0);" : "color: rgb(170, 0, 0);"));
574 
575  ui.btnAddCollection->setEnabled(connected);
576  ui.btnRefetch->setEnabled(connected);
577 
578  QTreeWidgetItem* cur = ui.treeWidgetEntities->currentItem();
579  bool clsSelected = connected && (cur && cur->type() == TreeItemType::eItemObject);
580  ui.btnAdd->setEnabled(connected);
581  ui.btnEdit->setEnabled(clsSelected);
582  ui.btnRemove->setEnabled(clsSelected);
583  ui.btnShowVisu->setEnabled(clsSelected);
584  ui.btnShowColl->setEnabled(clsSelected);
585 }
586 
587 void PriorEditorController::treeCurrentItemChanged(QTreeWidgetItem* cur, QTreeWidgetItem* prev)
588 {
589  ARMARX_TRACE;
590  refreshControls();
591 }
592 
593 void PriorEditorController::treeItemDoubleClicked(QTreeWidgetItem* item, int column)
594 {
595  ARMARX_TRACE;
596  if (item->type() == TreeItemType::eItemObject)
597  {
598  ARMARX_INFO << " Selected object: " << item->text(1).toStdString();
599  showObjectClassModel(item->text(1).toStdString(), SceneObject::Full);
600  }
601 }
602 
603 std::string PriorEditorController::getFilesDBName()
604 {
605  ARMARX_TRACE;
606  const std::string ns = classesSegmentPrx->getWriteCollectionNS();
607  const size_t found = ns.find_first_of('.');
608  return (found != std::string::npos) ? ns.substr(0, found) : "";
609 }
610 
611 void PriorEditorController::updateObjectInTree(ObjectClassPtr obj)
612 {
613  ARMARX_TRACE;
614  QString objName(obj->getName().c_str());
615  QString objId(obj->getId().c_str());
616 
617  QList<QTreeWidgetItem*> oldItems = ui.treeWidgetEntities->findItems(objId, Qt::MatchFixedString, 1);
618 
619  QTreeWidgetItem* objItem = (oldItems.size() == 0) ?
620  new QTreeWidgetItem(ui.treeWidgetEntities, TreeItemType::eItemObject) : oldItems.at(0);
621  objItem->setText(0, objName);
622  objItem->setText(1, objId);
623 
624  // clear object node
625  /* QList<QTreeWidgetItem *> oldAttrs = objItem->takeChildren();
626  while(!oldAttrs.empty())
627  delete oldAttrs.takeFirst();
628 
629  QBrush evenRow(QColor(217, 255, 226)), oddRow(Qt::white);
630  int i = 0;
631  memoryx::NameList attrNames = obj->getAttributeNames();
632  for (memoryx::NameList::const_iterator it = attrNames.begin(); it != attrNames.end(); ++it)
633  {
634  // QList<QTreeWidgetItem *> oldAttrs = objItem->findItems(objId, Qt::MatchFixedString, 0);
635  QTreeWidgetItem *attrItem = new QTreeWidgetItem(objItem, TreeItemType::eItemAttr);
636  armarx::VariantPtr attrValue = obj->getAttributeMean(*it);
637  QString attrName(it->c_str());
638  QString attrValStr(attrValue->getOutputValueOnly().c_str());
639  QBrush& bgBrush = (i % 2 == 0) ? evenRow : oddRow;
640  attrItem->setText(0, attrName);
641  attrItem->setText(1, attrValStr);
642  attrItem->setBackground(0, bgBrush);
643  attrItem->setBackground(1, bgBrush);
644  ++i;
645  }*/
646 }
647 
649 {
650  ARMARX_TRACE;
651  if (!objClass)
652  {
653  return;
654  }
655 
656  std::unique_lock lock(mutexEntities);
657 
658  const std::string id = objClass->getId();
659 
660  if (force || currentObjectClasses.find(id) == currentObjectClasses.end())
661  {
662  // build new entry
663  ARMARX_INFO << "Building new entry for object class " << objClass->getName();
664  objClass->addWrapper(new SimoxObjectWrapper(fileManager));
665  objClass->addWrapper(new ObjectRecognitionWrapper());
666  objClass->addWrapper(new TexturedRecognitionWrapper(fileManager));
667  objClass->addWrapper(new SegmentableRecognitionWrapper(fileManager));
668  objClass->addWrapper(new HandMarkerBallWrapper(fileManager));
669  objClass->addWrapper(new ArMarkerWrapper(fileManager));
670 
671  currentObjectClasses[id] = objClass;
672  }
673 
674  updateObjectInTree(objClass);
675 }
676 
677 void PriorEditorController::showObjectClassModel(const std::string& objectId, SceneObject::VisualizationType visuType)
678 {
679  ARMARX_TRACE;
680  std::unique_lock lock(mutexEntities);
681  ObjectEntryMap::iterator it = currentObjectClasses.find(objectId);
682 
683  if (it == currentObjectClasses.end())
684  {
685  ARMARX_TRACE;
686  return;
687  }
688 
689  // no rotation/translation
691  SimoxObjectWrapperPtr simoxWrapper = it->second->getWrapper<SimoxObjectWrapper>();
692 
693  ARMARX_TRACE;
694  auto mo = simoxWrapper->getManipulationObject();
695 
696  ARMARX_TRACE;
697  mo->setGlobalPose(m);
698  mo->showCoordinateSystem(true);
699 
701  VisualizationNodePtr visNode;
702 
703  if (visuType == SceneObject::Full)
704  {
705  ARMARX_TRACE;
706  visNode = simoxWrapper->getVisualization();
707  }
708  else if (visuType == SceneObject::Collision && simoxWrapper->getCollisionModel())
709  {
710  ARMARX_TRACE;
711  visNode = simoxWrapper->getCollisionModel()->getVisualization();
712  }
713 
714  if (visu && visNode)
715  {
716  ARMARX_TRACE;
717  visu->addChild(VirtualRobot::CoinVisualizationFactory::getCoinVisualization(visNode));
718  }
719 }
720 
722 {
723  ARMARX_TRACE;
724  showObjectClassModel(getSelectedClassId(), SceneObject::Full);
725 }
726 
728 {
729  ARMARX_TRACE;
730  showObjectClassModel(getSelectedClassId(), SceneObject::Collision);
731 }
732 
734 {
735  ARMARX_TRACE;
736  std::unique_lock lock(mutexEntities);
737 
738  // clear storage
739  currentObjectClasses.clear();
740 
741  // clear SceneTree
742  ui.treeWidgetEntities->clear();
743 }
744 
746 {
747  ARMARX_TRACE;
748  visu->removeAllChildren();
749 }
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::ManagedIceObject::getIceManager
IceManagerPtr getIceManager() const
Returns the IceManager.
Definition: ManagedIceObject.cpp:353
TreeItemType::TreeItemTypeEnum
TreeItemTypeEnum
Definition: PriorMemoryEditorPlugin.cpp:93
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
memoryx::CollectionCreateDialog
Definition: CollectionCreateDialog.h:37
TreeItemType::eItemObject
@ eItemObject
Definition: PriorMemoryEditorPlugin.cpp:95
memoryx::PriorEditorController::updateObject
void updateObject(const memoryx::ObjectClassPtr obj, bool force=false)
Definition: PriorMemoryEditorPlugin.cpp:648
memoryx::PriorEditorController::addCollection
void addCollection()
Definition: PriorMemoryEditorPlugin.cpp:300
VirtualRobot
Definition: FramedPose.h:43
memoryx::PriorEditorController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: PriorMemoryEditorPlugin.cpp:141
memoryx::PriorEditorController::show3DViewer
bool show3DViewer
Definition: PriorMemoryEditorPlugin.h:192
string.h
memoryx::PriorEditorController::visu
SoSeparator * visu
Definition: PriorMemoryEditorPlugin.h:194
Pose.h
memoryx::PriorEditorController::showObjectClassColl
void showObjectClassColl()
Definition: PriorMemoryEditorPlugin.cpp:727
TreeItemType::eItemAttr
@ eItemAttr
Definition: PriorMemoryEditorPlugin.cpp:96
memoryx::PriorEditorController::reconnect
void reconnect()
Definition: PriorMemoryEditorPlugin.cpp:263
trace.h
memoryx::PriorEditorController::addObjectClass
void addObjectClass()
Definition: PriorMemoryEditorPlugin.cpp:425
GridFileManager.h
memoryx::ObjectClassEditDialog
Definition: ObjectClassEditDialog.h:45
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::PriorEditorController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: PriorMemoryEditorPlugin.cpp:197
ObjectRecognitionWrapper.h
memoryx::PriorEditorController::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: PriorMemoryEditorPlugin.cpp:174
memoryx::PriorEditorController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: PriorMemoryEditorPlugin.cpp:219
memoryx::PriorEditorController::clearVisualization
void clearVisualization()
Definition: PriorMemoryEditorPlugin.cpp:745
memoryx::EntityWrappers::SegmentableRecognitionWrapper
SegmentableRecognitionWrapper offers a simplified access to the data of an object class or instance r...
Definition: ObjectRecognitionWrapper.h:89
memoryx::PriorEditorController::PriorEditorController
PriorEditorController()
Definition: PriorMemoryEditorPlugin.cpp:107
memoryx::PriorEditorController::collectionChanged
void collectionChanged()
Definition: PriorMemoryEditorPlugin.cpp:287
memoryx::PriorEditorController::connectSlots
void connectSlots()
Definition: PriorMemoryEditorPlugin.cpp:238
IceInternal::Handle< ObjectClass >
memoryx::ObjectClassEditDialog::updateGui
void updateGui(const EntityPtr &entity) override
Pure virtual method.
Definition: ObjectClassEditDialog.cpp:65
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
memoryx::PriorEditorController::currentObjectClasses
ObjectEntryMap currentObjectClasses
Definition: PriorMemoryEditorPlugin.h:191
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
memoryx::PriorEditorController::treeItemDoubleClicked
void treeItemDoubleClicked(QTreeWidgetItem *item, int column)
Definition: PriorMemoryEditorPlugin.cpp:593
memoryx::PriorEditorController::verbose
bool verbose
Definition: PriorMemoryEditorPlugin.h:188
CollectionCreateDialog.h
memoryx::ObjectClassEditDialog::setClassNameEditable
void setClassNameEditable(bool editable)
Definition: ObjectClassEditDialog.cpp:60
memoryx::PriorEditorController::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: PriorMemoryEditorPlugin.cpp:121
memoryx::PriorEditorController::objectsLoaded
void objectsLoaded()
memoryx::EntityWrappers::TexturedRecognitionWrapper
TexturedRecognitionWrapper offers a simplified access to the data of an object class or instance rela...
Definition: ObjectRecognitionWrapper.h:66
ObjectClassEditDialog.h
PriorEditorConfigDialog.h
MemoryXCoreObjectFactories.h
memoryx::PriorEditorController::ui
Ui::PriorMemoryEditorPlugin ui
Definition: PriorMemoryEditorPlugin.h:186
memoryx::ObjectClass
Definition: ObjectClass.h:37
memoryx::PriorEditorController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: PriorMemoryEditorPlugin.cpp:212
memoryx::PriorEditorController::treeCurrentItemChanged
void treeCurrentItemChanged(QTreeWidgetItem *cur, QTreeWidgetItem *prev)
Definition: PriorMemoryEditorPlugin.cpp:587
memoryx::EntityWrappers::SimoxObjectWrapper
SimoxObjectWrapper offers a simplified access to the Simox ManipulationObject (i.e visualization,...
Definition: SimoxObjectWrapper.h:46
armarx::ArmarXWidgetController::setInstanceName
bool setInstanceName(QString instanceName)
sets the name of this instance.
Definition: ArmarXWidgetController.cpp:99
memoryx::PriorEditorController::editObjectClass
void editObjectClass()
Definition: PriorMemoryEditorPlugin.cpp:431
TreeItemType::eItemValue
@ eItemValue
Definition: PriorMemoryEditorPlugin.cpp:97
memoryx::PriorEditorConfigDialog
Definition: PriorEditorConfigDialog.h:40
SimoxObjectWrapper.h
No
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics No
Definition: ReadMe.txt:21
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
memoryx::EntityWrappers
Definition: AbstractEntityWrapper.cpp:28
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::ArmarXWidgetController::enableMainWidgetAsync
void enableMainWidgetAsync(bool enable)
This function enables/disables the main widget asynchronously (if called from a non qt thread).
Definition: ArmarXWidgetController.cpp:174
memoryx::PriorEditorController::getScene
SoNode * getScene() override
Reimplementing this function and returning a SoNode* will show this SoNode in the 3DViewerWidget,...
Definition: PriorMemoryEditorPlugin.cpp:227
DEFAULT_SETTINGS_PLUGIN_NAME
#define DEFAULT_SETTINGS_PLUGIN_NAME
Definition: PriorMemoryEditorPlugin.cpp:88
memoryx::EntityWrappers::ObjectRecognitionWrapper
Definition: ObjectRecognitionWrapper.h:40
memoryx::GridFileManager
GridFileManager provides utility functions for working with files in Mongo GridFS and links to them s...
Definition: GridFileManager.h:42
memoryx::PriorEditorController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: PriorMemoryEditorPlugin.cpp:164
MemoryXTypesObjectFactories.h
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
memoryx::ObjectClassEditDialog::updateEntity
void updateEntity(const EntityPtr &entity, std::string filesDBName) override
Pure virtual method.
Definition: ObjectClassEditDialog.cpp:83
memoryx::PriorEditorController::removeObjectClass
void removeObjectClass()
Definition: PriorMemoryEditorPlugin.cpp:500
PriorMemoryEditorPlugin.h
memoryx::EntityWrappers::ArMarkerWrapper
ArMarkerWrapper offers a simplified access to the necessary information for localization of AR marker...
Definition: ObjectRecognitionWrapper.h:139
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
DEFAULT_SETTINGS_PRIORMEMORY_NAME
#define DEFAULT_SETTINGS_PRIORMEMORY_NAME
Definition: PriorMemoryEditorPlugin.cpp:89
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:393
ArmarXDataPath.h
memoryx::PriorEditorController::refetchData
void refetchData()
Definition: PriorMemoryEditorPlugin.cpp:315
memoryx::PriorEditorController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: PriorMemoryEditorPlugin.cpp:185
TreeItemType
Definition: PriorMemoryEditorPlugin.cpp:91
memoryx::PriorMemoryEditorPlugin::PriorMemoryEditorPlugin
PriorMemoryEditorPlugin()
Definition: PriorMemoryEditorPlugin.cpp:101
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:151
memoryx::PriorEditorController::showObjectClassVisu
void showObjectClassVisu()
Definition: PriorMemoryEditorPlugin.cpp:721
memoryx::PriorEditorController::clearObjects
void clearObjects()
Definition: PriorMemoryEditorPlugin.cpp:733
memoryx::EntityWrappers::HandMarkerBallWrapper
HandMarkerBallWrapper offers a simplified access to the necessary information for localization of the...
Definition: ObjectRecognitionWrapper.h:116
GfxTL::Yes
OnOff< true > Yes
Definition: OnOff.h:12