WorkingMemory.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 MemoryX::ShortTermMemory
17 * @author Kai Welke (welke at kit dot edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
27 
28 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
29 #include <MemoryX/interface/memorytypes/MemorySegments.h>
30 #include <MemoryX/interface/workingmemory/AbstractWorkingMemoryInterface.h>
32 
33 namespace memoryx
34 {
35  class ObjectLocalizationMemoryUpdater;
37 
39  {
40  public:
43  {
44  defineOptionalProperty<bool>(
45  "UseKalmanFilter", true, "Switch fusion with Kalman Filter on/off.");
46 
47  defineOptionalProperty<float>(
48  "MatchThreshold",
49  0.,
50  "Threshold value of spatial proximity between observations \nto consider them "
51  "belonging to the same instance (0..1)")
52  .setMin(0)
53  .setMax(1);
54 
55  defineOptionalProperty<bool>(
56  "MatchByClassName",
57  true,
58  "Check for class equality when searching for corresponding instance");
59  }
60  };
61 
62  /*!
63  * \brief The WorkingMemory class provides methods for storing runtime information. The data is stored in segments.
64  *
65  * On startup the working memory gets proxies of LongtermMemory, PriorKnowledge, CommonStorage
66  * and creates a topic to publish updates
67  * (established connections depend on the configuration, \see AbstractWorkingMemory).
68  *
69  * By default the WorkingMemory holds a segment to store object instances (e.g. recognized objects).
70  * This segment is initialized with a fusion method which appends attributes from prior knowledge.
71  * This means every time an entity is added, attribute enrichment (e.g. 3d model loading etc) is performed.
72  * \see PriorAttributeEnrichmentFusion
73  *
74  * See \ref workingmemory "memoryx::WorkingMemory" - abstract working memory, that gets updated "in the loop"
75  */
77  virtual public AbstractWorkingMemory,
78  virtual public WorkingMemoryInterface
79  {
80  public:
81  // inherited from Component
82  std::string
83  getDefaultName() const override
84  {
85  return "WorkingMemory";
86  }
87 
88  void onInitWorkingMemory() override;
89  void onConnectWorkingMemory() override;
90 
91  void setUpdater(ObjectLocalizationMemoryUpdaterPtr locUpdater);
92 
93  /**
94  * @see PropertyUser::createPropertyDefinitions()
95  */
98  {
100  new WorkingMemoryPropertyDefinitions(getConfigIdentifier()));
101  }
102 
103  /*!
104  * \brief getObjectInstancesSegment Get the segment where all object instances are stored.
105  *\see ObjectInstanceMemorySegment
106  * \return The segment.
107  */
108  ObjectInstanceMemorySegmentBasePrx
109  getObjectInstancesSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
110 
111  /*!
112  * \brief getObjectClassesSegment Get the segment where all used object classes are stored.
113  *\see ObjectClassMemorySegment
114  * \return The segment.
115  */
116  ObjectClassMemorySegmentBasePrx
117  getObjectClassesSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
118  RelationMemorySegmentBasePrx
119  getRelationsSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
120 
121  ObjectLocalizationMemoryUpdaterBasePrx
122  getObjectLocalizationUpdater(const ::Ice::Current& = Ice::emptyCurrent) override;
123 
124  CommonStorageInterfacePrx
125  getCommonStorage(const ::Ice::Current& = Ice::emptyCurrent) const override;
126  PriorKnowledgeInterfacePrx
127  getPriorKnowledge(const ::Ice::Current& = Ice::emptyCurrent) const override;
128  ActiveOacMemorySegmentBasePrx
129  getActiveOacSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
130  AgentInstancesSegmentBasePrx
131  getAgentInstancesSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
132  WorldStateSegmentBasePrx
133  getWorldStateSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
134  virtual OacMemorySegmentBasePrx getOacSegment(const ::Ice::Current& = Ice::emptyCurrent);
135  AffordanceSegmentBasePrx
136  getAffordanceSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
137  EnvironmentalPrimitiveSegmentBasePrx
138  getEnvironmentalPrimitiveSegment(const ::Ice::Current& = Ice::emptyCurrent) override;
139  std::string getMemoryName(const Ice::Current&) const override;
140 
141  private:
143  };
144 
146 
147 } // namespace memoryx
memoryx::WorkingMemory::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: WorkingMemory.h:97
memoryx::WorkingMemoryPropertyDefinitions
Definition: WorkingMemory.h:38
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
IceInternal::Handle< ObjectLocalizationMemoryUpdater >
memoryx::WorkingMemory::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: WorkingMemory.h:83
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
memoryx::AbstractWorkingMemoryPropertyDefinitions
Definition: AbstractWorkingMemory.h:40
Component.h
AbstractWorkingMemory.h
memoryx::WorkingMemoryPropertyDefinitions::WorkingMemoryPropertyDefinitions
WorkingMemoryPropertyDefinitions(std::string prefix)
Definition: WorkingMemory.h:41
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::AbstractWorkingMemory
Definition: AbstractWorkingMemory.h:82
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
memoryx::WorkingMemory
The WorkingMemory class provides methods for storing runtime information. The data is stored in segme...
Definition: WorkingMemory.h:76
ImportExportComponent.h