fixed some minor bugs using ble on android
added BLE to the evaluation of the particle filter made first evaluation inside fhws
This commit is contained in:
@@ -250,10 +250,52 @@ WiFiModel* buildWiFiModelOnce(Floorplan::IndoorMap* map, const std::string& fpFi
|
||||
BeaconModel* buildBLEModelOnce(Floorplan::IndoorMap* map, const std::string& fpFile, const std::string& bleModelFile){
|
||||
|
||||
// ask questions
|
||||
const QMessageBox::StandardButton replyWiFiFP = QMessageBox::question(nullptr, "BLE", "Use Fingerprints for Bluetooth Calibration?\n\nYes: Use fingerprints and num-optimize AP-Params\nNo: Use Beacons from the map.xml (pos+params)", QMessageBox::Yes|QMessageBox::No);
|
||||
const QMessageBox::StandardButton replyBLEFP = QMessageBox::question(nullptr, "BLE", "Use Fingerprints for Bluetooth Calibration?\n\nYes: Use fingerprints and num-optimize AP-Params\nNo: Use Beacons from the map.xml (pos+params)", QMessageBox::Yes|QMessageBox::No);
|
||||
|
||||
BeaconModel* bleModel = new BeaconModelLogDistCeiling(map);
|
||||
|
||||
// WiFi setup
|
||||
if (replyBLEFP == QMessageBox::Yes) {
|
||||
|
||||
std::ifstream inp(bleModelFile, std::ifstream::binary);
|
||||
|
||||
if (!inp.good() || (inp.peek()&&0) || inp.eof()) {
|
||||
|
||||
Log::add("Controller", "Create new BLEModel");
|
||||
BLECalibrationDataModel mdl(fpFile);
|
||||
Assert::isFalse(mdl.getFingerprints().empty(), "no fingerprints available!");
|
||||
WiFiOptimizer::LogDistCeiling opt(map, Settings::WiFiModel::vg_calib);
|
||||
for (const BeaconFingerprint& fp : mdl.getFingerprints()) {
|
||||
opt.addFingerprint(fp); //we added a function to add bluetooth fingerprints to the wifi optimizer
|
||||
}
|
||||
|
||||
const WiFiOptimizer::LogDistCeiling::APParamsList res = opt.optimizeAll(opt.MIN_10_FPS);
|
||||
for (const WiFiOptimizer::LogDistCeiling::APParamsMAC& ap : res.get()) {
|
||||
const BeaconModelLogDistCeiling::APEntry entry(ap.params.getPos(), ap.params.txp, ap.params.exp, ap.params.waf);
|
||||
((BeaconModelLogDistCeiling*) bleModel)->addBeacon(ap.mac, entry);
|
||||
}
|
||||
|
||||
((BeaconModelLogDistCeiling*) bleModel)->saveXML(bleModelFile);
|
||||
|
||||
} else {
|
||||
|
||||
Log::add("Controller", "Use existing BLEModel");
|
||||
XMLDoc doc;
|
||||
XMLserialize::assertOK(doc.LoadFile(bleModelFile.c_str()), doc, "error while loading file");
|
||||
XMLElem* root = doc.FirstChildElement("root");
|
||||
|
||||
//if(bleModel){delete bleModel;}
|
||||
bleModel->readFromXML(&doc, root);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Log::add("Controller", "Read Beacons from File");
|
||||
// load all APs from the floorplan and use same TXP/EXP/WAF for all of them
|
||||
((BeaconModelLogDistCeiling*)bleModel)->loadBeaconsFromMap(map, Settings::BLEModel::TXP, Settings::BLEModel::EXP, Settings::BLEModel::WAF);
|
||||
Assert::isFalse(bleModel->getAllBeacons().empty(), "no AccessPoints stored within the map.xml");
|
||||
}
|
||||
|
||||
return bleModel;
|
||||
|
||||
}
|
||||
@@ -340,6 +382,7 @@ void Controller::loadNavMesh(QDir dir) {
|
||||
QFile fWiFiFP(dir.path() + "/wifi_fp.dat");
|
||||
QFile fWiFiModel(dir.path() + "/wifimodel.dat");
|
||||
QFile fBLEFP(dir.path() + "/ble_fp.dat");
|
||||
QFile fBLEModel(dir.path() + "/blemodel.dat");
|
||||
|
||||
Assert::isTrue(fMap.exists(), "map.xml missing");
|
||||
|
||||
@@ -347,12 +390,16 @@ void Controller::loadNavMesh(QDir dir) {
|
||||
QString str = QString(fMap.readAll());
|
||||
im = Floorplan::Reader::readFromString(str.toStdString());
|
||||
|
||||
//build the wifi model
|
||||
const std::string sWiFiFP = fWiFiFP.fileName().toStdString();
|
||||
const std::string sWiFiModel = fWiFiModel.fileName().toStdString();
|
||||
const std::string sBLEFP = fBLEFP.fileName().toStdString();
|
||||
|
||||
wifiModel = buildWiFiModelOnce(im, sWiFiFP, sWiFiModel);
|
||||
|
||||
//build the ble model
|
||||
const std::string sBLEFP = fBLEFP.fileName().toStdString();
|
||||
const std::string sBLEModel = fBLEModel.fileName().toStdString();
|
||||
bleModel = buildBLEModelOnce(im, sBLEFP, sBLEModel);
|
||||
|
||||
// create navmesh
|
||||
if (navMesh) {delete navMesh; navMesh = nullptr;}
|
||||
NM::NavMeshSettings settings;
|
||||
@@ -362,7 +409,7 @@ void Controller::loadNavMesh(QDir dir) {
|
||||
|
||||
// create a new navigator
|
||||
if (nav) {delete nav; nav = nullptr;}
|
||||
nav = new MeshBased::NavControllerMesh(this, im, navMesh, wifiModel);
|
||||
nav = new MeshBased::NavControllerMesh(this, im, navMesh, wifiModel, bleModel);
|
||||
|
||||
WiFiCalibrationDataModel* wifiCalib = new WiFiCalibrationDataModel(sWiFiFP);
|
||||
BLECalibrationDataModel* bleCalib = new BLECalibrationDataModel(sBLEFP);
|
||||
|
||||
Reference in New Issue
Block a user