changed number of fingerprint scans

minor parameter changes
more log lines
added VAP log to UI (debug)
fixed missing wifi timestamp for android live data
This commit is contained in:
2016-09-28 15:29:25 +02:00
parent d47322e73b
commit 5ddc455bee
9 changed files with 31 additions and 12 deletions

View File

@@ -51,9 +51,9 @@ Controller::Controller() : sl(scaler) {
//SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "bergwerk/path3/nexus/vor/1454782562231.csv")); //SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "bergwerk/path3/nexus/vor/1454782562231.csv"));
//SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "/bergwerk/path4/nexus/rueck/1454776724285_rueck.csv")); //SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "/bergwerk/path4/nexus/rueck/1454776724285_rueck.csv"));
SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "/bergwerk/path4/nexus/vor/1454776525797.csv")); //SensorFactory::set(new SensorFactoryOffline(Settings::Data::getOfflineDir() + "/bergwerk/path4/nexus/vor/1454776525797.csv"));
// SensorFactory::set(new SensorFactoryAndroid()); SensorFactory::set(new SensorFactoryAndroid());
// SensorFactory::get().getAccelerometer().start(); // SensorFactory::get().getAccelerometer().start();
// SensorFactory::get().getGyroscope().start(); // SensorFactory::get().getGyroscope().start();
// SensorFactory::get().getBarometer().start(); // SensorFactory::get().getBarometer().start();

View File

