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 void onInitComponent() override;
82 void onConnectComponent() override;
83 void onExitComponent() override;
84
85 // inherited from CommonPlacesLearnerInterface
86 void setLTMSegmentName(const ::std::string& segmentName,
87 const ::Ice::Current& = Ice::emptyCurrent) override;
88 void setAgingFactor(float factor, const ::Ice::Current& = Ice::emptyCurrent) override;
89 void setMergingThreshold(float threshold,
90 const ::Ice::Current& = Ice::emptyCurrent) override;
91
92 void learnFromSnapshot(const ::std::string& snapshotName,
93 const ::Ice::Current& = Ice::emptyCurrent) override;
94 void learnFromObject(const ObjectInstanceBasePtr& newObject,
95 const ::Ice::Current& = Ice::emptyCurrent) override;
96 void learnFromObjectMCA(const ::std::string& objectName,
97 const MultivariateNormalDistributionBasePtr& posDist,
98 const ::Ice::Current& = Ice::emptyCurrent) override;
99
100 // inherited from CommonPlacesQueryInterface
101 GaussianMixtureDistributionBasePtr
102 getPositionFull(const ::std::string& objectName,
103 const ::Ice::Current& = Ice::emptyCurrent) override;
104 GaussianMixtureDistributionBasePtr
105 getPositionReducedByComponentCount(const ::std::string& objectName,
106 Ice::Int compCount,
107 const ::Ice::Current& = Ice::emptyCurrent) override;
108 GaussianMixtureDistributionBasePtr
109 getPositionReducedByMaxDeviation(const ::std::string& objectName,
110 Ice::Float maxDeviation,
111 DeviationType devType,
112 const ::Ice::Current& = Ice::emptyCurrent) override;
113 NormalDistributionBasePtr
114 getPositionAsGaussian(const ::std::string& objectName,
115 const ::Ice::Current& = Ice::emptyCurrent) override;
116
117 Cluster3DList
118 getPositionClustersByComponentCount(const ::std::string& objectName,
119 Ice::Int compCount,
120 const ::Ice::Current& = Ice::emptyCurrent) override;
121 Cluster3DList
122 getPositionClustersByMaxDeviation(const ::std::string& objectName,
123 Ice::Float maxDeviation,
124 DeviationType devType,
125 const ::Ice::Current& = Ice::emptyCurrent) override;
126
127 private:
128 PriorKnowledgeInterfacePrx priorKnowledgePrx;
129
130 LongtermMemoryInterfacePrx longtermMemoryPrx;
131 PersistentObjectInstanceSegmentBasePrx ltmInstancesSegmentPrx;
132
135 GMMReducerPtr gmmReducer;
136
137 //
138 DeviationMeasure convertDeviationType(DeviationType devType);
139 Cluster3DList gmmToClusterList(const GaussianMixtureDistributionBasePtr& gmm);
140 void getChildClasses(std::string className, NameList& result);
141
142 public:
143 /**
144 * @see PropertyUser::createPropertyDefinitions()
145 */
152 };
153
155} // 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