38#include <MemoryX/gui-plugins/WorkingMemoryGui/ui_WorkingMemoryGuiPlugin.h>
42#include <MemoryX/interface/memorytypes/MemorySegments.h>
43#include <MemoryX/interface/workingmemory/AbstractWorkingMemoryInterface.h>
50#include <VirtualRobot/Nodes/RobotNode.h>
51#include <VirtualRobot/Robot.h>
52#include <VirtualRobot/RobotNodeSet.h>
53#include <VirtualRobot/Visualization/CoinVisualization/CoinVisualization.h>
54#include <VirtualRobot/Visualization/VisualizationFactory.h>
60#include <QTreeWidgetItem>
68#include <Inventor/Qt/SoQt.h>
69#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
70#include <Inventor/nodes/SoEventCallback.h>
71#include <Inventor/nodes/SoMatrixTransform.h>
72#include <Inventor/nodes/SoNode.h>
73#include <Inventor/nodes/SoSeparator.h>
74#include <Inventor/sensors/SoTimerSensor.h>
89 Q_PLUGIN_METADATA(IID
"ArmarXGuiInterface/1.00")
174 public WorkingMemoryListenerInterface
191 return "MemoryX.WorkingMemoryGui";
197 return QIcon(
"://icons/brain.svg");
210 const ::memoryx::EntityBasePtr& entity,
211 const ::Ice::Current& = Ice::emptyCurrent)
override;
213 const ::memoryx::EntityBasePtr& entityBaseOld,
214 const ::memoryx::EntityBasePtr& entityBaseNew,
215 const ::Ice::Current& = Ice::emptyCurrent)
override;
217 const ::memoryx::EntityBasePtr& entity,
218 const ::Ice::Current& = Ice::emptyCurrent)
override;
220 const ::Ice::Current& = Ice::emptyCurrent)
override;
223 const ::Ice::Current& = Ice::emptyCurrent)
override;
232 void entityChanged(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
269 void updateEntityVisu(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
286 void updateEntityTree(memoryx::EntityBasePtr entity, QString entityType,
bool isNew);
349 Ui::WorkingMemoryGuiPlugin
ui;
368 VirtualRobot::ManipulationObjectPtr
371 VirtualRobot::CoinVisualizationPtr
cv;
449 int addTab(std::string segmentName);
471 bool createEntity(memoryx::EntityBasePtr entity,
const std::string& entityType);
474 std::recursive_mutex mutexEntities;
475 std::map<std::string, std::pair<long, armarx::FramedPosePtr>>
478 AbstractWorkingMemoryInterfacePrx memoryPrx;
479 ObjectInstanceMemorySegmentBasePrx objectInstancesPrx;
480 AgentInstancesSegmentBasePrx agentInstancesProxy;
481 WorldStateSegmentBasePrx worldStateProxy;
482 PersistentObjectClassSegmentBasePrx classesSegmentPrx;
483 PriorKnowledgeInterfacePrx priorKnowledgePrx;
487 QPointer<WorkingMemoryConfigDialog> dialog;
489 std::string settings_priorMemoryName;
490 std::string settings_workingMemoryName;
491 std::string settings_workingMemoryUpdatesTopic;
492 std::string settings_objectInstancesSegmentName;
493 std::string settings_agentInstancesSegmentName;
494 std::string settings_worldStateSegmentName;
495 std::string settings_packages;
497 int robotUpdateTimerId;
500 bool visuSetting_transparentExistanceCertatinty;
501 bool visuSetting_showObjectModels;
504 using AgentEntryMap = std::map<std::string, RobotDefinition>;
508 AgentEntryMap currentAgents;
513 QToolBar* customToolbar;
515 QPointer<QDialog> sceneConfigDialog;
516 QPointer<armarx::DebugDrawerConfigWidget> debugDrawerConfigWidget;
void rebuildVisualization()
void processPackages(const std::string &packages)
int addTab(std::string segmentName)
bool createEntity(memoryx::EntityBasePtr entity, const std::string &entityType)
createEntity Updates currentEntities or currentAgents with data.
void onInitComponent() override
Pure virtual hook for the subclass.
void setupVisualization()
void uncertaintyVisuToggled(bool isChecked)
EntityEntryMap currentEntities
std::atomic< bool > showObjInstanceUncertainties
void startTimerInGUIThread()
void treeItemDoubleClicked(QTreeWidgetItem *item, int column)
QPointer< QDialog > getConfigDialog(QWidget *parent=nullptr) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
void updateObjectData(const ObjectInstancePtr obj)
DebugLayerControlWidget * debugLayerControlWidget
void updateEntityTree(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
void refetchEntitiesFromMemory()
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
void onDisconnectComponent() override
Hook for subclass.
void reportSnapshotLoaded(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void entityChanged(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
std::map< std::string, ObjectDefinition > EntityEntryMap
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
SoNode * getScene() override
Reimplementing this function and returning a SoNode* will show this SoNode in the 3DViewerWidget,...
QPointer< QDialog > getSceneConfigDialog(QWidget *parent=nullptr) override
Reimplementing this function and returning a QDialog* will enable a configuration button which opens ...
void signalClearEntities(const std::string &segmentName)
void existenceCertaintyToggled(bool isChecked)
EntityEntryMap deletedEntities
void reportEntityUpdated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entityBaseOld, const ::memoryx::EntityBasePtr &entityBaseNew, const ::Ice::Current &=Ice::emptyCurrent) override
void setMutex3D(RecursiveMutexPtr const &mutex3D) override
This mutex is used to protect 3d scene updates. Usually called by the ArmarXGui main window on creati...
std::map< std::string, struct SegmentTab > segmentTabs
void clearWorkingMemory()
clearWorkingMemory deletes the current contents of WorkingMemory
void reportSnapshotCompletelyLoaded(const Ice::Current &c=Ice::emptyCurrent) override
void updateVisualization(const EntityWrappers::SimoxObjectWrapperPtr objWrapper)
void updateEntityVisu(memoryx::EntityBasePtr entity, QString entityType, bool isNew)
~WorkingMemoryController() override
void removeEntityInTree(const std::string entityId, const std::string entityType)
void reportEntityRemoved(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
void convertObjectInstanceToGlobalPose(ObjectInstance &obj)
void signalAgentsRemoved()
void signalObjectRemoved()
SoSeparator * objectsVisu
void timerEvent(QTimerEvent *) override
void reportEntityCreated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
void showPlane(bool show)
void onConnectComponent() override
Pure virtual hook for the subclass.
void createAgentVisualisation(const std::string entityId)
memoryx::NameList segmentNames
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
void updateAgentVisualisation(const std::string entityId)
WorkingMemoryController()
void signalRebuildVisualization()
void setupEntityVisu(const ObjectDefinition &objWrapper)
static QString GetWidgetName()
Ui::WorkingMemoryGuiPlugin ui
void onExitComponent() override
Hook for subclass.
void showAgents(bool show)
Sets the visibility for agents.
void showVisuLayers(bool show)
Sets the visibility for debugDrawer's visualization layers.
void removeTab(std::string segmentName)
void createObjectVisualization(ObjectDefinition &o)
bool addAgent(const AgentInstancePtr agent)
static QIcon GetWidgetIcon()
void reportMemoryCleared(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
void signalRefetchEntities()
SoSeparator * debugLayerVisu
void clearEntitiesVisu(const std::string &segmentName="")
void objectsRemoved()
objectsRemoved One or multiple object(s) have been removed from memory. This method updates all Qt re...
void agentsRemoved()
agentsRemoved One or multiple agent(s) have been removed from memory. This method updates all Qt rela...
std::shared_ptr< class Robot > RobotPtr
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
IceInternal::Handle< SimoxObjectWrapper > SimoxObjectWrapperPtr
IceInternal::Handle< AgentInstance > AgentInstancePtr
Typedef of AgentEntityPtr as IceInternal::Handle<AgentEntity> for convenience.
std::shared_ptr< WorkingMemoryController > WorkingMemoryGuiPluginPtr
IceInternal::Handle< ObjectInstance > ObjectInstancePtr
IceInternal::Handle< EntityDrawerComponent > EntityDrawerComponentPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
VirtualRobot::ManipulationObjectPtr manipObj
Object used for visualisation purposes.
SoNode * visualization
Object visualisation.
EntityWrappers::SimoxObjectWrapperPtr simoxWrapper
SoNode * visualization
Robot visualisation.
VirtualRobot::RobotPtr robot
Robot used for visualisation purposes.
IceUtil::Time timestamp
Time when timestamped robot was updated.
VirtualRobot::RobotPtr timestampedRobot
armarx::RobotStateComponentInterfacePrx robotStateComponent