added nav-mesh support via demo

This commit is contained in:
k-a-z-u
2018-01-24 11:26:26 +01:00
parent f4c598299f
commit de2570cc0c
6 changed files with 810 additions and 475 deletions

View File

@@ -41,14 +41,15 @@ FILE(GLOB SOURCES
./*/*.cpp
./*/*/*.cpp
./*/*/*/*.cpp
../../Indoor/lib/tinyxml/tinyxml2.cpp
../Indoor/lib/tinyxml/tinyxml2.cpp
../Indoor/lib/Recast/*.cpp
)
# system specific compiler flags
ADD_DEFINITIONS(
-std=gnu++11
#-std=gnu++14
-Wall
-Werror=return-type
@@ -58,7 +59,7 @@ ADD_DEFINITIONS(
-fstack-protector-all
-g3
-O2
# -O2
-march=native
-DWITH_TESTS

474
main.cpp
View File

@@ -1,479 +1,9 @@
#include <iostream>
#include "filter/Structs.h"
#include "filter/KLB.h"
#include "Plotti.h"
#include "filter/Logic.h"
#include "Settings.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <Indoor/sensors/radio/model/WiFiModelFactory.h>
#include <Indoor/sensors/radio/model/WiFiModelFactoryImpl.h>
#include <Indoor/math/stats/Statistics.h>
#include <Indoor/smc/smoothing/ForwardFilterHistory.h>
#include <Indoor/smc/smoothing/FastKDESmoothing.h>
//frank
//const std::string mapDir = "/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/";
//const std::string dataDir = "/mnt/data/workspaces/IPIN2016/IPIN2016/competition/src/data/";
//toni
const std::string mapDir = "/home/toni/Documents/programme/localization/IndoorMap/maps/";
//const std::string dataDir = "/home/toni/Documents/programme/localization/DynLag/code/data/";
const std::string dataDir = "/home/toni/Documents/programme/localization/museum/measurements/shl/";
//const std::string dataDir = "/home/toni/Documents/programme/localization/museum/measurements/motionAxisTest/";
const std::string errorDir = dataDir + "results/";
/** describes one dataset (map, training, parameter-estimation, ...) */
struct DataSetup {
std::string map;
std::vector<std::string> training;
std::string wifiParams;
int minWifiOccurences;
VAPGrouper::Mode vapMode;
std::string grid;
};
/** all configured datasets */
struct Data {
DataSetup SecondFloorOnly = {
mapDir + "SHL_Stock_2_01.xml",
{
dataDir + "Path1_1.csv",
dataDir + "Path2_1.csv",
dataDir + "Path3_1.csv",
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_Stock_2_01.dat"
};
DataSetup FloorOneToThree = {
mapDir + "SHL_Stock_1-3_03.xml",
{
dataDir + "Path4_0.csv",
dataDir + "Path5_0.csv",
dataDir + "Path6_0.csv",
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_Stock_1-3_03.dat"
};
DataSetup MotionAxisTest = {
mapDir + "SHL40_noElevator.xml",
{
dataDir + "Path0_0.csv"
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_SHL40_noElevator.dat"
};
} data;
Floorplan::IndoorMap* MyState::map;
Stats::Statistics<float> run(DataSetup setup, int numFile, std::string folder, std::vector<int> gtPath) {
std::vector<double> kld_data;
// load the floorplan
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(setup.map);
MyState::map = map;
WiFiModelLogDistCeiling WiFiModel(map);
WiFiModel.loadAPs(map, Settings::WiFiModel::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF);
Assert::isFalse(WiFiModel.getAllAPs().empty(), "no AccessPoints stored within the map.xml");
//Wi-Fi model new
// WiFiModelFactory factory(map);
// WiFiModel* wifimodel= factory.loadXML("/home/toni/Documents/programme/localization/data/wifi/model/eachOptParPos_multimodel.xml");
// Assert::isFalse(wifimodel->getAllAPs().empty(), "no AccessPoints stored within the map.xml");
BeaconModelLogDistCeiling beaconModel(map);
beaconModel.loadBeaconsFromMap(map, Settings::BeaconModel::TXP, Settings::BeaconModel::EXP, Settings::BeaconModel::WAF);
//Assert::isFalse(beaconModel.getAllBeacons().empty(), "no Beacons stored within the map.xml");
// build the grid
std::ifstream inp(setup.grid, std::ifstream::binary);
Grid<MyNode> grid(Settings::Grid::gridSize_cm);
// grid.dat empty? -> build one and save it
if (!inp.good() || (inp.peek()&&0) || inp.eof()) {
std::ofstream onp;
onp.open(setup.grid);
GridFactory<MyNode> factory(grid);
factory.build(map);
// add node-importance
Importance::addImportance(grid);
grid.write(onp);
} else {
grid.read(inp);
}
// stamp WiFi signal-strengths onto the grid
WiFiGridEstimator::estimate(grid, WiFiModel, Settings::smartphoneAboveGround);
// reading file
Offline::FileReader fr(setup.training[numFile]);
//interpolator for ground truth
Interpolator<uint64_t, Point3> gtInterpolator = fr.getGroundTruthPath(map, gtPath);
//gnuplot plot
Plotti plot;
plot.addFloors(map);
plot.addOutline(map);
plot.addStairs(map);
plot.gp << "set autoscale xy\n";
//plot.addGrid(grid);
plot.splot.getView().setEnabled(false);
// init ctrl and observation
MyControl ctrl;
ctrl.resetAfterTransition();
MyObs obs;
//History of all estimated particles. Used for smoothing
SMC::ForwardFilterHistory<MyState, MyControl, MyObs> pfHistory;
//filter init
SMC::ParticleFilterHistory<MyState, MyControl, MyObs> pf(Settings::numParticles, std::unique_ptr<PFInit>(new PFInit(grid)));
//SMC::ParticleFilterHistory<MyState, MyControl, MyObs> pf(Settings::numParticles, std::unique_ptr<PFInitFixed>(new PFInitFixed(grid, GridPoint(55.5f * 100.0, 43.7f * 100.0, 740.0f), 180.0f)));
pf.setTransition(std::unique_ptr<PFTrans>(new PFTrans(grid, &ctrl)));
//pf.setTransition(std::unique_ptr<PFTransKLDSampling>(new PFTransKLDSampling(grid, &ctrl)));
//pf.setTransition(std::unique_ptr<PFTransSimple>(new PFTransSimple(grid)));
pf.setEvaluation(std::unique_ptr<PFEval>(new PFEval(WiFiModel, beaconModel, grid)));
//resampling
if(Settings::useKLB){
pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingDivergence<MyState>>(new SMC::ParticleFilterResamplingDivergence<MyState>()));
} else {
pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingSimple<MyState>>(new SMC::ParticleFilterResamplingSimple<MyState>()));
//pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingPercent<MyState>>(new SMC::ParticleFilterResamplingPercent<MyState>(0.4)));
//pf.setResampling(std::unique_ptr<NodeResampling<MyState, MyNode>>(new NodeResampling<MyState, MyNode>(*grid)););
//pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingKLD<MyState>>(new SMC::ParticleFilterResamplingKLD<MyState>()));
}
pf.setNEffThreshold(0.95);
//estimation
pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationWeightedAverage<MyState>()));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.5)));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationKernelDensity<MyState, 3>>(new SMC::ParticleFilterEstimationKernelDensity<MyState, 3>()));
/** Smoothing Init */
SMC::FastKDESmoothing<MyState, MyControl, MyObs> bf(Settings::numParticles, map, Settings::Grid::gridSize_cm, Settings::KDE::bandwidth);
if(Settings::Smoothing::activated){
//create the backward smoothing filter
bf.setSampler( std::unique_ptr<SMC::CumulativeSampler<MyState>>(new SMC::CumulativeSampler<MyState>()));
bool smoothing_resample = false;
//bf->setNEffThreshold(1.0);
if(smoothing_resample)
bf.setResampling( std::unique_ptr<SMC::ParticleFilterResamplingSimple<MyState>>(new SMC::ParticleFilterResamplingSimple<MyState>()) );
//bf.setTransition(std::unique_ptr<BFTrans>( new BFTrans) );
bf.setTransition(std::unique_ptr<PFTrans>(new PFTrans(grid, &ctrl)));
//Smoothing estimation
bf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationWeightedAverage<MyState>()));
//bf->setEstimation( std::unique_ptr<SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
//bf->setEstimation( std::unique_ptr<SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.50f)));
}
Timestamp lastTimestamp = Timestamp::fromMS(0);
StepDetection sd;
PoseDetection pd;
TurnDetection td(&pd);
MotionDetection md;
ActivityButterPressure act;
//ActivityDetector act;
RelativePressure relBaro;
relBaro.setCalibrationTimeframe( Timestamp::fromMS(5000) );
Stats::Statistics<float> errorStats;
Stats::Statistics<float> errorStatsSmoothing;
//file writing for error data
const long int t = static_cast<long int>(time(NULL));
const std::string evalDir = errorDir + folder + std::to_string(t);
if(mkdir(evalDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1){
Assert::doThrow("Eval folder couldn't be created!");
}
std::ofstream errorFile;
errorFile.open (evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + ".csv");
std::ofstream errorFileSmoothing;
errorFileSmoothing.open (evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + "_Smoothing.csv");
// parse each sensor-value within the offline data
for (const Offline::Entry& e : fr.getEntries()) {
const Timestamp ts = Timestamp::fromMS(e.ts);
if (e.type == Offline::Sensor::WIFI) {
obs.wifi = fr.getWiFiGroupedByTime()[e.idx].data;
} else if (e.type == Offline::Sensor::BEACON){
obs.beacons.entries.push_back(fr.getBeacons()[e.idx].data);
// remove to old beacon measurements
obs.beacons.removeOld(ts);
} else if (e.type == Offline::Sensor::ACC) {
if (sd.add(ts, fr.getAccelerometer()[e.idx].data)) {
++ctrl.numStepsSinceLastTransition;
}
const Offline::TS<AccelerometerData>& _acc = fr.getAccelerometer()[e.idx];
pd.addAccelerometer(ts, _acc.data);
} else if (e.type == Offline::Sensor::GYRO) {
const Offline::TS<GyroscopeData>& _gyr = fr.getGyroscope()[e.idx];
const float delta_gyro = td.addGyroscope(ts, _gyr.data);
ctrl.turnSinceLastTransition_rad += delta_gyro;
} else if (e.type == Offline::Sensor::BARO) {
relBaro.add(ts, fr.getBarometer()[e.idx].data);
obs.relativePressure = relBaro.getPressureRealtiveToStart();
obs.sigmaPressure = relBaro.getSigma();
//activity recognition
act.add(ts, fr.getBarometer()[e.idx].data);
obs.activity = act.get();
//activity for transition
} else if (e.type == Offline::Sensor::LIN_ACC) {
md.addLinearAcceleration(ts, fr.getLinearAcceleration()[e.idx].data);
} else if (e.type == Offline::Sensor::GRAVITY) {
md.addGravity(ts, fr.getGravity()[e.idx].data);
Eigen::Vector2f curVec = md.getCurrentMotionAxis();
ctrl.motionDeltaAngle_rad = md.getMotionChangeInRad();
}
if (ts.ms() - lastTimestamp.ms() > 500) {
/** filtering stuff */
obs.currentTime = ts;
MyState est = pf.update(&ctrl, obs);
Point3 estPos = est.position.inMeter();
Point3 gtPos = gtInterpolator.get(static_cast<uint64_t>(ts.ms()));
/** plotting stuff */
plot.pInterest.clear();
plot.setEst(estPos);
plot.setGT(gtPos);
//plot.addEstimationNode(estPos);
//plot.addParticles(pf.getParticles());
/** error calculation stuff */
float err_m = gtPos.getDistance(estPos);
errorStats.add(err_m);
errorFile << err_m << "\n";
/** smoothing stuff */
if(Settings::Smoothing::activated){
// add everything from the forward step to the history
pfHistory.add(ts, pf.getNonResamplingParticles(), ctrl, obs);
//backward filtering
//((BFTrans*)bf.getTransition())->setCurrentTime(tsHistory[(tsHistory.size() - 1) - i]);
MyState estBF = bf.update(pfHistory, Settings::Smoothing::lag);
// get ground truth position at lag time
Point3 estPosSmoothing = estBF.position.inMeter();
Point3 gtPosSmoothed;
if(pfHistory.size() <= Settings::Smoothing::lag){
gtPosSmoothed = gtInterpolator.get(static_cast<uint64_t>(pfHistory.getFirstTimestamp().ms()));
} else {
gtPosSmoothed = gtInterpolator.get(static_cast<uint64_t>(pfHistory.getTimestamp(Settings::Smoothing::lag).ms()));
}
//plot
plot.addEstimationNodeSmoothed(estPosSmoothing);
plot.addParticles(bf.getbackwardParticles().back());
if(Settings::Smoothing::lag >= pfHistory.size()){
// error between GT and smoothing
float errSmoothing_m = gtPosSmoothed.getDistance(estPosSmoothing);
errorStatsSmoothing.add(errSmoothing_m);
errorFileSmoothing << errSmoothing_m << "\n";
}
}
//plot misc
plot.setTimeInMinute(static_cast<int>(ts.sec()) / 60, static_cast<int>(static_cast<int>(ts.sec())%60));
if(Settings::useKLB){
plot.gp << "set label 1002 at screen 0.04, 0.94 'KLD: " << ":" << kld_data.back() << "'\n";
}
plot.gp << "set label 1002 at screen 0.95, 0.98 'act:" << static_cast<int>(obs.activity) << "'\n";
//draw gyro angle and motion angle
//turn angle plot
static float angleSumTurn = 0; angleSumTurn += ctrl.turnSinceLastTransition_rad;
plot.showAngle(1, angleSumTurn + M_PI, Point2(0.9, 0.9), "Turn: ");
//motion angle plot
static float angleSumMotion = 0; angleSumMotion += ctrl.motionDeltaAngle_rad;
plot.showAngle(2, angleSumMotion + M_PI, Point2(0.9, 0.8), "Motion: ");
/** Draw everything */
plot.show();
usleep(10*10);
lastTimestamp = ts;
// reset control
ctrl.resetAfterTransition();
}
}
errorFile.close();
std::cout << "Statistical Analysis Filtering: " << std::endl;
std::cout << "Median: " << errorStats.getMedian() << " Average: " << errorStats.getAvg() << " Std: " << errorStats.getStdDev() << std::endl;
std::cout << "Statistical Analysis Smoothing: " << std::endl;
std::cout << "Median: " << errorStatsSmoothing.getMedian() << " Average: " << errorStatsSmoothing.getAvg() << " Std: " << errorStatsSmoothing.getStdDev() << std::endl;
//Write the current plotti buffer into file
std::ofstream plotFile;
plotFile.open(evalDir + "/plot_" + std::to_string(numFile) + "_" + std::to_string(t) + ".gp");
plot.saveToFile(plotFile);
plotFile.close();
for(int i = 0; i < map->floors.size(); ++i){
plot.printSingleFloor(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), i);
plot.show();
usleep(10*10);
}
plot.printSideView(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), 90);
plot.show();
plot.printSideView(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), 0);
plot.show();
plot.printOverview(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t));
plot.show();
/** Draw KLB */
K::Gnuplot gp;
K::GnuplotPlot plotkld;
K::GnuplotPlotElementLines lines;
if(Settings::useKLB){
std::string path = evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t);
gp << "set terminal png size 1280,720\n";
gp << "set output '" << path << "_shennendistance.png'\n";
for(int i=0; i < kld_data.size()-1; ++i){
K::GnuplotPoint2 p1(i, kld_data[i]);
K::GnuplotPoint2 p2(i+1, kld_data[i+1]);
lines.addSegment(p1, p2);
}
plotkld.add(&lines);
gp.draw(plotkld);
gp.flush();
plot.splot.getView().setEnabled(false);
}
std::cout << "finished" << std::endl;
sleep(1);
return errorStats;
}
#include "navMesh/main.h"
int main(int argc, char** argv) {
Stats::Statistics<float> statsAVG;
Stats::Statistics<float> statsMedian;
Stats::Statistics<float> statsSTD;
Stats::Statistics<float> statsQuantil;
Stats::Statistics<float> tmp;
for(int i = 0; i < 10; ++i){
tmp = run(data.SecondFloorOnly, 0, "KDE-Smoothing-Test", Settings::Path_DongleTest::path1);
statsMedian.add(tmp.getMedian());
statsAVG.add(tmp.getAvg());
statsSTD.add(tmp.getStdDev());
statsQuantil.add(tmp.getQuantile(0.75));
// tmp = run(data.MotionAxisTest, 0, "Motion-Axis-Test", Settings::Path_DongleTest::path1);
// statsMedian.add(tmp.getMedian());
// statsAVG.add(tmp.getAvg());
// statsSTD.add(tmp.getStdDev());
// statsQuantil.add(tmp.getQuantile(0.75));
std::cout << "Iteration " << i << " completed" << std::endl;;
}
std::cout << "==========================================================" << std::endl;
std::cout << "Average of all statistical data: " << std::endl;
std::cout << "Median: " << statsMedian.getAvg() << std::endl;
std::cout << "Average: " << statsAVG.getAvg() << std::endl;
std::cout << "Standard Deviation: " << statsSTD.getAvg() << std::endl;
std::cout << "75 Quantil: " << statsQuantil.getAvg() << std::endl;
std::cout << "==========================================================" << std::endl;
//EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS
std::ofstream finalStatisticFile;
finalStatisticFile.open (errorDir + "/tmp.csv");
finalStatisticFile << "Average of all statistical data: \n";
finalStatisticFile << "Median: " << statsMedian.getAvg() << "\n";
finalStatisticFile << "Average: " << statsAVG.getAvg() << "\n";
finalStatisticFile << "Standard Deviation: " << statsSTD.getAvg() << "\n";
finalStatisticFile << "75 Quantil: " << statsQuantil.getAvg() << "\n";
finalStatisticFile.close();
//EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS
navMeshMain();
}

