Go to the documentation of this file.
31 #include <Inventor/SbVec3f.h>
32 #include <Inventor/SbRotation.h>
35 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
36 #include <MemoryX/interface/memorytypes/MemorySegments.h>
49 class MemoryXController;
59 virtual public memoryx::WorkingMemoryListenerInterface
76 const std::string& workingMemoryUpdatesTopic,
77 const std::string& objectInstancesSegmentName,
78 const std::shared_ptr<MemoryXController>& memoryXController);
103 std::vector<std::string>
addObjectInstances(
const std::vector<memoryx::ObjectInstancePtr>& instancePtrs);
120 void rotateTranslateObject(
const std::string&
id,
const SbRotation& newOrientation,
const SbVec3f& newPosition);
143 bool saveSceneInSnapshot(
const std::string& snapshotName,
const memoryx::LongtermMemoryInterfacePrx& longtermMemoryPrx)
const;
154 bool saveObjectsInSnapshot(
const std::string& snapshotName,
const memoryx::LongtermMemoryInterfacePrx& longtermMemoryPrx,
const std::vector<std::string>& objectIds)
const;
195 void reportEntityCreated(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entity, const ::Ice::Current& = Ice::emptyCurrent)
override;
201 void reportEntityUpdated(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entityOld, const ::memoryx::EntityBasePtr& entityNew, const ::Ice::Current& = Ice::emptyCurrent)
override;
207 void reportEntityRemoved(
const std::string& segmentName, const ::memoryx::EntityBasePtr& entity, const ::Ice::Current& = Ice::emptyCurrent)
override;
213 void reportSnapshotLoaded(
const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent)
override;
221 void reportMemoryCleared(
const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent)
override;
224 mutable std::recursive_mutex mutexEntities;
228 memoryx::WorkingMemoryInterfacePrx workingMemoryPrx;
229 memoryx::ObjectInstanceMemorySegmentBasePrx objectInstancesPrx;
230 std::weak_ptr<memoryxcontroller::MemoryXController> memoryXController;
232 std::string workingMemoryUpdatesTopic;
233 std::list<memoryx::ObjectInstancePtr> currentChangedInstances;
void rotateTranslateObject(const std::string &id, const SbRotation &newOrientation, const SbVec3f &newPosition)
Applies the given orientation and position to the object instance with the given id.
void onInitComponent() override
list(APPEND SOURCES ${QT_RESOURCES}) set(COMPONENT_LIBS ArmarXGui ArmarXCoreObservers ArmarXCoreEigen3Variants PlotterController $
void reportEntityUpdated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entityOld, const ::memoryx::EntityBasePtr &entityNew, const ::Ice::Current &=Ice::emptyCurrent) override
Recognises when an entity is updated in the working memory.
std::vector< std::string > getAllObjectInstances() const
Returns all object ids that are currently in the working memory.
WorkingMemoryController(const memoryx::WorkingMemoryInterfacePrx &workingMemoryPrx, const std::string &workingMemoryUpdatesTopic, const std::string &objectInstancesSegmentName, const std::shared_ptr< MemoryXController > &memoryXController)
Constructor.
void onConnectComponent() override
bool saveSceneInSnapshot(const std::string &snapshotName, const memoryx::LongtermMemoryInterfacePrx &longtermMemoryPrx) const
Saves the whole scene in a snapshot with the given name.
The controller for the communication with the working memory.
std::vector< std::string > addObjectInstances(const std::vector< memoryx::ObjectInstancePtr > &instancePtrs)
Adds all given object instances to the working memory.
void reportMemoryCleared(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Recognises when an entity is created on the working memory.
static SbVec3f getSbVec3fFromInstance(const memoryx::ObjectInstancePtr &objectInstance)
Returns the position of a object instance.
static SbRotation getSbRotationFromInstance(const memoryx::ObjectInstancePtr &objectInstance)
Returns the rotation of a object instance.
void reportSnapshotLoaded(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Recognises when a segment was loaded from a snapshot.
bool saveObjectsInSnapshot(const std::string &snapshotName, const memoryx::LongtermMemoryInterfacePrx &longtermMemoryPrx, const std::vector< std::string > &objectIds) const
Saves the object instances with the given ids in a snapshot with the given name.
The ManagedIceObject is the base class for all ArmarX objects.
void addAllInstancesToLocalScene() const
Adds all object instances of the working memory to the local scene.
void reportSnapshotCompletelyLoaded(const Ice::Current &c=Ice::emptyCurrent) override
void reportEntityRemoved(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
Recognises when an entity is removed from the working memory.
std::string getDefaultName() const override
Returns the default name of this managed ice object.
std::string addObjectInstance(const std::string &objectName, const memoryx::ObjectClassPtr &objectClassPtr)
Adds a new object instance to the working memory.
void reportEntityCreated(const std::string &segmentName, const ::memoryx::EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
Recognises when an entity is created in the working memory.
~WorkingMemoryController() override
Destructor.
void removeObjectInstance(const std::string &id)
Removes the object instance with the given id.