Added plotta, added probabilistic code

This commit is contained in:
2019-09-18 09:02:43 +02:00
parent 52eac3a28a
commit a4d49cadb1
9 changed files with 688 additions and 17 deletions

View File

@@ -38,8 +38,7 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
Offline::FileReader fr(setup.training[walkIdx]);
// ground truth
std::vector<int> gtPath = setup.gtPath;
Interpolator<uint64_t, Point3> gtInterpolator = fr.getGroundTruthPath(map, gtPath);
Interpolator<uint64_t, Point3> gtInterpolator = fr.getGroundTruthPath(map, setup.gtPath);
CombinedStats<float> errorStats;
//calculate distance of path
@@ -61,11 +60,11 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
Plotty plot(map);
plot.buildFloorplan();
plot.setGroundTruth(gtPath);
plot.setGroundTruth(setup.gtPath);
plot.setView(30, 0);
plot.plot();
Plotta::Plotta plotta("test", "C:\\Temp\\Plotta\\dataTrilat.py");
std::vector<Point2> apPositions{
Settings::data.CurrentPath.NUCs.at(Settings::NUC1).position.xy(),
@@ -74,6 +73,8 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
Settings::data.CurrentPath.NUCs.at(Settings::NUC4).position.xy(),
};
plotta.add("apPos", apPositions);
std::vector<WifiMeas> data = filterOfflineData(fr);
const bool UseFTM = false;
@@ -84,10 +85,13 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
std::vector<float> errorValuesFtm, errorValuesRssi;
std::vector<int> timestamps;
std::vector<Point2> gtPath, estPathFtm, estPathRssi;
for (const WifiMeas& wifi : data)
{
Point2 gtPos = gtInterpolator.get(static_cast<uint64_t>(wifi.ts.ms())).xy();
plot.setGroundTruth(Point3(gtPos.x, gtPos.y, 0.1));
gtPath.push_back(gtPos);
float distErrorFtm = 0;
float distErrorRssi = 0;
@@ -132,6 +136,7 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
// Error
distErrorFtm = gtPos.getDistance(estPos);
errorStats.ftm.add(distErrorFtm);
estPathFtm.push_back(estPos);
}
@@ -166,6 +171,7 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
// Error
distErrorRssi = gtPos.getDistance(estPos);
errorStats.rssi.add(distErrorRssi);
estPathRssi.push_back(estPos);
}
//std::cout << wifi.ts.ms() << " " << distError << "\n";
@@ -174,11 +180,10 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
errorValuesRssi.push_back(distErrorRssi);
timestamps.push_back(wifi.ts.ms());
Plotta::Plotta test("test", "C:\\Temp\Plotta\\data.py");
test.add("t", timestamps);
test.add("errorFtm", errorValuesFtm);
test.add("errorRssi", errorValuesRssi);
test.frame();
plotta.add("t", timestamps);
plotta.add("errorFtm", errorValuesFtm);
plotta.add("errorRssi", errorValuesRssi);
plotta.frame();
}
plot.plot();
@@ -186,6 +191,11 @@ static CombinedStats<float> run(Settings::DataSetup setup, int walkIdx, std::str
printf("");
}
plotta.add("gtPath", gtPath);
plotta.add("estPathFtm", estPathFtm);
plotta.add("estPathRssi", estPathRssi);
plotta.frame();
std::cout << "Walk error:" << "\n";
std::cout << "[m] " << " mean \t stdDev median" << "\n";