@@ -13,7 +13,7 @@ namespace Settings {
namespace IMU { namespace IMU {
const float turnSigma = 1.5; // 3.5 const float turnSigma = 1.5; // 3.5
const float stepLength = 0.80; const float stepLength = 0.80;
const float stepSigma = 0.10; const float stepSigma = 0.20;
} }
const float smartphoneAboveGround = 1.3; const float smartphoneAboveGround = 1.3;
@@ -33,7 +33,7 @@ namespace Settings {
} }
namespace WiFiModel { namespace WiFiModel {
constexpr float sigma = 11.0; constexpr float sigma = 13.0;
/** if the wifi-signal-strengths are stored on the grid-nodes, this needs a grid rebuild! */ /** if the wifi-signal-strengths are stored on the grid-nodes, this needs a grid rebuild! */
constexpr float TXP = -48; constexpr float TXP = -48;
constexpr float EXP = 2.5; constexpr float EXP = 2.5;

View File

@@ -1,6 +1,7 @@
package indoor.java; package indoor.java;
import android.os.Bundle; import android.os.Bundle;
import android.view.WindowManager;
import org.qtproject.qt5.android.bindings.QtActivity; import org.qtproject.qt5.android.bindings.QtActivity;
public class MyActivity extends QtActivity { public class MyActivity extends QtActivity {
@@ -13,9 +14,13 @@ public class MyActivity extends QtActivity {
@Override @Override
public void onCreate(Bundle savedState) { public void onCreate(Bundle savedState) {
MyActivity.act = this; MyActivity.act = this;
super.onCreate(savedState); super.onCreate(savedState);
// prevent power-safe?
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// IPIN2016 // IPIN2016
stepLogger = new StepLoggerClient(this); stepLogger = new StepLoggerClient(this);

View File

@@ -50,7 +50,7 @@ public class WiFi {
// start the first scan // start the first scan
triggerOneScan(); triggerOneScan();
return 0; return 1337;
} }

View File

@@ -215,11 +215,14 @@ public:
const MyObservation observation = _observation; const MyObservation observation = _observation;
// vap-grouping // vap-grouping
const int numAP1 = observation.wifi.entries.size();
const WiFiMeasurements wifiObs = vg.group(_observation.wifi); const WiFiMeasurements wifiObs = vg.group(_observation.wifi);
const int numAP2 = wifiObs.entries.size();
Log::add("Filter", "VAP: " + std::to_string(numAP1) + " -> " + std::to_string(numAP2));
for (K::Particle<MyState>& p : particles) { for (K::Particle<MyState>& p : particles) {
// WiFi free // WiFi free
//const double pWiFi = wiFiProbability.getProbability(p.state.position.inMeter()+person, observation.currentTime, vg.group(observation.wifi)); //const double pWiFi = wiFiProbability.getProbability(p.state.position.inMeter()+person, observation.currentTime, vg.group(observation.wifi));
@@ -227,9 +230,12 @@ public:
const MyGridNode& node = grid->getNodeFor(p.state.position); const MyGridNode& node = grid->getNodeFor(p.state.position);
const double pWiFi = wiFiProbability.getProbability(node, observation.currentTime, wifiObs); const double pWiFi = wiFiProbability.getProbability(node, observation.currentTime, wifiObs);
//Log::add("xxx", std::to_string(observation.currentTime.ms()) + "_" + std::to_string(wifiObs.entries[0].ts.ms()));
const double pStair = getStairProb(p, observation.activity); const double pStair = getStairProb(p, observation.activity);
const double pGPS = 1; const double pGPS = 1;
const double prob = pWiFi * pGPS * pStair; const double prob = pWiFi * pGPS * pStair;
p.weight *= prob; // NOTE: keeps the weight returned by the transition step! p.weight *= prob; // NOTE: keeps the weight returned by the transition step!
//p.weight = prob; // does NOT keep the weights returned by the transition step //p.weight = prob; // does NOT keep the weights returned by the transition step
sum += p.weight; sum += p.weight;

View File

@@ -28,9 +28,12 @@ public:
void start() override { void start() override {
// do NOT start twice!
if (started) {return;}
// start scanning // start scanning
int res = QAndroidJniObject::callStaticMethod<int>("indoor/java/WiFi", "start", "()I"); int res = QAndroidJniObject::callStaticMethod<int>("indoor/java/WiFi", "start", "()I");
if (res != 0) {throw Exception("error while starting WiFi");} if (res != 1337) {throw Exception("error while starting WiFi");}
started = true; started = true;
} }
@@ -49,6 +52,9 @@ public:
// to-be-constructed sensor data // to-be-constructed sensor data
WiFiMeasurements sensorData; WiFiMeasurements sensorData;
// tag all scan-entries with the current app runtime
const Timestamp curTS = Timestamp::fromRunningTime();
// parse each mac->rssi entry // parse each mac->rssi entry
for (int i = 0; i < (int)data.length(); i += 17+1+2) { for (int i = 0; i < (int)data.length(); i += 17+1+2) {
const std::string bssid = data.substr(i, 17); const std::string bssid = data.substr(i, 17);
@@ -56,7 +62,7 @@ public:
const int8_t pad1 = data[i+18]; const int8_t pad1 = data[i+18];
const int8_t pad2 = data[i+19]; const int8_t pad2 = data[i+19];
if (pad1 != 0 || pad2 != 0) {Debug::error("padding error within WiFi scan result");} if (pad1 != 0 || pad2 != 0) {Debug::error("padding error within WiFi scan result");}
sensorData.entries.push_back(WiFiMeasurement(AccessPoint(bssid), rssi)); sensorData.entries.push_back(WiFiMeasurement(AccessPoint(bssid), rssi, curTS));
} }
// call listeners // call listeners

View File

@@ -28,7 +28,7 @@ private:
QProgressBar* barProg; QProgressBar* barProg;
struct Scan { struct Scan {
const int numRecords = 10; const int numRecords = 30;
int recordsDone = 0; int recordsDone = 0;
} scan; } scan;

View File

@@ -11,7 +11,7 @@ class LoggerUI : public Logger {
private: private:
InfoWidget* iw; InfoWidget* iw;
const int numLines = 5;
std::vector<QString> lines; std::vector<QString> lines;
public: public:
@@ -24,7 +24,7 @@ public:
void add(const std::string& str, const bool nl) override { void add(const std::string& str, const bool nl) override {
lines.back() += QString(str.c_str()); lines.back() += QString(str.c_str());
if (nl) {lines.push_back("");} if (nl) {lines.push_back("");}
while(lines.size() > 4) {lines.erase(lines.begin());} while(lines.size() > numLines) {lines.erase(lines.begin());}
QString qs = getStr(); QString qs = getStr();
QMetaObject::invokeMethod(iw, "showLog", Qt::QueuedConnection, Q_ARG(const QString&, qs)); QMetaObject::invokeMethod(iw, "showLog", Qt::QueuedConnection, Q_ARG(const QString&, qs));
QApplication::processEvents(); QApplication::processEvents();

View File

@@ -158,10 +158,12 @@ void MapView2D::mouseReleaseEvent(QMouseEvent* evt) {
const Point2 p1(evt->x(), evt->y()); const Point2 p1(evt->x(), evt->y());
// fingerprint node pressed?
const int fpSize = UIHelper::isLarge(this->parent()) ? (40) : (25);
int idx = 0; int idx = 0;
for (const Point2 p2 : wifiCalib->getNodes()) { for (const Point2 p2 : wifiCalib->getNodes()) {
const float dist = p1.getDistance(p2); const float dist = p1.getDistance(p2);
if (dist < 25) { wifiCalib->selectNode(idx); emit update(); break; } if (dist < fpSize) { wifiCalib->selectNode(idx); emit update(); break; }
++idx; ++idx;
} }