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/WorkingMemoryInterface.h>
10 #include <MemoryX/interface/components/ObjectToRobotNodeAttachment.h>
11 
14 
15 
16 namespace memoryx
17 {
18 
19  /**
20  * @brief This class can be used to visualize object instances
21  * from working memory to ArViz.
22  */
24  {
25  public:
26 
28 
29  /// Set the proxies.
30  void initFromProxies(const WorkingMemoryInterfacePrx& workingMemory,
31  const armarx::RobotStateComponentInterfacePrx& robotStateComponent);
32 
33 
34  void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput& attachment);
35  void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput& detachment);
36 
37  bool isObjectAttached(const std::string& id) const;
38 
39  Eigen::Matrix4f getObjectPoseInFrame(ObjectInstancePtr object, const std::string& frame);
40 
41 
42  /// Get all entities from `objectInstanceSegment` and cast them to `ObjectInstance`.
43  std::vector<ObjectInstancePtr> queryObjects();
44 
45  ObjectInstancePtr getMatchingObjectInstance(const memoryx::ObjectIdOrClass& object);
46  std::string getMatchingObjectID(const memoryx::ObjectIdOrClass& object);
47 
48 
49  private:
50 
51  struct Attachment;
52 
53  Eigen::Matrix4f getAttachedObjectPoseInFrame(const Attachment& attachment, const std::string& frame);
54  Eigen::Matrix4f getDetachedObjectPoseInFrame(ObjectInstancePtr object, const std::string& frame);
55 
56 
57  private:
58 
59  armarx::RobotStateComponentInterfacePrx robotStateComponent;
61 
62  ObjectInstanceMemorySegmentBasePrx objectInstanceSegment;
63 
64  struct Attachment
65  {
66  std::string robotNode;
69  };
70 
71  /// Object instance ID to attachment.
72  std::map<std::string, Attachment> attachments;
73  std::map<std::string, std::pair<IceUtil::Time, armarx::FramedPose>> objectPoseCache;
74 
75  };
76 
77 }
78 
ObjectClassSegmentWrapper.h
memoryx::ObjectInstanceToRobotNodeAttachments::getMatchingObjectID
std::string getMatchingObjectID(const memoryx::ObjectIdOrClass &object)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:184
memoryx::ObjectInstanceToRobotNodeAttachments::attachObjectToRobotNode
void attachObjectToRobotNode(const memoryx::AttachObjectToRobotNodeInput &attachment)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:34
memoryx::ObjectInstanceToRobotNodeAttachments::isObjectAttached
bool isObjectAttached(const std::string &id) const
Definition: ObjectInstanceToRobotNodeAttachments.cpp:179
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::ObjectInstanceToRobotNodeAttachments::getMatchingObjectInstance
ObjectInstancePtr getMatchingObjectInstance(const memoryx::ObjectIdOrClass &object)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:200
memoryx::ObjectInstanceToRobotNodeAttachments::detachObjectFromRobotNode
void detachObjectFromRobotNode(const memoryx::DetachObjectFromRobotNodeInput &detachment)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:62
IceInternal::Handle< ObjectInstance >
memoryx::ObjectInstanceToRobotNodeAttachments::ObjectInstanceToRobotNodeAttachments
ObjectInstanceToRobotNodeAttachments()
Definition: ObjectInstanceToRobotNodeAttachments.cpp:15
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
memoryx::ObjectInstanceToRobotNodeAttachments::initFromProxies
void initFromProxies(const WorkingMemoryInterfacePrx &workingMemory, const armarx::RobotStateComponentInterfacePrx &robotStateComponent)
Set the proxies.
Definition: ObjectInstanceToRobotNodeAttachments.cpp:20
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
ObjectInstance.h
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
memoryx::ObjectInstanceToRobotNodeAttachments::getObjectPoseInFrame
Eigen::Matrix4f getObjectPoseInFrame(ObjectInstancePtr object, const std::string &frame)
Definition: ObjectInstanceToRobotNodeAttachments.cpp:102
memoryx::ObjectInstanceToRobotNodeAttachments::queryObjects
std::vector< ObjectInstancePtr > queryObjects()
Get all entities from objectInstanceSegment and cast them to ObjectInstance.
Definition: ObjectInstanceToRobotNodeAttachments.cpp:85
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
memoryx::ObjectInstanceToRobotNodeAttachments
This class can be used to visualize object instances from working memory to ArViz.
Definition: ObjectInstanceToRobotNodeAttachments.h:23