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