current code and TeX. code fine?!?!?!
This commit is contained in:
0
wifi/EvalWiFi.h
Normal file → Executable file
0
wifi/EvalWiFi.h
Normal file → Executable file
0
wifi/EvalWiFiConvex.h
Normal file → Executable file
0
wifi/EvalWiFiConvex.h
Normal file → Executable file
71
wifi/EvalWiFiGround.h
Normal file → Executable file
71
wifi/EvalWiFiGround.h
Normal file → Executable file
@@ -30,6 +30,7 @@
|
||||
#include "../plots/PlotErrTime.h"
|
||||
#include "../plots/PlotErrFunc.h"
|
||||
#include "../plots/PlotWiFiGroundProb.h"
|
||||
#include <Indoor/debug/PlotWifiMeasurements.h>
|
||||
//#include "../CSV.h"
|
||||
|
||||
#include <unordered_set>
|
||||
@@ -46,6 +47,7 @@ private:
|
||||
public:
|
||||
|
||||
PlotWiFiGroundProb* groundProb;
|
||||
PlotWifiMeasurements plotWifi;
|
||||
|
||||
public:
|
||||
|
||||
@@ -55,25 +57,84 @@ public:
|
||||
obs = new WiFiObserverFree(8.0, *mdl);
|
||||
groundProb = new PlotWiFiGroundProb(map, settings);
|
||||
|
||||
// must be 34
|
||||
std::cout << "Model APs: " << mdl->getAllAPs().size() << std::endl;
|
||||
int i = 0; (void) i;
|
||||
|
||||
}
|
||||
|
||||
void show(const std::string walkFile, const int idx = -1) {
|
||||
void show(const std::string walkFile, const std::vector<int> gtIndices) {
|
||||
|
||||
Offline::FileReader reader(walkFile);
|
||||
Offline::FileReader::GroundTruth gt = reader.getGroundTruth(map, gtIndices);
|
||||
VAPGrouper vap(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE);
|
||||
|
||||
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
for (const auto& entry : reader.getWiFiGroupedByTime()) {
|
||||
const WiFiMeasurements& mes = entry.data;
|
||||
groundProb->show(*obs, mes);
|
||||
WiFiMeasurements mes;
|
||||
|
||||
//std::vector<int> indices = {260, 270,271,272, 280};
|
||||
//std::vector<int> indices = {270,271,272};
|
||||
|
||||
for (size_t i = 0; i < reader.getWiFiGroupedByTime().size(); ++i) {
|
||||
//for (int i : indices) {
|
||||
|
||||
//mal nur zeigen welche regionen aus sicht von D8:84:66:4A:4B:C0 wahrscheinlich sind
|
||||
|
||||
//beim VAP grouping mitzählen wieviele APs contributen.. wenns nur einer ist, dann vlt lieber löschen???
|
||||
|
||||
const auto& entry = reader.getWiFiGroupedByTime()[i];
|
||||
|
||||
const WiFiMeasurements& _newMes = entry.data;
|
||||
std::cout << _newMes.asString() << std::endl;
|
||||
|
||||
WiFiMeasurements newMes = vap.group(_newMes);
|
||||
//newMes.remove(MACAddress("D8:84:66:4A:4B:C0"));
|
||||
|
||||
// WiFiMeasurement leap = *(newMes.getForMac(MACAddress("D8:84:66:4A:4B:C0")));
|
||||
// newMes.entries.clear();
|
||||
// newMes.entries.push_back(leap);
|
||||
|
||||
|
||||
//std::cout << newMes.entries.front().getAP().getMAC().asString() << ":" << newMes.entries.front().getRSSI() << std::endl;
|
||||
//newMes.entries.erase(newMes.entries.begin());
|
||||
|
||||
// MACAddress mac("D8:84:66:4A:4B:C0");
|
||||
// const WiFiMeasurement* xxx = newMes.getForMac(mac);
|
||||
// if (xxx) {
|
||||
// std::cout << xxx->getRSSI() << std::endl;
|
||||
// } else {
|
||||
// std::cout << "MISSING" << std::endl;
|
||||
// }
|
||||
// mes = WiFiMeasurements::mix(mes, newMes, 2);
|
||||
mes = newMes;
|
||||
|
||||
plotWifi.add(newMes);
|
||||
plotWifi.plot();
|
||||
|
||||
Point3 p3 = gt.get(mes.entries.front().getTimestamp());
|
||||
K::GnuplotPoint3 gp3(p3.x, p3.y, p3.z);
|
||||
groundProb->getPlot().cpoints.clear();
|
||||
groundProb->getPlot().points.add(gp3);
|
||||
|
||||
const Timestamp ts = newMes.entries.front().getTimestamp();
|
||||
groundProb->show(*obs, mes, ts);
|
||||
groundProb->plotMe();
|
||||
|
||||
|
||||
//if (++cnt > 70) {break;}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
|
||||
}
|
||||
|
||||
//groundProb->update();
|
||||
groundProb->plotMe();
|
||||
int i = 0; (void) i;
|
||||
|
||||
sleep(1000);
|
||||
|
||||
}
|
||||
|
||||
void add(const std::string walkFile, const int idx, const float hue) {
|
||||
|
||||
48
wifi/EvalWiFiPathMethods.h
Normal file → Executable file
48
wifi/EvalWiFiPathMethods.h
Normal file → Executable file
@@ -242,7 +242,7 @@ public:
|
||||
|
||||
// error calculation
|
||||
auto funcOrig = [&] (const float* params) -> double { return errFuncOrig(params, mes); };
|
||||
auto funcOther = [&] (const float* params) -> double { return errFuncOther(params, mes); };
|
||||
auto funcOther = [&] (const float* params) -> double { return errFuncSingleProb(params, mes); }; // ADJUST HERE
|
||||
|
||||
// parameters (x,y,z);
|
||||
float paramsOrig[3] = {0,0,0};
|
||||
@@ -536,6 +536,52 @@ private:
|
||||
|
||||
}
|
||||
|
||||
/** TESTING */
|
||||
double errFuncSingleProb(const float* params, const WiFiMeasurements& mes) {
|
||||
|
||||
// crop z to 1 meter
|
||||
//params[2] = std::round(params[2]);
|
||||
|
||||
// suggested position
|
||||
const Point3 pos_m(params[0], params[1], params[2]);
|
||||
|
||||
int cnt = 0;
|
||||
double error = 0;
|
||||
|
||||
//const auto comp = [] (const WiFiMeasurement& m1, const WiFiMeasurement& m2) {return m1.getRSSI() < m2.getRSSI();};
|
||||
//const auto& min = std::min_element(mes.entries.begin(), mes.entries.end(), comp);
|
||||
|
||||
// calculate error for above position using the currently available measurements
|
||||
for (const WiFiMeasurement& m : mes.entries) {
|
||||
|
||||
// skip non-FHWS APs
|
||||
if (!LeHelper::isFHWS_AP(m.getAP().getMAC())) {continue;}
|
||||
|
||||
// get model's rssi for the given location
|
||||
const float rssi_model = wiModel->getRSSI(m.getAP().getMAC(), pos_m);
|
||||
|
||||
// skip APs unknown to the model
|
||||
if (rssi_model != rssi_model) {
|
||||
std::cout << "unknown ap: " << m.getAP().getMAC().asString() << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// get scan's rssi
|
||||
const float rssi_scan = m.getRSSI();
|
||||
|
||||
++cnt;
|
||||
error += std::pow(std::abs(rssi_scan - rssi_model),2);
|
||||
|
||||
}
|
||||
|
||||
if (cnt == 0) {return 1e-50;}
|
||||
double errorAvg = std::pow((error / cnt), 1.0/2.0);
|
||||
double prob = Distribution::Normal<double>::getProbability(0, 4, errorAvg);
|
||||
const double err = -prob;
|
||||
return err;
|
||||
|
||||
}
|
||||
|
||||
|
||||
double getVeto(const Point3& pos_m, const WiFiMeasurements& obs) const {
|
||||
|
||||
|
||||
4
wifi/EvalWiFiPaths.h
Normal file → Executable file
4
wifi/EvalWiFiPaths.h
Normal file → Executable file
@@ -95,7 +95,9 @@ public:
|
||||
pef.getPlot().getKey().setPosition(K::GnuplotKey::Hor::RIGHT, K::GnuplotKey::Ver::BOTTOM);
|
||||
pef.getPlot().getKey().setWidthIncrement(7);
|
||||
pef.getPlot().getAxisY().setLabelOffset(2.5, 0);
|
||||
pef.getPlot().getAxisY().setTicsStep(0, 25, 95);
|
||||
//pef.getPlot().getAxisY().setTicsStep(0, 25, 95);
|
||||
pef.getPlot().getAxisY().setTicsStep({0, 25, 50, 75, 95});
|
||||
pef.getPlot().getAxisX().setTicsLabelFormat("%h m"); // CHECK!
|
||||
|
||||
// MANUAL AXIS RANGE SETTINGS
|
||||
pef.getPlot().getAxisX().setRange(K::GnuplotAxis::Range(0,25));
|
||||
|
||||
Reference in New Issue
Block a user