28 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
29 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
30 #include <MemoryX/interface/components/CommonPlacesLearnerInterface.h>
42 defineOptionalProperty<std::string>(
"TestToRun",
"LearnFromSnapshot",
"Name of test that should be executed (LearnFromSnapshot, LoadLTM)");
43 defineOptionalProperty<std::string>(
"SnapshotToLoad",
"",
"Name of snapshot to be loaded into WM on startup");
44 defineOptionalProperty<std::string>(
"SnapshotsToLearnFrom",
"",
"Comma-separated list of snapshot to be processed by CommonPlacesLearner");
45 defineOptionalProperty<bool>(
"LoadToWM",
false,
"Load LTM contents to WM after each learned snapshot (e.g. for visualization)");
47 defineOptionalProperty<int>(
"InitialDelay", 0,
"Timeout before starting the learning process (in ms)");
48 defineOptionalProperty<int>(
"DelayBetweenSnapshots", 0,
"Timeout after each learned snapshot (in ms)");
49 defineOptionalProperty<std::string>(
"ObjectToLoad",
"",
"Name of object to load from LTM ");
50 defineOptionalProperty<std::string>(
"LTMSegment",
"objects",
"Name of segment in LTM to store learned CommonPlaces / to run queries on");
51 defineOptionalProperty<std::string>(
"ClusterDeviationType",
"AABB",
"Type of deviation: AABB, OrientedBBox or EqualSphere");
52 defineOptionalProperty<float>(
"ClusterMaxDeviation", 100.,
"Max. intra-cluster deviation (meanings depends of ClusterDeviationType)");
54 defineOptionalProperty<int>(
"SampleSize", 10,
"");
55 defineOptionalProperty<int>(
"IterationCount", 1,
"");
71 getConfigIdentifier()));
77 return "CommonPlacesTester";
79 void onInitComponent()
override;
80 void onConnectComponent()
override;
83 WorkingMemoryInterfacePrx memoryPrx;
84 LongtermMemoryInterfacePrx longtermMemoryPrx;
85 CommonPlacesLearnerInterfacePrx cpLearnerPrx;
86 std::string testToRun;
87 std::string objectToLoad;
88 std::string ltmSegmentName;
90 void testLearnFromSnapshot();
91 void testLearnFromSingleSnapshot();
93 void testClustering();
96 void testClusteringBatch();
99 void testGetClusterLocations();
101 void getRandomIds(std::vector<std::string>& allIds, std::vector<std::string>& ids,
int sampleSize);
103 DeviationType getDeviationTypeFromString(
const std::string& devTypeStr);
107 struct timeval tv1, tv2, dtv;
111 gettimeofday(&tv1, &tz);
115 gettimeofday(&tv2, &tz);
116 dtv.tv_sec = tv2.tv_sec - tv1.tv_sec;
117 dtv.tv_usec = tv2.tv_usec - tv1.tv_usec;
122 dtv.tv_usec += 1000000;
125 return dtv.tv_sec * 1000 + dtv.tv_usec / 1000;