494
mainToni.h Normal file
View File

@@ -0,0 +1,494 @@
#ifndef MAINTONI_H
#define MAINTONI_H
#include <iostream>
#include "filter/Structs.h"
#include "filter/KLB.h"
#include "Plotti.h"
#include "filter/Logic.h"
#include "Settings.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <Indoor/sensors/radio/model/WiFiModelFactory.h>
#include <Indoor/sensors/radio/model/WiFiModelFactoryImpl.h>
#include <Indoor/math/stats/Statistics.h>
#include <Indoor/smc/smoothing/ForwardFilterHistory.h>
#include <Indoor/smc/smoothing/FastKDESmoothing.h>
#include "navMesh/main.h"
#define D_TONI 1
#define D_FRANK 2
#define USE_DATA D_FRANK
#if (USE_DATA == D_FRANK)
//const std::string mapDir = "/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/";
//const std::string dataDir = "/mnt/data/workspaces/IPIN2016/IPIN2016/competition/src/data/";
const std::string mapDir = "/apps/museum/maps/";
const std::string dataDir = "/apps/museum/data/";
const std::string errorDir = dataDir + "results/";
#elif (USE_DATA == D_TONI)
const std::string mapDir = "/home/toni/Documents/programme/localization/IndoorMap/maps/";
//const std::string dataDir = "/home/toni/Documents/programme/localization/DynLag/code/data/";
const std::string dataDir = "/home/toni/Documents/programme/localization/museum/measurements/shl/";
//const std::string dataDir = "/home/toni/Documents/programme/localization/museum/measurements/motionAxisTest/";
const std::string errorDir = dataDir + "results/";
#endif
/** describes one dataset (map, training, parameter-estimation, ...) */
struct DataSetup {
std::string map;
std::vector<std::string> training;
std::string wifiParams;
int minWifiOccurences;
VAPGrouper::Mode vapMode;
std::string grid;
};
/** all configured datasets */
struct Data {
DataSetup SecondFloorOnly = {
mapDir + "SHL_Stock_2_01.xml",
{
dataDir + "Path1_1.csv",
dataDir + "Path2_1.csv",
dataDir + "Path3_1.csv",
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_Stock_2_01.dat"
};
DataSetup FloorOneToThree = {
mapDir + "SHL_Stock_1-3_03.xml",
{
dataDir + "Path4_0.csv",
dataDir + "Path5_0.csv",
dataDir + "Path6_0.csv",
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_Stock_1-3_03.dat"
};
DataSetup MotionAxisTest = {
mapDir + "SHL40_noElevator.xml",
{
dataDir + "Path0_0.csv"
},
mapDir + "wifi_fp_all.dat",
40,
VAPGrouper::Mode::LAST_MAC_DIGIT_TO_ZERO,
mapDir + "grid_SHL40_noElevator.dat"
};
} data;
Floorplan::IndoorMap* MyState::map;
Stats::Statistics<float> run(DataSetup setup, int numFile, std::string folder, std::vector<int> gtPath) {
std::vector<double> kld_data;
// load the floorplan
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(setup.map);
MyState::map = map;
WiFiModelLogDistCeiling WiFiModel(map);
WiFiModel.loadAPs(map, Settings::WiFiModel::TXP, Settings::WiFiModel::EXP, Settings::WiFiModel::WAF);
Assert::isFalse(WiFiModel.getAllAPs().empty(), "no AccessPoints stored within the map.xml");
//Wi-Fi model new
// WiFiModelFactory factory(map);
// WiFiModel* wifimodel= factory.loadXML("/home/toni/Documents/programme/localization/data/wifi/model/eachOptParPos_multimodel.xml");
// Assert::isFalse(wifimodel->getAllAPs().empty(), "no AccessPoints stored within the map.xml");
BeaconModelLogDistCeiling beaconModel(map);
beaconModel.loadBeaconsFromMap(map, Settings::BeaconModel::TXP, Settings::BeaconModel::EXP, Settings::BeaconModel::WAF);
//Assert::isFalse(beaconModel.getAllBeacons().empty(), "no Beacons stored within the map.xml");
// build the grid
std::ifstream inp(setup.grid, std::ifstream::binary);
Grid<MyNode> grid(Settings::Grid::gridSize_cm);
// grid.dat empty? -> build one and save it
if (!inp.good() || (inp.peek()&&0) || inp.eof()) {
std::ofstream onp;
onp.open(setup.grid);
GridFactory<MyNode> factory(grid);
factory.build(map);
// add node-importance
Importance::addImportance(grid);
grid.write(onp);
} else {
grid.read(inp);
}
// stamp WiFi signal-strengths onto the grid
WiFiGridEstimator::estimate(grid, WiFiModel, Settings::smartphoneAboveGround);
// reading file
Offline::FileReader fr(setup.training[numFile]);
//interpolator for ground truth
Interpolator<uint64_t, Point3> gtInterpolator = fr.getGroundTruthPath(map, gtPath);
//gnuplot plot
Plotti plot;
plot.addFloors(map);
plot.addOutline(map);
plot.addStairs(map);
plot.gp << "set autoscale xy\n";
//plot.addGrid(grid);
plot.splot.getView().setEnabled(false);
// init ctrl and observation
MyControl ctrl;
ctrl.resetAfterTransition();
MyObs obs;
//History of all estimated particles. Used for smoothing
SMC::ForwardFilterHistory<MyState, MyControl, MyObs> pfHistory;
//filter init
SMC::ParticleFilterHistory<MyState, MyControl, MyObs> pf(Settings::numParticles, std::unique_ptr<PFInit>(new PFInit(grid)));
//SMC::ParticleFilterHistory<MyState, MyControl, MyObs> pf(Settings::numParticles, std::unique_ptr<PFInitFixed>(new PFInitFixed(grid, GridPoint(55.5f * 100.0, 43.7f * 100.0, 740.0f), 180.0f)));
pf.setTransition(std::unique_ptr<PFTrans>(new PFTrans(grid, &ctrl)));
//pf.setTransition(std::unique_ptr<PFTransKLDSampling>(new PFTransKLDSampling(grid, &ctrl)));
//pf.setTransition(std::unique_ptr<PFTransSimple>(new PFTransSimple(grid)));
pf.setEvaluation(std::unique_ptr<PFEval>(new PFEval(WiFiModel, beaconModel, grid)));
//resampling
if(Settings::useKLB){
pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingDivergence<MyState>>(new SMC::ParticleFilterResamplingDivergence<MyState>()));
} else {
pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingSimple<MyState>>(new SMC::ParticleFilterResamplingSimple<MyState>()));
//pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingPercent<MyState>>(new SMC::ParticleFilterResamplingPercent<MyState>(0.4)));
//pf.setResampling(std::unique_ptr<NodeResampling<MyState, MyNode>>(new NodeResampling<MyState, MyNode>(*grid)););
//pf.setResampling(std::unique_ptr<SMC::ParticleFilterResamplingKLD<MyState>>(new SMC::ParticleFilterResamplingKLD<MyState>()));
}
pf.setNEffThreshold(0.95);
//estimation
pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationWeightedAverage<MyState>()));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.5)));
//pf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationKernelDensity<MyState, 3>>(new SMC::ParticleFilterEstimationKernelDensity<MyState, 3>()));
/** Smoothing Init */
SMC::FastKDESmoothing<MyState, MyControl, MyObs> bf(Settings::numParticles, map, Settings::Grid::gridSize_cm, Settings::KDE::bandwidth);
if(Settings::Smoothing::activated){
//create the backward smoothing filter
bf.setSampler( std::unique_ptr<SMC::CumulativeSampler<MyState>>(new SMC::CumulativeSampler<MyState>()));
bool smoothing_resample = false;
//bf->setNEffThreshold(1.0);
if(smoothing_resample)
bf.setResampling( std::unique_ptr<SMC::ParticleFilterResamplingSimple<MyState>>(new SMC::ParticleFilterResamplingSimple<MyState>()) );
//bf.setTransition(std::unique_ptr<BFTrans>( new BFTrans) );
bf.setTransition(std::unique_ptr<PFTrans>(new PFTrans(grid, &ctrl)));
//Smoothing estimation
bf.setEstimation(std::unique_ptr<SMC::ParticleFilterEstimationWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationWeightedAverage<MyState>()));
//bf->setEstimation( std::unique_ptr<SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationRegionalWeightedAverage<MyState>()));
//bf->setEstimation( std::unique_ptr<SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>>(new SMC::ParticleFilterEstimationOrderedWeightedAverage<MyState>(0.50f)));
}
Timestamp lastTimestamp = Timestamp::fromMS(0);
StepDetection sd;
PoseDetection pd;
TurnDetection td(&pd);
MotionDetection md;
ActivityButterPressure act;
//ActivityDetector act;
RelativePressure relBaro;
relBaro.setCalibrationTimeframe( Timestamp::fromMS(5000) );
Stats::Statistics<float> errorStats;
Stats::Statistics<float> errorStatsSmoothing;
//file writing for error data
const long int t = static_cast<long int>(time(NULL));
const std::string evalDir = errorDir + folder + std::to_string(t);
if(mkdir(evalDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1){
Assert::doThrow("Eval folder couldn't be created!");
}
std::ofstream errorFile;
errorFile.open (evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + ".csv");
std::ofstream errorFileSmoothing;
errorFileSmoothing.open (evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + "_Smoothing.csv");
// parse each sensor-value within the offline data
for (const Offline::Entry& e : fr.getEntries()) {
const Timestamp ts = Timestamp::fromMS(e.ts);
if (e.type == Offline::Sensor::WIFI) {
obs.wifi = fr.getWiFiGroupedByTime()[e.idx].data;
} else if (e.type == Offline::Sensor::BEACON){
obs.beacons.entries.push_back(fr.getBeacons()[e.idx].data);
// remove to old beacon measurements
obs.beacons.removeOld(ts);
} else if (e.type == Offline::Sensor::ACC) {
if (sd.add(ts, fr.getAccelerometer()[e.idx].data)) {
++ctrl.numStepsSinceLastTransition;
}
const Offline::TS<AccelerometerData>& _acc = fr.getAccelerometer()[e.idx];
pd.addAccelerometer(ts, _acc.data);
} else if (e.type == Offline::Sensor::GYRO) {
const Offline::TS<GyroscopeData>& _gyr = fr.getGyroscope()[e.idx];
const float delta_gyro = td.addGyroscope(ts, _gyr.data);
ctrl.turnSinceLastTransition_rad += delta_gyro;
} else if (e.type == Offline::Sensor::BARO) {
relBaro.add(ts, fr.getBarometer()[e.idx].data);
obs.relativePressure = relBaro.getPressureRealtiveToStart();
obs.sigmaPressure = relBaro.getSigma();
//activity recognition
act.add(ts, fr.getBarometer()[e.idx].data);
obs.activity = act.get();
//activity for transition
} else if (e.type == Offline::Sensor::LIN_ACC) {
md.addLinearAcceleration(ts, fr.getLinearAcceleration()[e.idx].data);
} else if (e.type == Offline::Sensor::GRAVITY) {
md.addGravity(ts, fr.getGravity()[e.idx].data);
Eigen::Vector2f curVec = md.getCurrentMotionAxis();
ctrl.motionDeltaAngle_rad = md.getMotionChangeInRad();
}
if (ts.ms() - lastTimestamp.ms() > 500) {
/** filtering stuff */
obs.currentTime = ts;
MyState est = pf.update(&ctrl, obs);
Point3 estPos = est.position.inMeter();
Point3 gtPos = gtInterpolator.get(static_cast<uint64_t>(ts.ms()));
/** plotting stuff */
plot.pInterest.clear();
plot.setEst(estPos);
plot.setGT(gtPos);
//plot.addEstimationNode(estPos);
//plot.addParticles(pf.getParticles());
/** error calculation stuff */
float err_m = gtPos.getDistance(estPos);
errorStats.add(err_m);
errorFile << err_m << "\n";
/** smoothing stuff */
if(Settings::Smoothing::activated){
// add everything from the forward step to the history
pfHistory.add(ts, pf.getNonResamplingParticles(), ctrl, obs);
//backward filtering
//((BFTrans*)bf.getTransition())->setCurrentTime(tsHistory[(tsHistory.size() - 1) - i]);
MyState estBF = bf.update(pfHistory, Settings::Smoothing::lag);
// get ground truth position at lag time
Point3 estPosSmoothing = estBF.position.inMeter();
Point3 gtPosSmoothed;
if(pfHistory.size() <= Settings::Smoothing::lag){
gtPosSmoothed = gtInterpolator.get(static_cast<uint64_t>(pfHistory.getFirstTimestamp().ms()));
} else {
gtPosSmoothed = gtInterpolator.get(static_cast<uint64_t>(pfHistory.getTimestamp(Settings::Smoothing::lag).ms()));
}
//plot
plot.addEstimationNodeSmoothed(estPosSmoothing);
plot.addParticles(bf.getbackwardParticles().back());
if(Settings::Smoothing::lag >= pfHistory.size()){
// error between GT and smoothing
float errSmoothing_m = gtPosSmoothed.getDistance(estPosSmoothing);
errorStatsSmoothing.add(errSmoothing_m);
errorFileSmoothing << errSmoothing_m << "\n";
}
}
//plot misc
plot.setTimeInMinute(static_cast<int>(ts.sec()) / 60, static_cast<int>(static_cast<int>(ts.sec())%60));
if(Settings::useKLB){
plot.gp << "set label 1002 at screen 0.04, 0.94 'KLD: " << ":" << kld_data.back() << "'\n";
}
plot.gp << "set label 1002 at screen 0.95, 0.98 'act:" << static_cast<int>(obs.activity) << "'\n";
//draw gyro angle and motion angle
//turn angle plot
static float angleSumTurn = 0; angleSumTurn += ctrl.turnSinceLastTransition_rad;
plot.showAngle(1, angleSumTurn + M_PI, Point2(0.9, 0.9), "Turn: ");
//motion angle plot
static float angleSumMotion = 0; angleSumMotion += ctrl.motionDeltaAngle_rad;
plot.showAngle(2, angleSumMotion + M_PI, Point2(0.9, 0.8), "Motion: ");
/** Draw everything */
plot.show();
usleep(10*10);
lastTimestamp = ts;
// reset control
ctrl.resetAfterTransition();
}
}
errorFile.close();
std::cout << "Statistical Analysis Filtering: " << std::endl;
std::cout << "Median: " << errorStats.getMedian() << " Average: " << errorStats.getAvg() << " Std: " << errorStats.getStdDev() << std::endl;
std::cout << "Statistical Analysis Smoothing: " << std::endl;
std::cout << "Median: " << errorStatsSmoothing.getMedian() << " Average: " << errorStatsSmoothing.getAvg() << " Std: " << errorStatsSmoothing.getStdDev() << std::endl;
//Write the current plotti buffer into file
std::ofstream plotFile;
plotFile.open(evalDir + "/plot_" + std::to_string(numFile) + "_" + std::to_string(t) + ".gp");
plot.saveToFile(plotFile);
plotFile.close();
for(int i = 0; i < map->floors.size(); ++i){
plot.printSingleFloor(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), i);
plot.show();
usleep(10*10);
}
plot.printSideView(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), 90);
plot.show();
plot.printSideView(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t), 0);
plot.show();
plot.printOverview(evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t));
plot.show();
/** Draw KLB */
K::Gnuplot gp;
K::GnuplotPlot plotkld;
K::GnuplotPlotElementLines lines;
if(Settings::useKLB){
std::string path = evalDir + "/image" + std::to_string(numFile) + "_" + std::to_string(t);
gp << "set terminal png size 1280,720\n";
gp << "set output '" << path << "_shennendistance.png'\n";
for(int i=0; i < kld_data.size()-1; ++i){
K::GnuplotPoint2 p1(i, kld_data[i]);
K::GnuplotPoint2 p2(i+1, kld_data[i+1]);
lines.addSegment(p1, p2);
}
plotkld.add(&lines);
gp.draw(plotkld);
gp.flush();
plot.splot.getView().setEnabled(false);
}
std::cout << "finished" << std::endl;
sleep(1);
return errorStats;
}
int main(int argc, char** argv) {
Stats::Statistics<float> statsAVG;
Stats::Statistics<float> statsMedian;
Stats::Statistics<float> statsSTD;
Stats::Statistics<float> statsQuantil;
Stats::Statistics<float> tmp;
for(int i = 0; i < 10; ++i){
tmp = run(data.SecondFloorOnly, 0, "KDE-Smoothing-Test", Settings::Path_DongleTest::path1);
statsMedian.add(tmp.getMedian());
statsAVG.add(tmp.getAvg());
statsSTD.add(tmp.getStdDev());
statsQuantil.add(tmp.getQuantile(0.75));
// tmp = run(data.MotionAxisTest, 0, "Motion-Axis-Test", Settings::Path_DongleTest::path1);
// statsMedian.add(tmp.getMedian());
// statsAVG.add(tmp.getAvg());
// statsSTD.add(tmp.getStdDev());
// statsQuantil.add(tmp.getQuantile(0.75));
std::cout << "Iteration " << i << " completed" << std::endl;;
}
std::cout << "==========================================================" << std::endl;
std::cout << "Average of all statistical data: " << std::endl;
std::cout << "Median: " << statsMedian.getAvg() << std::endl;
std::cout << "Average: " << statsAVG.getAvg() << std::endl;
std::cout << "Standard Deviation: " << statsSTD.getAvg() << std::endl;
std::cout << "75 Quantil: " << statsQuantil.getAvg() << std::endl;
std::cout << "==========================================================" << std::endl;
//EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS
std::ofstream finalStatisticFile;
finalStatisticFile.open (errorDir + "/tmp.csv");
finalStatisticFile << "Average of all statistical data: \n";
finalStatisticFile << "Median: " << statsMedian.getAvg() << "\n";
finalStatisticFile << "Average: " << statsAVG.getAvg() << "\n";
finalStatisticFile << "Standard Deviation: " << statsSTD.getAvg() << "\n";
finalStatisticFile << "75 Quantil: " << statsQuantil.getAvg() << "\n";
finalStatisticFile.close();
//EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS EDIT THIS
}
#endif // MAINTONI_H

