Go to the documentation of this file.
27 #include <MemoryX/gui-plugins/WorkingMemoryGui/ui_WorkingMemoryGuiPlugin.h>
38 #include <MemoryX/interface/workingmemory/AbstractWorkingMemoryInterface.h>
39 #include <MemoryX/interface/memorytypes/MemorySegments.h>
47 #include <VirtualRobot/Robot.h>
48 #include <VirtualRobot/Nodes/RobotNode.h>
49 #include <VirtualRobot/RobotNodeSet.h>
50 #include <VirtualRobot/Visualization/VisualizationFactory.h>
51 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualization.h>
54 #include <QMainWindow>
56 #include <QTreeWidget>
57 #include <QTreeWidgetItem>
60 #include <Inventor/nodes/SoNode.h>
61 #include <Inventor/nodes/SoSeparator.h>
62 #include <Inventor/sensors/SoTimerSensor.h>
63 #include <Inventor/nodes/SoEventCallback.h>
64 #include <Inventor/nodes/SoMatrixTransform.h>
65 #include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
66 #include <Inventor/Qt/SoQt.h>
68 #include <Eigen/Dense>
75 class WorkingMemoryConfigDialog;
87 Q_PLUGIN_METADATA(IID
"ArmarXGuiInterface/1.00")
172 public WorkingMemoryListenerInterface
189 return "MemoryX.WorkingMemoryGui";
193 return QIcon(
"://icons/brain.svg");
204 void reportEntityCreated(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entity, const ::Ice::Current& = Ice::emptyCurrent)
override;
205 void reportEntityUpdated(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entityBaseOld, const ::memoryx::EntityBasePtr& entityBaseNew, const ::Ice::Current& = Ice::emptyCurrent)
override;
206 void reportEntityRemoved(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entity, const ::Ice::Current& = Ice::emptyCurrent)
override;
207 void reportSnapshotLoaded(
const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent)
override;
209 void reportMemoryCleared(
const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent)
override;
218 void entityChanged(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
256 void updateEntityVisu(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
273 void updateEntityTree(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
339 Ui::WorkingMemoryGuiPlugin
ui;
437 int addTab(std::string segmentName);
459 bool createEntity(memoryx::EntityBasePtr entity,
const std::string& entityType);
462 std::recursive_mutex mutexEntities;
463 std::map<std::string, std::pair<long, armarx::FramedPosePtr>> lastUpdated;
465 AbstractWorkingMemoryInterfacePrx memoryPrx;
466 ObjectInstanceMemorySegmentBasePrx objectInstancesPrx;
467 AgentInstancesSegmentBasePrx agentInstancesProxy;
468 WorldStateSegmentBasePrx worldStateProxy;
469 PersistentObjectClassSegmentBasePrx classesSegmentPrx;
470 PriorKnowledgeInterfacePrx priorKnowledgePrx;
474 QPointer<WorkingMemoryConfigDialog> dialog;
476 std::string settings_priorMemoryName;
477 std::string settings_workingMemoryName;
478 std::string settings_workingMemoryUpdatesTopic;
479 std::string settings_objectInstancesSegmentName;
480 std::string settings_agentInstancesSegmentName;
481 std::string settings_worldStateSegmentName;
482 std::string settings_packages;
484 int robotUpdateTimerId;
487 bool visuSetting_transparentExistanceCertatinty;
488 bool visuSetting_showObjectModels;
491 using AgentEntryMap = std::map<std::string, RobotDefinition>;
495 AgentEntryMap currentAgents;
496 AgentEntryMap deletedAgents;
499 QToolBar* customToolbar;
501 QPointer<QDialog> sceneConfigDialog;
502 QPointer<armarx::DebugDrawerConfigWidget> debugDrawerConfigWidget;
The WorkingMemoryGuiPlugin provides a widget that allows you to inspect the current state of the work...
void createObjectVisualization(ObjectDefinition &o)
bool createEntity(memoryx::EntityBasePtr entity, const std::string &entityType)
createEntity Updates currentEntities or currentAgents with data.
SoNode * getScene() override
Reimplementing this function and returning a SoNode* will show this SoNode in the 3DViewerWidget,...
std::atomic< bool > showObjInstanceUncertainties
VirtualRobot::RobotPtr robot
Robot used for visualisation purposes.
~WorkingMemoryController() override
void onInitComponent() override
Pure virtual hook for the subclass.
SoSeparator * objectsVisu
static QString GetWidgetName()
void existenceCertaintyToggled(bool isChecked)
void setupVisualization()
void clearEntitiesVisu(const std::string &segmentName="")
void removeTab(std::string segmentName)
EntityEntryMap deletedEntities
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
void treeItemDoubleClicked(QTreeWidgetItem *item, int column)
void updateEntityVisu(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
void reportEntityRemoved(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
static QIcon GetWidgetIcon()
DebugLayerControlWidget * debugLayerControlWidget
memoryx::NameList segmentNames
void uncertaintyVisuToggled(bool isChecked)
void convertObjectInstanceToGlobalPose(ObjectInstance &obj)
int addTab(std::string segmentName)
VirtualRobot::CoinVisualizationPtr cv
void agentsRemoved()
agentsRemoved One or multiple agent(s) have been removed from memory. This method updates all Qt rela...
std::map< std::string, struct SegmentTab > segmentTabs
EntityEntryMap currentEntities
void refetchEntitiesFromMemory()
void processPackages(const std::string &packages)
void updateAgentVisualisation(const std::string entityId)
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void objectsRemoved()
objectsRemoved One or multiple object(s) have been removed from memory. This method updates all Qt re...
void reportMemoryCleared(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
void showAgents(bool show)
Sets the visibility for agents.
void reportSnapshotLoaded(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
void signalRebuildVisualization()
armarx::RobotStateComponentInterfacePrx robotStateComponent
void timerEvent(QTimerEvent *) override
void signalRefetchEntities()
void updateEntityTree(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
boost::shared_ptr< VirtualRobot::CoinVisualization > CoinVisualizationPtr
WorkingMemoryController()
IceUtil::Time timestamp
Time when timestamped robot was updated.
void signalObjectRemoved()
void clearWorkingMemory()
clearWorkingMemory deletes the current contents of WorkingMemory
VirtualRobot::ManipulationObjectPtr manipObj
Object used for visualisation purposes.
void onExitComponent() override
Hook for subclass.
void onDisconnectComponent() override
Hook for subclass.
void onConnectComponent() override
Pure virtual hook for the subclass.
void createAgentVisualisation(const std::string entityId)
void reportEntityCreated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
void updateVisualization(const EntityWrappers::SimoxObjectWrapperPtr objWrapper)
void showVisuLayers(bool show)
Sets the visibility for debugDrawer's visualization layers.
std::shared_ptr< WorkingMemoryController > WorkingMemoryGuiPluginPtr
armarx::core::time::DateTime Time
QPointer< QDialog > getConfigDialog(QWidget *parent=nullptr) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
void reportSnapshotCompletelyLoaded(const Ice::Current &c=Ice::emptyCurrent) override
QPointer< QDialog > getSceneConfigDialog(QWidget *parent=nullptr) override
Reimplementing this function and returning a QDialog* will enable a configuration button which opens ...
void setMutex3D(RecursiveMutexPtr const &mutex3D) override
This mutex is used to protect 3d scene updates. Usually called by the ArmarXGui main window on creati...
void updateObjectData(const ObjectInstancePtr obj)
void entityChanged(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
std::shared_ptr< GridFileManager > GridFileManagerPtr
void showPlane(bool show)
Ui::WorkingMemoryGuiPlugin ui
void removeEntityInTree(const std::string entityId, const std::string entityType)
void rebuildVisualization()
SoSeparator * debugLayerVisu
This widget allows you to inspect the current state of the working memory.
bool addAgent(const AgentInstancePtr agent)
SoNode * visualization
Object visualisation.
EntityWrappers::SimoxObjectWrapperPtr simoxWrapper
void signalClearEntities(const std::string &segmentName)
VirtualRobot::RobotPtr timestampedRobot
std::map< std::string, ObjectDefinition > EntityEntryMap
SoNode * visualization
Robot visualisation.
void signalAgentsRemoved()
std::shared_ptr< class Robot > RobotPtr
void reportEntityUpdated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entityBaseOld, const ::memoryx::EntityBasePtr &entityBaseNew, const ::Ice::Current &=Ice::emptyCurrent) override
void setupEntityVisu(const ObjectDefinition &objWrapper)
void startTimerInGUIThread()