fixed fallback step-logger
moved vap-grouping to settings-file sanity-checks
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "nav/NavController.h"
|
#include "nav/NavController.h"
|
||||||
|
|
||||||
Controller::Controller() : sl(scaler) {
|
Controller::Controller() {
|
||||||
|
|
||||||
// OpenGL setup
|
// OpenGL setup
|
||||||
// MUST happen before anything gets visible (= gets initialized)
|
// MUST happen before anything gets visible (= gets initialized)
|
||||||
@@ -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();
|
||||||
@@ -62,6 +62,9 @@ Controller::Controller() : sl(scaler) {
|
|||||||
|
|
||||||
// create the main window
|
// create the main window
|
||||||
mainWindow = new MainWindow();
|
mainWindow = new MainWindow();
|
||||||
|
sl = new StepLoggerWrapperAndroid(scaler);
|
||||||
|
//sl = new StepLoggerWrapper(scaler, mainWindow);
|
||||||
|
|
||||||
|
|
||||||
// attach logger
|
// attach logger
|
||||||
LoggerComposite* log = new LoggerComposite();
|
LoggerComposite* log = new LoggerComposite();
|
||||||
@@ -120,10 +123,10 @@ void buildGridOnce(Grid<MyGridNode>* grid, Floorplan::IndoorMap* map, const std:
|
|||||||
// WiFi setup
|
// WiFi setup
|
||||||
WiFiModelLogDistCeiling wifiModel(map);
|
WiFiModelLogDistCeiling wifiModel(map);
|
||||||
if (replyWiFiFP == QMessageBox::Yes) {
|
if (replyWiFiFP == QMessageBox::Yes) {
|
||||||
VAPGrouper vg(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE);
|
|
||||||
WiFiCalibrationDataModel mdl(fpFile);
|
WiFiCalibrationDataModel mdl(fpFile);
|
||||||
Assert::isFalse(mdl.getFingerprints().empty(), "no fingerprints available!");
|
Assert::isFalse(mdl.getFingerprints().empty(), "no fingerprints available!");
|
||||||
WiFiOptimizer opt(map, vg);
|
WiFiOptimizer opt(map, Settings::WiFiModel::vg_calib);
|
||||||
for (const WiFiFingerprint& fp : mdl.getFingerprints()) {
|
for (const WiFiFingerprint& fp : mdl.getFingerprints()) {
|
||||||
opt.addFingerprint(fp);
|
opt.addFingerprint(fp);
|
||||||
}
|
}
|
||||||
@@ -135,8 +138,11 @@ void buildGridOnce(Grid<MyGridNode>* grid, Floorplan::IndoorMap* map, const std:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// NOTE IPIN UAH map does not make sense.. APs look like VAPs but are not
|
||||||
|
// -> 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::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF);
|
wifiModel.loadAPs(map, Settings::WiFiModel::vg_calib, 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");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -227,7 +233,7 @@ void Controller::onLoadButton() {
|
|||||||
getMapView3D()->setVisible(false);
|
getMapView3D()->setVisible(false);
|
||||||
|
|
||||||
// attach ipin step logger
|
// attach ipin step logger
|
||||||
nav->addListener(&sl);
|
nav->addListener(sl);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ protected:
|
|||||||
|
|
||||||
// scaling for the UAH building
|
// scaling for the UAH building
|
||||||
IPINScaler scaler = IPINScaler(1869, 1869, 40.51312440, -3.34959080, -40.73112000, 0.07596002);
|
IPINScaler scaler = IPINScaler(1869, 1869, 40.51312440, -3.34959080, -40.73112000, 0.07596002);
|
||||||
//StepLoggerWrapper sl;
|
|
||||||
StepLoggerWrapperAndroid sl;
|
//StepLoggerWrapper* sl = nullptr;
|
||||||
|
StepLoggerWrapperAndroid* sl = nullptr;
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
17
Settings.h
17
Settings.h
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <Indoor/grid/GridPoint.h>
|
#include <Indoor/grid/GridPoint.h>
|
||||||
#include <Indoor/data/Timestamp.h>
|
#include <Indoor/data/Timestamp.h>
|
||||||
|
#include <Indoor/sensors/radio/VAPGrouper.h>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
@@ -25,6 +26,9 @@ namespace Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//const GridPoint destination = GridPoint(70*100, 35*100, 0*100); // use destination
|
//const GridPoint destination = GridPoint(70*100, 35*100, 0*100); // use destination
|
||||||
const GridPoint destination = GridPoint(0,0,0); // do not use destination
|
const GridPoint destination = GridPoint(0,0,0); // do not use destination
|
||||||
|
|
||||||
@@ -33,11 +37,21 @@ namespace Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace WiFiModel {
|
namespace WiFiModel {
|
||||||
|
|
||||||
constexpr float sigma = 13.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;
|
||||||
constexpr float WAF = -5.0;
|
constexpr float WAF = -5.0;
|
||||||
|
|
||||||
|
// how to perform VAP grouping. see
|
||||||
|
// - calibration in Controller.cpp
|
||||||
|
// - eval in Filter.h
|
||||||
|
// 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +85,8 @@ namespace Settings {
|
|||||||
if (QFile(f2.c_str()).exists()) {return f2;}
|
if (QFile(f2.c_str()).exists()) {return f2;}
|
||||||
throw Exception("data folder missing");
|
throw Exception("data folder missing");
|
||||||
#else
|
#else
|
||||||
return "/home/toni/Documents/programme/localization/YASMIN/YASMIN_DATA/";
|
//return "/home/toni/Documents/programme/localization/YASMIN/YASMIN_DATA/";
|
||||||
|
return "/apps/android/workspace/YASMIN_DATA/";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "IPINHelper.h"
|
#include "IPINHelper.h"
|
||||||
|
|
||||||
|
#include <Indoor/Exception.h>
|
||||||
|
|
||||||
class EvalConfig {
|
class EvalConfig {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -31,9 +33,10 @@ public:
|
|||||||
/** load the given configuration file */
|
/** load the given configuration file */
|
||||||
void load(const std::string& file) {
|
void load(const std::string& file) {
|
||||||
|
|
||||||
|
|
||||||
std::ifstream inp(file);
|
std::ifstream inp(file);
|
||||||
|
|
||||||
if (!inp.good()) {throw "error while opening config file " + file;}
|
if (!inp.good()) {throw Exception("error while opening config file " + file);}
|
||||||
|
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
@@ -78,7 +81,7 @@ private:
|
|||||||
|
|
||||||
// split key and value
|
// split key and value
|
||||||
const size_t pos = line.find(" = ");
|
const size_t pos = line.find(" = ");
|
||||||
if (pos == std::string::npos) {throw "something wrong";}
|
if (pos == std::string::npos) {throw Exception("something wrong");}
|
||||||
|
|
||||||
const std::string key = line.substr(0, pos);
|
const std::string key = line.substr(0, pos);
|
||||||
const std::string val = line.substr(pos+3);
|
const std::string val = line.substr(pos+3);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ public:
|
|||||||
static std::string getDataFolder() {
|
static std::string getDataFolder() {
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
return getenv("DIRECTORY_DOWNLOADS");
|
//return std::string(getenv("DIRECTORY_DOWNLOADS")) + "/";
|
||||||
|
return "/sdcard/Download/";
|
||||||
#else
|
#else
|
||||||
return "/apps/android/workspace/YASMIN_DATA/";
|
return "/apps/android/workspace/YASMIN_DATA/";
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
void onButtonPress() {
|
void onButtonPress() {
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (isDone()) {throw "all waypoints were processed";}
|
if (isDone()) {throw Exception("all waypoints were processed");}
|
||||||
|
|
||||||
// construct output string
|
// construct output string
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@@ -142,8 +142,8 @@ private:
|
|||||||
const std::string fPos = folder + "positions.log";
|
const std::string fPos = folder + "positions.log";
|
||||||
|
|
||||||
// open two output files
|
// open two output files
|
||||||
outButtons.open(fBtn); if (!outButtons.good()) {throw "error while creating file";}
|
outButtons.open(fBtn); if (!outButtons.good()) {throw Exception("error while creating file");}
|
||||||
outPositions.open(fPos); if (!outPositions.good()) {throw "error while creating file";}
|
outPositions.open(fPos); if (!outPositions.good()) {throw Exception("error while creating file");}
|
||||||
|
|
||||||
// reset current WayPoint
|
// reset current WayPoint
|
||||||
curWP = 0;
|
curWP = 0;
|
||||||
|
|||||||
@@ -6,10 +6,15 @@
|
|||||||
#include "../nav/NavControllerListener.h"
|
#include "../nav/NavControllerListener.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include <Indoor/data/Timestamp.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* helper class to connect our NavigationController with the StepLogger
|
* helper class to connect our NavigationController with the StepLogger
|
||||||
@@ -21,13 +26,17 @@ private:
|
|||||||
/** convert from our position-format to ipin position-format */
|
/** convert from our position-format to ipin position-format */
|
||||||
IPINScaler& scaler;
|
IPINScaler& scaler;
|
||||||
|
|
||||||
QMainWindow* window;
|
QWidget* widget = nullptr;
|
||||||
QPushButton* btn;
|
QPushButton* btn = nullptr;
|
||||||
|
QLabel* lblInfo = nullptr;
|
||||||
|
QWidget* parent;// = nullptr;
|
||||||
|
int cnt = 0;
|
||||||
|
Timestamp lastEstTS;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** ctor */
|
/** ctor */
|
||||||
StepLoggerWrapper(IPINScaler& scaler) : scaler(scaler) {
|
StepLoggerWrapper(IPINScaler& scaler, QWidget* parent) : scaler(scaler), parent(parent) {
|
||||||
setupUI();
|
setupUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +53,12 @@ public:
|
|||||||
// inform the logger
|
// inform the logger
|
||||||
StepLogger::onNewEstimation(ipin.lat, ipin.lon, ipin.floorNr);
|
StepLogger::onNewEstimation(ipin.lat, ipin.lon, ipin.floorNr);
|
||||||
|
|
||||||
|
++cnt;
|
||||||
|
const Timestamp curTS = Timestamp::fromUnixTime();
|
||||||
|
const Timestamp diff = curTS - lastEstTS;
|
||||||
|
lastEstTS = curTS;
|
||||||
|
lblInfo->setText("Est: " + QString::number(cnt) + " time: " + QString::number(diff.ms()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -51,23 +66,43 @@ private:
|
|||||||
/** create a clickable check button */
|
/** create a clickable check button */
|
||||||
void setupUI() {
|
void setupUI() {
|
||||||
|
|
||||||
window = new QMainWindow();
|
|
||||||
//window->setTitle("StepLogger");
|
|
||||||
btn = new QPushButton(window);
|
|
||||||
|
|
||||||
// almost fullscreen
|
// almost fullscreen
|
||||||
QRect geom = QDesktopWidget().availableGeometry();
|
QRect geom = QDesktopWidget().availableGeometry();
|
||||||
const int w = geom.width() * 0.9;
|
const int w = std::min(geom.width(), geom.height()) * 0.4;
|
||||||
const int h = geom.height() * 0.6;
|
const int h = w;
|
||||||
|
|
||||||
|
/*
|
||||||
|
window = new QDialog();
|
||||||
|
|
||||||
// center and set always-on-top
|
// center and set always-on-top
|
||||||
window->setGeometry(geom.width()/2 - w/2, geom.height()/2 - h/2, w, h);
|
window->setGeometry(geom.width()*0.7 - w/2, geom.height()*0.7 - h/2, w, h);
|
||||||
const Qt::WindowFlags flags = window->windowFlags();
|
const Qt::WindowFlags flags = window->windowFlags();
|
||||||
window->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
window->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
|
|
||||||
|
btn = new QPushButton(window);
|
||||||
btn->setGeometry(5,5,w-5-5,h-5-5);
|
btn->setGeometry(5,5,w-5-5,h-5-5);
|
||||||
window->show();
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
widget = new QWidget(parent);
|
||||||
|
widget->setGeometry(geom.width() - w - 5, geom.height()*0.85 - h, w, h);
|
||||||
|
widget->setWindowFlags(widget->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
|
widget->setVisible(true);
|
||||||
|
|
||||||
|
QGridLayout* lay = new QGridLayout(widget);
|
||||||
|
|
||||||
|
btn = new QPushButton();
|
||||||
|
btn->setMinimumSize(w-10, h*0.8);
|
||||||
|
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
btn->setWindowFlags(btn->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
|
lay->addWidget(btn, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
lblInfo = new QLabel();
|
||||||
|
lblInfo->setMinimumHeight(32); lblInfo->setMaximumHeight(32);
|
||||||
|
lblInfo->setText("123");
|
||||||
|
lay->addWidget(lblInfo, 1, 0, 1, 1);
|
||||||
|
|
||||||
// button clicked -> next waypoint
|
// button clicked -> next waypoint
|
||||||
btn->connect(btn, &QPushButton::clicked, [&] () {
|
btn->connect(btn, &QPushButton::clicked, [&] () {
|
||||||
@@ -78,6 +113,11 @@ private:
|
|||||||
// show the current waypoint
|
// show the current waypoint
|
||||||
updateButton();
|
updateButton();
|
||||||
|
|
||||||
|
// //window->exec();
|
||||||
|
// window->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
// window->setAttribute(Qt::WA_AcceptTouchEvents, true);
|
||||||
|
// window->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** update the current button label */
|
/** update the current button label */
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
|
|
||||||
double rounded_z = std::round(z);
|
double rounded_z = std::round(z);
|
||||||
int res = QAndroidJniObject::callStaticMethod<int>("indoor/java/StepLoggerClient", "log", "(DDD)I", x, y, rounded_z);
|
int res = QAndroidJniObject::callStaticMethod<int>("indoor/java/StepLoggerClient", "log", "(DDD)I", x, y, rounded_z);
|
||||||
//if (res != 1337) {throw Exception("invalid return code while sending the current position to StepLogger.\nService Down?");}
|
if (res != 1337) {throw Exception("invalid return code while sending the current position to StepLogger.\nService Down?");}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,9 +154,6 @@ class PFEval : public K::ParticleFilterEvaluation<MyState, MyObservation> {
|
|||||||
//WiFiObserverFree wiFiProbability; // free-calculation
|
//WiFiObserverFree wiFiProbability; // free-calculation
|
||||||
WiFiObserverGrid<MyGridNode> wiFiProbability; // grid-calculation
|
WiFiObserverGrid<MyGridNode> wiFiProbability; // grid-calculation
|
||||||
|
|
||||||
// how to perform VAP grouping. also see calibration in Controller.cpp
|
|
||||||
VAPGrouper vg = VAPGrouper(VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO, VAPGrouper::Aggregation::AVERAGE);
|
|
||||||
|
|
||||||
// smartphone is 1.3 meter above ground
|
// smartphone is 1.3 meter above ground
|
||||||
const Point3 person = Point3(0,0,Settings::smartphoneAboveGround);
|
const Point3 person = Point3(0,0,Settings::smartphoneAboveGround);
|
||||||
|
|
||||||
@@ -203,7 +200,7 @@ public:
|
|||||||
|
|
||||||
// vap-grouping
|
// vap-grouping
|
||||||
const int numAP1 = observation.wifi.entries.size();
|
const int numAP1 = observation.wifi.entries.size();
|
||||||
const WiFiMeasurements wifiObs = vg.group(_observation.wifi);
|
const WiFiMeasurements wifiObs = Settings::WiFiModel::vg_eval.group(_observation.wifi);
|
||||||
const int numAP2 = wifiObs.entries.size();
|
const int numAP2 = wifiObs.entries.size();
|
||||||
|
|
||||||
Log::add("Filter", "VAP: " + std::to_string(numAP1) + " -> " + std::to_string(numAP2));
|
Log::add("Filter", "VAP: " + std::to_string(numAP1) + " -> " + std::to_string(numAP2));
|
||||||
|
|||||||
Reference in New Issue
Block a user