ObjectInstanceToRobotNodeAttachments.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include <VirtualRobot/VirtualRobot.h>
6 
7 #include <RobotAPI/interface/core/RobotState.h>
8 
9 #include <MemoryX/interface/components/ObjectToRobotNodeAttachment.h>
10 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
13 
14 namespace memoryx
15 {
16 
17  /**
18  * @brief This class can be used to visualize object instances
19  * from working memory to ArViz.
20  */
22  {
23  public:
25 
26  /// Set the proxies.
27  void initFromProxies(const WorkingMemoryInterfacePrx& workingMemory,
28  const armarx::RobotStateComponentInterfacePrx& robotStateComponent);
29 
30 
31  void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput& attachment);
32  void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput& detachment);
33 
34  bool isObjectAttached(const std::string& id) const;
35 
36  Eigen::Matrix4f getObjectPoseInFrame(ObjectInstancePtr object, const std::string& frame);
37 
38 
39  /// Get all entities from `objectInstanceSegment` and cast them to `ObjectInstance`.
40  std::vector<ObjectInstancePtr> queryObjects();
41 
42  ObjectInstancePtr getMatchingObjectInstance(const memoryx::ObjectIdOrClass& object);
43  std::string getMatchingObjectID(const memoryx::ObjectIdOrClass& object);
44 
45 
46  private:
47  struct Attachment;
48 
49  Eigen::Matrix4f getAttachedObjectPoseInFrame(const Attachment& attachment,
50  const std::string& frame);
51  Eigen::Matrix4f getDetachedObjectPoseInFrame(ObjectInstancePtr object,
52  const std::string& frame);
53 
54 
55  private:
56  armarx::RobotStateComponentInterfacePrx robotStateComponent;
58 
59  ObjectInstanceMemorySegmentBasePrx objectInstanceSegment;
60 
61  struct Attachment
62  {
63  std::string robotNode;
66  };
67 
68  /// Object instance ID to attachment.
69  std::map<std::string, Attachment> attachments;
70  std::map<std::string, std::pair<IceUtil::Time, armarx::FramedPose>> objectPoseCache;
71  };
72 
73 } // namespace memoryx
ObjectClassSegmentWrapper.h
memoryx::ObjectInstanceToRobotNodeAttachments::getMatchingObjectID
std::string getMatchingObjectID(const memoryx::ObjectIdOrClass &object)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:192
memoryx::ObjectInstanceToRobotNodeAttachments::attachObjectToRobotNode
void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput &attachment)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:33
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
memoryx::ObjectInstanceToRobotNodeAttachments::isObjectAttached
bool isObjectAttached(const std::string &id) const
Definition: ObjectInstanceToRobotNodeAttachments.cpp:186
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::ObjectInstanceToRobotNodeAttachments::getMatchingObjectInstance
ObjectInstancePtr getMatchingObjectInstance(const memoryx::ObjectIdOrClass &object)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:209
memoryx::ObjectInstanceToRobotNodeAttachments::detachObjectFromRobotNode
void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput &detachment)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:64
IceInternal::Handle< ObjectInstance >
memoryx::ObjectInstanceToRobotNodeAttachments::ObjectInstanceToRobotNodeAttachments
ObjectInstanceToRobotNodeAttachments()
Definition: ObjectInstanceToRobotNodeAttachments.cpp:14
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
memoryx::ObjectInstanceToRobotNodeAttachments::initFromProxies
void initFromProxies(const WorkingMemoryInterfacePrx &workingMemory, const armarx::RobotStateComponentInterfacePrx &robotStateComponent)
Set the proxies.
Definition: ObjectInstanceToRobotNodeAttachments.cpp:19
ObjectInstance.h
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
memoryx::ObjectInstanceToRobotNodeAttachments::getObjectPoseInFrame
Eigen::Matrix4f getObjectPoseInFrame(ObjectInstancePtr object, const std::string &frame)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:106
memoryx::ObjectInstanceToRobotNodeAttachments::queryObjects
std::vector< ObjectInstancePtr > queryObjects()
Get all entities from objectInstanceSegment and cast them to ObjectInstance.
Definition: ObjectInstanceToRobotNodeAttachments.cpp:88
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
memoryx::ObjectInstanceToRobotNodeAttachments
This class can be used to visualize object instances from working memory to ArViz.
Definition: ObjectInstanceToRobotNodeAttachments.h:21