some adjustments to match latest changes in KLib/Indoor

switched from Beacons to real Fingerprint points for fingerprinting
This commit is contained in:
2017-03-14 09:17:50 +01:00
parent 3a1cd1bccc
commit c7c94cbebe
9 changed files with 25 additions and 20 deletions

View File

@@ -142,7 +142,8 @@ void buildGridOnce(Grid<MyGridNode>* grid, Floorplan::IndoorMap* map, const std:
// -> disable VAP-grouping in Settings.h [this is for eval and here] // -> 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 // 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"); Assert::isFalse(wifiModel.getAllAPs().empty(), "no AccessPoints stored within the map.xml");
} }

View File

@@ -51,7 +51,8 @@ namespace Settings {
// NOTE: maybe the UAH does not allow valid VAP grouping? delete the grid and rebuild without! // 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_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_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);
} }

View File

@@ -4,7 +4,7 @@
#include <Indoor/grid/Grid.h> #include <Indoor/grid/Grid.h>
#include <Indoor/sensors/radio/WiFiGridNode.h> #include <Indoor/sensors/radio/WiFiGridNode.h>
struct MyGridNode : public GridNode, public GridPoint, public WiFiGridNode<20> { struct MyGridNode : public GridNode, public GridPoint, public WiFiGridNode<30> {
float navImportance; float navImportance;
float getNavImportance() const { return navImportance; } float getNavImportance() const { return navImportance; }

View File

@@ -59,8 +59,8 @@
particlesCopy[i].weight = cumWeight; particlesCopy[i].weight = cumWeight;
} }
// std::uniform_real_distribution<float> distNewOne(0.0, 1.0); std::uniform_real_distribution<float> distNewOne(0.0, 1.0);
// std::uniform_int_distribution<int> distRndNode(0, grid.getNumNodes()-1); std::uniform_int_distribution<int> distRndNode(0, grid.getNumNodes()-1);
std::normal_distribution<float> distTurn(0.0, +0.03); std::normal_distribution<float> distTurn(0.0, +0.03);
// now draw from the copy vector and fill the original one // 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 // slight chance to get a truely random node as particle
// mainly for testing // mainly for testing
// if (distNewOne(gen) < 0.005) { if (distNewOne(gen) < 0.005) {
// particles[i].state.position = grid[distRndNode(gen)]; particles[i].state.position = grid[distRndNode(gen)];
// particles[i].weight = equalWeight; particles[i].weight = equalWeight;
// continue; continue;
// } }
// normal redraw procedure // normal redraw procedure
particles[i] = draw(cumWeight); particles[i] = draw(cumWeight);

View File

@@ -64,7 +64,7 @@ protected:
const Timestamp ts = relativeTS(_ts); const Timestamp ts = relativeTS(_ts);
handbrake(ts); handbrake(ts);
WiFiMeasurements copy = data; 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); WiFiSensor::informListeners(ts, copy);
} }

View File

@@ -48,8 +48,8 @@ private:
fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac2), -72)); fp.measurements.entries.push_back( WiFiMeasurement(AccessPoint(mac2), -72));
WiFiMeasurements avg = fp.average(); WiFiMeasurements avg = fp.average();
Assert::equal(2, (int)avg.entries.size(), "size mismatch"); Assert::equal(2, (int)avg.entries.size(), "size mismatch");
Assert::isNear(-61.666f, avg.entries[1].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].rssi, 0.01f, "rssi avg mismatch"); Assert::isNear(-71.500f, avg.entries[0].getRSSI(), 0.01f, "rssi avg mismatch");
} }

View File

@@ -44,6 +44,7 @@ public:
// deserialize it // deserialize it
WiFiFingerprint wfp; WiFiFingerprint wfp;
wfp.read(inp); wfp.read(inp);
if (wfp.measurements.entries.empty()) {continue;}
fingerprints.push_back(wfp); fingerprints.push_back(wfp);
} }
@@ -77,7 +78,7 @@ public:
// try to find an existing one // try to find an existing one
for (WiFiFingerprint& wfp : fingerprints) { for (WiFiFingerprint& wfp : fingerprints) {
// get within range of floating-point rounding issues // 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 // create a new one and return its reference

View File

@@ -68,20 +68,22 @@ protected:
const QFont font("Arial", 10); const QFont font("Arial", 10);
qp.setFont(font); 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::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()); const Point2 pt = s.mapToScreen(p.xy());
if (floor->atHeight < r.clip.belowHeight_m) {continue;} if (floor->atHeight < r.clip.belowHeight_m) {continue;}
if (floor->atHeight > r.clip.aboveHeight_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); currentlyVisible.push_back(cp);
const WiFiFingerprint& fp = mdl->getFingerprint(cp.pos_m); 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()); const QString txt2 = QString::number(fp.measurements.entries.size());
qp.setPen(Qt::black); qp.setPen(Qt::black);

View File

@@ -21,8 +21,8 @@ public:
/** ctor */ /** ctor */
Object(const std::string& file, const std::string& colorTexture, std::string normalsTexture, const float scale = 1.0) { 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";} if (normalsTexture.empty()) {normalsTexture = ":/res/gl/tex/empty_normals.jpg";}