diff --git a/Controller.cpp b/Controller.cpp index 84e5d71..c765807 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -142,7 +142,8 @@ void buildGridOnce(Grid* grid, Floorplan::IndoorMap* map, const std: // -> disable VAP-grouping in Settings.h [this is for eval and here] // load all APs from the floorplan and use same TXP/EXP/WAF for all of them - wifiModel.loadAPs(map, Settings::WiFiModel::vg_calib, Settings::WiFiModel::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF); + //wifiModel.loadAPs(map, Settings::WiFiModel::vg_calib, Settings::WiFiModel::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF); + wifiModel.loadAPs(map, Settings::WiFiModel::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF); Assert::isFalse(wifiModel.getAllAPs().empty(), "no AccessPoints stored within the map.xml"); } diff --git a/Settings.h b/Settings.h index a1ee335..1319c91 100644 --- a/Settings.h +++ b/Settings.h @@ -51,7 +51,8 @@ namespace Settings { // NOTE: maybe the UAH does not allow valid VAP grouping? delete the grid and rebuild without! const VAPGrouper vg_calib = VAPGrouper(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE); const VAPGrouper vg_eval = VAPGrouper(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE); - +// const VAPGrouper vg_calib = VAPGrouper(VAPGrouper::Mode::DISABLED, VAPGrouper::Aggregation::AVERAGE); +// const VAPGrouper vg_eval = VAPGrouper(VAPGrouper::Mode::DISABLED, VAPGrouper::Aggregation::AVERAGE); } diff --git a/nav/Node.h b/nav/Node.h index 80b2d0e..9d4e3a4 100644 --- a/nav/Node.h +++ b/nav/Node.h @@ -4,7 +4,7 @@ #include #include -struct MyGridNode : public GridNode, public GridPoint, public WiFiGridNode<20> { +struct MyGridNode : public GridNode, public GridPoint, public WiFiGridNode<30> { float navImportance; float getNavImportance() const { return navImportance; } diff --git a/nav/NodeResampling.h b/nav/NodeResampling.h index 485b515..fd48535 100644 --- a/nav/NodeResampling.h +++ b/nav/NodeResampling.h @@ -59,8 +59,8 @@ particlesCopy[i].weight = cumWeight; } -// std::uniform_real_distribution distNewOne(0.0, 1.0); -// std::uniform_int_distribution distRndNode(0, grid.getNumNodes()-1); + std::uniform_real_distribution distNewOne(0.0, 1.0); + std::uniform_int_distribution distRndNode(0, grid.getNumNodes()-1); std::normal_distribution distTurn(0.0, +0.03); // now draw from the copy vector and fill the original one @@ -69,11 +69,11 @@ // slight chance to get a truely random node as particle // mainly for testing -// if (distNewOne(gen) < 0.005) { -// particles[i].state.position = grid[distRndNode(gen)]; -// particles[i].weight = equalWeight; -// continue; -// } + if (distNewOne(gen) < 0.005) { + particles[i].state.position = grid[distRndNode(gen)]; + particles[i].weight = equalWeight; + continue; + } // normal redraw procedure particles[i] = draw(cumWeight); diff --git a/sensors/offline/AllInOneSensor.h b/sensors/offline/AllInOneSensor.h index a0abbbb..21001f8 100644 --- a/sensors/offline/AllInOneSensor.h +++ b/sensors/offline/AllInOneSensor.h @@ -64,7 +64,7 @@ protected: const Timestamp ts = relativeTS(_ts); handbrake(ts); WiFiMeasurements copy = data; - for (WiFiMeasurement& m : copy.entries) {m.ts = ts;} // make each timestmap also relative + for (WiFiMeasurement& m : copy.entries) {m.setTimestamp(ts);} // make each timestmap also relative WiFiSensor::informListeners(ts, copy); } diff --git a/tests/RuntimeTests.h b/tests/RuntimeTests.h index 6191d85..16641c3 100644 --- a/tests/RuntimeTests.h +++ b/tests/RuntimeTests.h @@ -48,8 +48,8 @@ private: fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac2), -72)); WiFiMeasurements avg = fp.average(); Assert::equal(2, (int)avg.entries.size(), "size mismatch"); - Assert::isNear(-61.666f, avg.entries[1].rssi, 0.01f, "rssi avg mismatch"); - Assert::isNear(-71.500f, avg.entries[0].rssi, 0.01f, "rssi avg mismatch"); + Assert::isNear(-61.666f, avg.entries[1].getRSSI(), 0.01f, "rssi avg mismatch"); + Assert::isNear(-71.500f, avg.entries[0].getRSSI(), 0.01f, "rssi avg mismatch"); } diff --git a/tools/calibration/WiFiCalibrationDataModel.h b/tools/calibration/WiFiCalibrationDataModel.h index d36a09a..1643e5c 100644 --- a/tools/calibration/WiFiCalibrationDataModel.h +++ b/tools/calibration/WiFiCalibrationDataModel.h @@ -44,6 +44,7 @@ public: // deserialize it WiFiFingerprint wfp; wfp.read(inp); + if (wfp.measurements.entries.empty()) {continue;} fingerprints.push_back(wfp); } @@ -77,7 +78,7 @@ public: // try to find an existing one for (WiFiFingerprint& wfp : fingerprints) { // get within range of floating-point rounding issues - if (wfp.pos_m.getDistance(pos_m) < 0.001) {return wfp;} + if (wfp.pos_m.getDistance(pos_m) < 0.01) {return wfp;} } // create a new one and return its reference diff --git a/ui/map/2D/WiFiCalibTool.h b/ui/map/2D/WiFiCalibTool.h index c3a26ae..ba59e3a 100644 --- a/ui/map/2D/WiFiCalibTool.h +++ b/ui/map/2D/WiFiCalibTool.h @@ -68,20 +68,22 @@ protected: const QFont font("Arial", 10); qp.setFont(font); + // get all fingerprint-locations that are currently visible on the 2D map for (const Floorplan::Floor* floor : map->floors) { - for (const Floorplan::Beacon* beacon : floor->beacons) { + for (const Floorplan::FingerprintLocation* fpLoc : floor->fpLocations) { - const Point3 p = beacon->pos + Point3(0,0,floor->atHeight) + Point3(0,0,Settings::smartphoneAboveGround); + //const Point3 p = beacon->pos + Point3(0,0,floor->atHeight) + Point3(0,0,Settings::smartphoneAboveGround); + const Point3 p = fpLoc->getPosition(*floor); // is already above ground as configured within the map const Point2 pt = s.mapToScreen(p.xy()); if (floor->atHeight < r.clip.belowHeight_m) {continue;} if (floor->atHeight > r.clip.aboveHeight_m) {continue;} - const WiFiCalibPoint cp(beacon->name, p, pt); + const WiFiCalibPoint cp(fpLoc->name, p, pt); currentlyVisible.push_back(cp); const WiFiFingerprint& fp = mdl->getFingerprint(cp.pos_m); - const QString txt1(beacon->name.c_str()); + const QString txt1(fpLoc->name.c_str()); const QString txt2 = QString::number(fp.measurements.entries.size()); qp.setPen(Qt::black); diff --git a/ui/map/3D/elements/Object.h b/ui/map/3D/elements/Object.h index ab6a21c..4a3622f 100644 --- a/ui/map/3D/elements/Object.h +++ b/ui/map/3D/elements/Object.h @@ -21,8 +21,8 @@ public: /** ctor */ Object(const std::string& file, const std::string& colorTexture, std::string normalsTexture, const float scale = 1.0) { - K::ObjFileReader reader(file, false); - + K::ObjFileReader reader(false); + reader.readFile(file); if (normalsTexture.empty()) {normalsTexture = ":/res/gl/tex/empty_normals.jpg";}