fixed some compiler warnings
added equality checks to sensor-data classes more robust sensor reader [fixed some issues] added support for gps added support for compass added sensor-data-writer added test-cases minor changes
This commit is contained in:
@@ -20,7 +20,7 @@ private:
|
||||
float rssi;
|
||||
|
||||
/** OPTIONAL. frequence the signal was received */
|
||||
float freq;
|
||||
float freq = NAN;
|
||||
|
||||
/** OPTIONAL. timestamp the measurement was recorded at */
|
||||
Timestamp ts;
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
WiFiMeasurement(const AccessPoint& ap, const float rssi) : ap(ap), rssi(rssi) {
|
||||
WiFiMeasurement(const AccessPoint& ap, const float rssi) : ap(ap), rssi(rssi), freq(NAN) {
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,15 @@ namespace WiFiOptimizer {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/** we add some constraints to the parameter range */
|
||||
bool outOfRange() const {
|
||||
return (waf > 0) ||
|
||||
(txp < -50) ||
|
||||
(txp > -30) ||
|
||||
(exp > 4) ||
|
||||
(exp < 1);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** add MAC-info to params */
|
||||
@@ -136,17 +145,17 @@ namespace WiFiOptimizer {
|
||||
return false;
|
||||
};
|
||||
|
||||
const APFilter MIN_8_FPS = [] (const int numFingerprints, const MACAddress& mac) {
|
||||
const APFilter MIN_5_FPS = [] (const int numFingerprints, const MACAddress& mac) {
|
||||
(void) mac;
|
||||
return numFingerprints < 8;
|
||||
return numFingerprints < 5;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Mode mode = Mode::QUALITY;
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
|
||||
Mode mode = Mode::QUALITY;
|
||||
|
||||
const char* name = "WiFiOptLDC";
|
||||
|
||||
public:
|
||||
@@ -182,6 +191,7 @@ namespace WiFiOptimizer {
|
||||
}
|
||||
|
||||
const float avgErr = errSum / errCnt;
|
||||
Log::add(name, "optimized APs: " + std::to_string(errCnt));
|
||||
Log::add(name, "average AP error is: " + std::to_string(avgErr) + " dB");
|
||||
|
||||
// done
|
||||
@@ -189,6 +199,7 @@ namespace WiFiOptimizer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** optimize the given AP */
|
||||
APParams optimize(const MACAddress& mac, Stats& res) const {
|
||||
|
||||
@@ -210,8 +221,8 @@ namespace WiFiOptimizer {
|
||||
LeOpt::MinMax(mapBBox.getMin().x - 20, mapBBox.getMax().x + 20), // x
|
||||
LeOpt::MinMax(mapBBox.getMin().y - 20, mapBBox.getMax().y + 20), // y
|
||||
LeOpt::MinMax(mapBBox.getMin().z - 5, mapBBox.getMax().z + 5), // z
|
||||
LeOpt::MinMax(-50, -30), // txp
|
||||
LeOpt::MinMax(1, 5), // exp
|
||||
LeOpt::MinMax(-50, -30), // txp
|
||||
LeOpt::MinMax(1, 4), // exp
|
||||
LeOpt::MinMax(-15, -0), // waf
|
||||
};
|
||||
|
||||
@@ -271,17 +282,10 @@ namespace WiFiOptimizer {
|
||||
|
||||
float getErrorLogDistCeiling(const MACAddress& mac, const std::vector<RSSIatPosition>& entries, const float* data, Stats* stats = nullptr) const {
|
||||
|
||||
constexpr float hugeError = 1e10;
|
||||
const APParams* params = (APParams*) data;
|
||||
|
||||
// some sanity checks
|
||||
if (params->waf > 0) {return hugeError;}
|
||||
|
||||
if (params->txp < -50) {return hugeError;}
|
||||
if (params->txp > -30) {return hugeError;}
|
||||
|
||||
if (params->exp > 4) {return hugeError;}
|
||||
if (params->exp < 1) {return hugeError;}
|
||||
if (params->outOfRange()) {return 1e10;}
|
||||
|
||||
// current position guess for the AP;
|
||||
const Point3 apPos_m = params->getPos();
|
||||
@@ -309,7 +313,7 @@ namespace WiFiOptimizer {
|
||||
}
|
||||
|
||||
// adjust the error
|
||||
err += diff*diff;
|
||||
err += std::pow(std::abs(diff), 2.0);
|
||||
++cnt;
|
||||
|
||||
// max distance penality
|
||||
|
||||
Reference in New Issue
Block a user