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 <VirtualRobot/VirtualRobot.h>
27 
29 #include <VisionX/interface/components/SemanticRelationAnalyzer.h>
30 #include <VisionX/interface/libraries/SemanticObjectRelations/GraphStorage.h>
32 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
33 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
37 
38 #include <SemanticObjectRelations/SupportAnalysis/SupportAnalysis.h>
39 
40 #include <mutex>
41 
42 namespace armarx
43 {
44  /**
45  * @class SemanticRelationAnalyzerPropertyDefinitions
46  * @brief
47  */
50  {
51  public:
53  };
54 
55  /**
56  * @defgroup Component-SemanticRelationAnalyzer SemanticRelationAnalyzer
57  * @ingroup VisionX-Components
58  * A description of the component SemanticRelationAnalyzer.
59  *
60  * @class SemanticRelationAnalyzer
61  * @ingroup Component-SemanticRelationAnalyzer
62  * @brief Brief description of class SemanticRelationAnalyzer.
63  *
64  * Detailed description of class SemanticRelationAnalyzer.
65  */
67  : virtual public armarx::Component
69  , virtual public armarx::SemanticRelationAnalyzerInterface
70  {
71  public:
72  // SemanticRelationAnalyzerInterface interface
73  semantic::data::Graph extractSupportGraphFromWorkingMemory(const Ice::Current&) override;
74 
75  /**
76  * @see armarx::ManagedIceObject::getDefaultName()
77  */
78  std::string getDefaultName() const override
79  {
80  return "SemanticRelationAnalyzer";
81  }
82 
83  protected:
84  /**
85  * @see armarx::ManagedIceObject::onInitComponent()
86  */
87  void onInitComponent() override;
88 
89  /**
90  * @see armarx::ManagedIceObject::onConnectComponent()
91  */
92  void onConnectComponent() override;
93 
94  /**
95  * @see armarx::ManagedIceObject::onDisconnectComponent()
96  */
97  void onDisconnectComponent() override;
98 
99  /**
100  * @see armarx::ManagedIceObject::onExitComponent()
101  */
102  void onExitComponent() override;
103 
104  /**
105  * @see PropertyUser::createPropertyDefinitions()
106  */
108 
109  private:
110  void update();
111 
112  private:
113  std::string prop_WorkingMemoryName;
114  std::string prop_PriorKnowledgeName;
115  std::string prop_RobotStateComponentName;
116  std::string prop_DebugDrawerTopicName;
117  int prop_UpdatePeriodInMS = 10;
118  float prop_ContactMarginInMM = 5.0f;
119 
120  memoryx::WorkingMemoryInterfacePrx workingMemory;
121  memoryx::PriorKnowledgeInterfacePrx priorKnowledge;
122  memoryx::RelationMemorySegmentBasePrx relationSegment;
123  RobotStateComponentInterfacePrx robotStateComponent;
124  DebugDrawerInterfacePrx debugDrawer;
125 
126  std::shared_ptr<armarx::semantic::JsonSimoxShapeSerializer> jsonSerializer;
127 
129 
130  std::mutex componentMutex;
131  memoryx::ObjectInstanceSegmentWrapper objectInstancesSegment_;
132  semrel::SupportAnalysis supportAnalysis;
133 
134  };
135 }
ObjectInstanceSegmentWrapper.h
armarx::SemanticRelationAnalyzerPropertyDefinitions::SemanticRelationAnalyzerPropertyDefinitions
SemanticRelationAnalyzerPropertyDefinitions(std::string prefix)
Definition: SemanticRelationAnalyzer.cpp:44
armarx::SemanticRelationAnalyzerPropertyDefinitions
Definition: SemanticRelationAnalyzer.h:48
armarx::SemanticRelationAnalyzer::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SemanticRelationAnalyzer.cpp:253
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
PeriodicTask.h
armarx::SemanticGraphStorageComponentPluginUser
Definition: SemanticGraphStorageComponentPlugin.h:41
armarx::SemanticRelationAnalyzer::onInitComponent
void onInitComponent() override
Definition: SemanticRelationAnalyzer.cpp:200
armarx::SemanticRelationAnalyzer::getDefaultName
std::string getDefaultName() const override
Definition: SemanticRelationAnalyzer.h:78
armarx::SemanticRelationAnalyzer
Brief description of class SemanticRelationAnalyzer.
Definition: SemanticRelationAnalyzer.h:66
armarx::SemanticRelationAnalyzer::onConnectComponent
void onConnectComponent() override
Definition: SemanticRelationAnalyzer.cpp:217
JsonSimoxShapeSerializer.h
armarx::Graph
boost::subgraph< CloudGraph > Graph
Definition: Common.h:54
armarx::SemanticRelationAnalyzer::extractSupportGraphFromWorkingMemory
semantic::data::Graph extractSupportGraphFromWorkingMemory(const Ice::Current &) override
Definition: SemanticRelationAnalyzer.cpp:142
armarx::SemanticRelationAnalyzer::onDisconnectComponent
void onDisconnectComponent() override
Definition: SemanticRelationAnalyzer.cpp:242
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::SemanticRelationAnalyzer::onExitComponent
void onExitComponent() override
Definition: SemanticRelationAnalyzer.cpp:249
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
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:25
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28