current code and TeX. code fine?!?!?!
This commit is contained in:
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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user