28 #include <MemoryX/interface/components/CommonPlacesLearnerInterface.h>
29 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
30 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
41 defineOptionalProperty<std::string>(
44 "Name of test that should be executed (LearnFromSnapshot, LoadLTM)");
45 defineOptionalProperty<std::string>(
46 "SnapshotToLoad",
"",
"Name of snapshot to be loaded into WM on startup");
47 defineOptionalProperty<std::string>(
48 "SnapshotsToLearnFrom",
50 "Comma-separated list of snapshot to be processed by CommonPlacesLearner");
51 defineOptionalProperty<bool>(
54 "Load LTM contents to WM after each learned snapshot (e.g. for visualization)");
56 defineOptionalProperty<int>(
57 "InitialDelay", 0,
"Timeout before starting the learning process (in ms)");
58 defineOptionalProperty<int>(
59 "DelayBetweenSnapshots", 0,
"Timeout after each learned snapshot (in ms)");
60 defineOptionalProperty<std::string>(
61 "ObjectToLoad",
"",
"Name of object to load from LTM ");
62 defineOptionalProperty<std::string>(
65 "Name of segment in LTM to store learned CommonPlaces / to run queries on");
66 defineOptionalProperty<std::string>(
67 "ClusterDeviationType",
69 "Type of deviation: AABB, OrientedBBox or EqualSphere");
70 defineOptionalProperty<float>(
71 "ClusterMaxDeviation",
73 "Max. intra-cluster deviation (meanings depends of ClusterDeviationType)");
75 defineOptionalProperty<int>(
"SampleSize", 10,
"");
76 defineOptionalProperty<int>(
"IterationCount", 1,
"");
97 return "CommonPlacesTester";
100 void onInitComponent()
override;
101 void onConnectComponent()
override;
104 WorkingMemoryInterfacePrx memoryPrx;
105 LongtermMemoryInterfacePrx longtermMemoryPrx;
106 CommonPlacesLearnerInterfacePrx cpLearnerPrx;
107 std::string testToRun;
108 std::string objectToLoad;
109 std::string ltmSegmentName;
111 void testLearnFromSnapshot();
112 void testLearnFromSingleSnapshot();
114 void testClustering();
117 void testClusteringBatch();
120 void testGetClusterLocations();
122 void getRandomIds(std::vector<std::string>& allIds,
123 std::vector<std::string>& ids,
126 DeviationType getDeviationTypeFromString(
const std::string& devTypeStr);
130 struct timeval tv1, tv2, dtv;
136 gettimeofday(&tv1, &tz);
142 gettimeofday(&tv2, &tz);
143 dtv.tv_sec = tv2.tv_sec - tv1.tv_sec;
144 dtv.tv_usec = tv2.tv_usec - tv1.tv_usec;
149 dtv.tv_usec += 1000000;
152 return dtv.tv_sec * 1000 + dtv.tv_usec / 1000;