CommonPlacesLearner.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::CommonPlacesLearner
17* @author Alexey Kozlov ( kozlov at kit dot edu)
18* @date 2013
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
27
30#include <MemoryX/interface/components/CommonPlacesLearnerInterface.h>
31#include <MemoryX/interface/components/LongtermMemoryInterface.h>
32#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
33
34// memoryx helpers
36
37namespace memoryx
38{
39
41 {
42 public:
45 {
47 "LTMSegment",
48 "objects",
49 "Name of segment in LTM to store learned CommonPlaces / to run queries on");
51 "AgingFactor", 0.8, "Discount factor to make older observations less significant");
53 "PruningThreshold", 0.0, "Maximum weight of Gauss component to be pruned");
55 "MergingDistanceType",
56 "KL",
57 "Distance type to be used for association/merging: Mahalanobis, ISD, KL");
59 "MergingThreshold",
60 0.0,
61 "Maximum distance value for association (meaning depends upon measure used)");
63 "GMMReducerAlgorithm",
64 "West",
65 "A GMM reducing algorithm to be used for queries: West, Runnalls, Williams");
66 }
67 };
68
70 virtual public CommonPlacesLearnerInterface,
71 virtual public armarx::Component
72 {
73 public:
74 // inherited from Component
75 std::string
76 getDefaultName() const override
77 {
78 return "CommonPlacesLearner";
79 };
80
81 static std::string GetDefaultName();
82
83 void onInitComponent() override;
84 void onConnectComponent() override;
85 void onExitComponent() override;
86
87 // inherited from CommonPlacesLearnerInterface
88 void setLTMSegmentName(const ::std::string& segmentName,
89 const ::Ice::Current& = Ice::emptyCurrent) override;
90 void setAgingFactor(float factor, const ::Ice::Current& = Ice::emptyCurrent) override;
91 void setMergingThreshold(float threshold,
92 const ::Ice::Current& = Ice::emptyCurrent) override;
93
94 void learnFromSnapshot(const ::std::string& snapshotName,
95 const ::Ice::Current& = Ice::emptyCurrent) override;
96 void learnFromObject(const ObjectInstanceBasePtr& newObject,
97 const ::Ice::Current& = Ice::emptyCurrent) override;
98 void learnFromObjectMCA(const ::std::string& objectName,
99 const MultivariateNormalDistributionBasePtr& posDist,
100 const ::Ice::Current& = Ice::emptyCurrent) override;
101
102 // inherited from CommonPlacesQueryInterface
103 GaussianMixtureDistributionBasePtr
104 getPositionFull(const ::std::string& objectName,
105 const ::Ice::Current& = Ice::emptyCurrent) override;
106 GaussianMixtureDistributionBasePtr
107 getPositionReducedByComponentCount(const ::std::string& objectName,
108 Ice::Int compCount,
109 const ::Ice::Current& = Ice::emptyCurrent) override;
110 GaussianMixtureDistributionBasePtr
111 getPositionReducedByMaxDeviation(const ::std::string& objectName,
112 Ice::Float maxDeviation,
113 DeviationType devType,
114 const ::Ice::Current& = Ice::emptyCurrent) override;
115 NormalDistributionBasePtr
116 getPositionAsGaussian(const ::std::string& objectName,
117 const ::Ice::Current& = Ice::emptyCurrent) override;
118
119 Cluster3DList
120 getPositionClustersByComponentCount(const ::std::string& objectName,
121 Ice::Int compCount,
122 const ::Ice::Current& = Ice::emptyCurrent) override;
123 Cluster3DList
124 getPositionClustersByMaxDeviation(const ::std::string& objectName,
125 Ice::Float maxDeviation,
126 DeviationType devType,
127 const ::Ice::Current& = Ice::emptyCurrent) override;
128
129 private:
130 PriorKnowledgeInterfacePrx priorKnowledgePrx;
131
132 LongtermMemoryInterfacePrx longtermMemoryPrx;
133 PersistentObjectInstanceSegmentBasePrx ltmInstancesSegmentPrx;
134
137 GMMReducerPtr gmmReducer;
138
139 //
140 DeviationMeasure convertDeviationType(DeviationType devType);
141 Cluster3DList gmmToClusterList(const GaussianMixtureDistributionBasePtr& gmm);
142 void getChildClasses(std::string className, NameList& result);
143
144 public:
145 /**
146 * @see PropertyUser::createPropertyDefinitions()
147 */
154 };
155
157} // namespace memoryx
#define ARMARXCOMPONENT_IMPORT_EXPORT
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getDefaultName() const override
Retrieve default name of component.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.
IceInternal::Handle< GaussianMixtureAssociationMethod > GaussianMixtureAssociationMethodPtr
std::shared_ptr< GMMReducer > GMMReducerPtr
Definition GMMReducer.h:104
IceInternal::Handle< GaussianMixturePositionFusion > GaussianMixturePositionFusionPtr
IceUtil::Handle< CommonPlacesLearner > CommonPlacesLearnerPtr
DeviationMeasure
Definition GMMReducer.h:38