184
navMesh/filter.h Normal file
View File

@@ -0,0 +1,184 @@
#ifndef NAV_MESH_FILTER_H
#define NAV_MESH_FILTER_H
#include "mesh.h"
#include <Indoor/geo/Heading.h>
#include <Indoor/math/Distributions.h>
#include <KLib/math/filter/particles/Particle.h>
#include <KLib/math/filter/particles/ParticleFilter.h>
#include <KLib/math/filter/particles/ParticleFilterEvaluation.h>
#include <KLib/math/filter/particles/ParticleFilterInitializer.h>
#include <KLib/math/filter/particles/resampling/ParticleFilterResamplingSimple.h>
#include <KLib/math/filter/particles/estimation/ParticleFilterEstimationWeightedAverage.h>
#include <Indoor/navMesh/walk/NavMeshWalkSimple.h>
#include <Indoor/navMesh/walk/NavMeshWalkEval.h>
struct MyState {
/** the state's position (within the mesh) */
MyNavMeshLocation pos;
/** the state's heading */
Heading heading;
MyState() : pos(), heading(0) {;}
MyState& operator += (const MyState& o) {
pos.tria = nullptr; // impossible
pos.pos += o.pos.pos;
return *this;
}
MyState& operator /= (const double val) {
pos.tria = nullptr; // impossible
pos.pos /= val;
return *this;
}
MyState operator * (const double val) const {
MyState res;
res.pos.pos = pos.pos * val;
return res;
}
};
struct MyControl {
int numStepsSinceLastEval = 0;
float headingChangeSinceLastEval = 0;
void afterEval() {
numStepsSinceLastEval = 0;
headingChangeSinceLastEval = 0;
}
};
struct MyObservation {
};
class MyPFInitUniform : public K::ParticleFilterInitializer<MyState> {
const MyNavMesh* mesh;
public:
MyPFInitUniform(const MyNavMesh* mesh) : mesh(mesh) {
;
}
virtual void initialize(std::vector<K::Particle<MyState>>& particles) override {
/** random position and heading within the mesh */
Distribution::Uniform<float> dHead(0, 2*M_PI);
MyNavMeshRandom rnd = mesh->getRandom();
for (K::Particle<MyState>& p : particles) {
p.state.pos = rnd.draw();
p.state.heading = dHead.draw();
p.weight = 1.0 / particles.size();
}
}
};
class MyPFInitFixed : public K::ParticleFilterInitializer<MyState> {
const MyNavMesh* mesh;
const Point3 pos;
public:
MyPFInitFixed(const MyNavMesh* mesh, const Point3 pos) : mesh(mesh), pos(pos) {
;
}
virtual void initialize(std::vector<K::Particle<MyState>>& particles) override {
/** random position and heading within the mesh */
Distribution::Uniform<float> dHead(0, 2*M_PI);
for (K::Particle<MyState>& p : particles) {
p.state.pos = mesh->getLocation(pos);
p.state.heading = dHead.draw();
p.weight = 1.0 / particles.size();
}
}
};
class MyPFTrans : public K::ParticleFilterTransition<MyState, MyControl> {
using MyNavMeshWalk = NM::NavMeshWalkSimple<MyNavMeshTriangle>;
MyNavMeshWalk walker;
public:
MyPFTrans(MyNavMesh& mesh) : walker(mesh) {
// how to evaluate drawn points
//walker.addEvaluator(new NM::WalkEvalHeadingStartEndNormal<MyNavMeshTriangle>(0.04));
//walker.addEvaluator(new NM::WalkEvalDistance<MyNavMeshTriangle>(0.1));
walker.addEvaluator(new NM::WalkEvalApproachesTarget<MyNavMeshTriangle>(0.9)); // 90% for particles moving towards the target
}
void transition(std::vector<K::Particle<MyState>>& particles, const MyControl* control) override {
Distribution::Normal<float> dStepSizeFloor(0.70, 0.1);
Distribution::Normal<float> dStepSizeStair(0.35, 0.1);
Distribution::Normal<float> dHeading(0.0, 0.10);
for (K::Particle<MyState>& p : particles) {
// how to walk
MyNavMeshWalkParams params;
params.heading = p.state.heading + control->headingChangeSinceLastEval + dHeading.draw();
params.numSteps = control->numStepsSinceLastEval;
params.start = p.state.pos;
params.stepSizes.stepSizeFloor_m = dStepSizeFloor.draw();
params.stepSizes.stepSizeStair_m = dStepSizeStair.draw();
// walk
MyNavMeshWalk::ResultEntry res = walker.getOne(params);
// assign back to particle's state
p.weight *= res.probability;
p.state.pos = res.location;
p.state.heading = res.heading;
}
// reset the control (0 steps, 0 delta-heading)
//control->afterEval();
}
};
class MyPFEval : public K::ParticleFilterEvaluation<MyState, MyObservation> {
public:
virtual double evaluation(std::vector<K::Particle<MyState>>& particles, const MyObservation& observation) override {
return 1.0;
}
};
using MyFilter = K::ParticleFilter<MyState, MyControl, MyObservation>;
#endif

