SemanticRelationAnalyzer.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::SemanticRelationAnalyzer
17  * @author Fabian Paus ( fabian dot paus at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 // Weird Eigen hacks from Simox require to be included first
26 #include <mutex>
27 
28 #include <VirtualRobot/VirtualRobot.h>
29 
32 
33 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
34 
35 #include <VisionX/interface/components/SemanticRelationAnalyzer.h>
36 #include <VisionX/interface/libraries/SemanticObjectRelations/GraphStorage.h>
39 
40 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
42 #include <SemanticObjectRelations/SupportAnalysis/SupportAnalysis.h>
43 
44 namespace armarx
45 {
46  /**
47  * @class SemanticRelationAnalyzerPropertyDefinitions
48  * @brief
49  */
51  {
52  public:
54  };
55 
56  /**
57  * @defgroup Component-SemanticRelationAnalyzer SemanticRelationAnalyzer
58  * @ingroup VisionX-Components
59  * A description of the component SemanticRelationAnalyzer.
60  *
61  * @class SemanticRelationAnalyzer
62  * @ingroup Component-SemanticRelationAnalyzer
63  * @brief Brief description of class SemanticRelationAnalyzer.
64  *
65  * Detailed description of class SemanticRelationAnalyzer.
66  */
68  virtual public armarx::Component,
70  virtual public armarx::SemanticRelationAnalyzerInterface
71  {
72  public:
73  // SemanticRelationAnalyzerInterface interface
74  semantic::data::Graph extractSupportGraphFromWorkingMemory(const Ice::Current&) override;
75 
76  /**
77  * @see armarx::ManagedIceObject::getDefaultName()
78  */
79  std::string
80  getDefaultName() const override
81  {
82  return "SemanticRelationAnalyzer";
83  }
84 
85  protected:
86  /**
87  * @see armarx::ManagedIceObject::onInitComponent()
88  */
89  void onInitComponent() override;
90 
91  /**
92  * @see armarx::ManagedIceObject::onConnectComponent()
93  */
94  void onConnectComponent() override;
95 
96  /**
97  * @see armarx::ManagedIceObject::onDisconnectComponent()
98  */
99  void onDisconnectComponent() override;
100 
101  /**
102  * @see armarx::ManagedIceObject::onExitComponent()
103  */
104  void onExitComponent() override;
105 
106  /**
107  * @see PropertyUser::createPropertyDefinitions()
108  */
110 
111  private:
112  void update();
113 
114  private:
115  std::string prop_WorkingMemoryName;
116  std::string prop_PriorKnowledgeName;
117  std::string prop_RobotStateComponentName;
118  std::string prop_DebugDrawerTopicName;
119  int prop_UpdatePeriodInMS = 10;
120  float prop_ContactMarginInMM = 5.0f;
121 
122  memoryx::WorkingMemoryInterfacePrx workingMemory;
123  memoryx::PriorKnowledgeInterfacePrx priorKnowledge;
124  memoryx::RelationMemorySegmentBasePrx relationSegment;
125  RobotStateComponentInterfacePrx robotStateComponent;
126  DebugDrawerInterfacePrx debugDrawer;
127 
128  std::shared_ptr<armarx::semantic::JsonSimoxShapeSerializer> jsonSerializer;
129 
131 
132  std::mutex componentMutex;
133  memoryx::ObjectInstanceSegmentWrapper objectInstancesSegment_;
134  semrel::SupportAnalysis supportAnalysis;
135  };
136 } // namespace armarx
ObjectInstanceSegmentWrapper.h
armarx::SemanticRelationAnalyzerPropertyDefinitions::SemanticRelationAnalyzerPropertyDefinitions
SemanticRelationAnalyzerPropertyDefinitions(std::string prefix)
Definition: SemanticRelationAnalyzer.cpp:45
armarx::SemanticRelationAnalyzerPropertyDefinitions
Definition: SemanticRelationAnalyzer.h:50
armarx::SemanticRelationAnalyzer::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SemanticRelationAnalyzer.cpp:282
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
PeriodicTask.h
armarx::SemanticGraphStorageComponentPluginUser
Definition: SemanticGraphStorageComponentPlugin.h:39
armarx::SemanticRelationAnalyzer::onInitComponent
void onInitComponent() override
Definition: SemanticRelationAnalyzer.cpp:225
armarx::SemanticRelationAnalyzer::getDefaultName
std::string getDefaultName() const override
Definition: SemanticRelationAnalyzer.h:80
armarx::SemanticRelationAnalyzer
Brief description of class SemanticRelationAnalyzer.
Definition: SemanticRelationAnalyzer.h:67
armarx::SemanticRelationAnalyzer::onConnectComponent
void onConnectComponent() override
Definition: SemanticRelationAnalyzer.cpp:242
JsonSimoxShapeSerializer.h
armarx::Graph
boost::subgraph< CloudGraph > Graph
Definition: Common.h:58
armarx::SemanticRelationAnalyzer::extractSupportGraphFromWorkingMemory
semantic::data::Graph extractSupportGraphFromWorkingMemory(const Ice::Current &) override
Definition: SemanticRelationAnalyzer.cpp:163
armarx::SemanticRelationAnalyzer::onDisconnectComponent
void onDisconnectComponent() override
Definition: SemanticRelationAnalyzer.cpp:270
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::SemanticRelationAnalyzer::onExitComponent
void onExitComponent() override
Definition: SemanticRelationAnalyzer.cpp:277
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
SemanticGraphStorageComponentPlugin.h
memoryx::ObjectInstanceSegmentWrapper
Allows access to the objects in the working memory in form of Simox SceneObjects.
Definition: ObjectInstanceSegmentWrapper.h:26
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27