94
navMesh/main.h Normal file
View File

@@ -0,0 +1,94 @@
#ifndef NAV_MESH_MAIN_H
#define NAV_MESH_MAIN_H
#include "mesh.h"
#include "filter.h"
#include <memory>
#include <thread>
#include <Indoor/floorplan/v2/FloorplanReader.h>
void navMeshMain() {
std::string mapFile = "/apps/paper/diss/data/maps/museum31.xml";
Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(mapFile);
NM::NavMeshSettings set;
MyNavMesh mesh;
MyNavMeshFactory fac(&mesh, set);
fac.build(map);
const Point3 src(26, 43, 7.5);
// add shortest-path to destination
//const Point3 dst(51, 45, 1.7);
const Point3 dst(25, 45, 0);
NM::NavMeshDijkstra::stamp<MyNavMeshTriangle>(mesh, dst);
// debug show
NM::NavMeshDebug dbg;
dbg.addMesh(mesh);
//dbg.addDijkstra(mesh);
dbg.draw();
// particle-filter
const int numParticles = 1000;
auto init = std::make_unique<MyPFInitFixed>(&mesh, src); // known position
//auto init = std::make_unique<MyPFInitUniform>(&mesh); // uniform distribution
auto eval = std::make_unique<MyPFEval>();
auto trans = std::make_unique<MyPFTrans>(mesh);
auto resample = std::make_unique<K::ParticleFilterResamplingSimple<MyState>>();
auto estimate = std::make_unique<K::ParticleFilterEstimationWeightedAverage<MyState>>();
// setup
MyFilter pf(numParticles, std::move(init));
pf.setEvaluation(std::move(eval));
pf.setTransition(std::move(trans));
pf.setResampling(std::move(resample));
pf.setEstimation(std::move(estimate));
pf.setNEffThreshold(1);
MyControl ctrl;
MyObservation obs;
//Distribution::Uniform<float> dHead(0, 2*M_PI);
Distribution::Normal<float> dHead(0, 0.1);
for (int i = 0; i < 10000; ++i) {
ctrl.numStepsSinceLastEval = 1;
ctrl.headingChangeSinceLastEval = dHead.draw();
MyState est = pf.update(&ctrl, obs);
ctrl.afterEval();
try {
MyNavMeshLocation loc = mesh.getLocationNearestTo(est.pos.pos);
auto path = loc.tria->getPathToDestination<MyNavMeshTriangle>(loc.pos);
dbg.addDijkstra(path);
} catch (...) {;}
const int d = (i * 1) % 360;
dbg.plot.getView().setCamera(60, d);
dbg.showParticles(pf.getParticles());
dbg.setCurPos(est.pos.pos);
//dbg.gp.setOutput("/tmp/123/" + std::to_string(i) + ".png");
//dbg.gp.setTerminal("pngcairo", K::GnuplotSize(60, 30));
std::cout << i << std::endl;
dbg.draw();
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
}
#endif

32
navMesh/mesh.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef NAV_MESH_MESH_H
#define NAV_MESH_MESH_H
#include <Indoor/navMesh/NavMesh.h>
#include <Indoor/navMesh/NavMeshLocation.h>
#include <Indoor/navMesh/NavMeshRandom.h>
#include <Indoor/navMesh/NavMeshFactory.h>
#include <Indoor/navMesh/walk/NavMeshWalkSimple.h>
#include <Indoor/navMesh/meta/NavMeshDijkstra.h>
/** the triangle to use with the nav-mesh */
class MyNavMeshTriangle : public NM::NavMeshTriangle, public NM::NavMeshTriangleDijkstra {
// add own parameters here
public:
MyNavMeshTriangle(const Point3 p1, const Point3 p2, const Point3 p3, uint8_t type) : NM::NavMeshTriangle(p1, p2, p3, type) {
;
}
};
using MyNavMeshFactory = NM::NavMeshFactory<MyNavMeshTriangle>;
using MyNavMesh = NM::NavMesh<MyNavMeshTriangle>;
using MyNavMeshLocation = NM::NavMeshLocation<MyNavMeshTriangle>;
using MyNavMeshRandom = NM::NavMeshRandom<MyNavMeshTriangle>;
using MyNavMeshWalkParams = NM::NavMeshWalkParams<MyNavMeshTriangle>;
#endif