From 0fef66ac62a1881e0b6f95861b9341fc389c656c Mon Sep 17 00:00:00 2001 From: toni Date: Mon, 12 Feb 2018 13:47:23 +0100 Subject: [PATCH] fixed some small issues regarding museum project --- main.cpp | 4 ++-- math/dsp/Convolution2D.h | 4 ---- navMesh/NavMeshSettings.h | 2 +- navMesh/walk/NavMeshWalkSimple.h | 2 +- smc/filtering/ParticleFilter.h | 12 ++++++------ .../resampling/ParticleFilterResamplingDivergence.h | 5 +++-- .../resampling/ParticleFilterResamplingKLD.h | 6 +++--- 7 files changed, 16 insertions(+), 19 deletions(-) diff --git a/main.cpp b/main.cpp index c7515fe..588421c 100755 --- a/main.cpp +++ b/main.cpp @@ -99,7 +99,7 @@ int main(int argc, char** argv) { //::testing::GTEST_FLAG(filter) = "*Dijkstra.*"; //::testing::GTEST_FLAG(filter) = "*LogDistanceCeilingModelBeacon*"; - //::testing::GTEST_FLAG(filter) = "*WiFiOptimizer*"; + ::testing::GTEST_FLAG(filter) = "*WiFiOptimizer*"; //::testing::GTEST_FLAG(filter) = "*Offline.readWrite*"; @@ -109,7 +109,7 @@ int main(int argc, char** argv) { //::testing::GTEST_FLAG(filter) = "*Matrix4*"; //::testing::GTEST_FLAG(filter) = "*Sphere3*"; - ::testing::GTEST_FLAG(filter) = "NavMeshD*"; + //::testing::GTEST_FLAG(filter) = "NavMeshD*"; //::testing::GTEST_FLAG(filter) = "Timestamp*"; //::testing::GTEST_FLAG(filter) = "*RayTrace3*"; diff --git a/math/dsp/Convolution2D.h b/math/dsp/Convolution2D.h index a8bce33..e9832f2 100644 --- a/math/dsp/Convolution2D.h +++ b/math/dsp/Convolution2D.h @@ -23,10 +23,6 @@ public: RealArray2D kernelReal; ComplexArray2D kernelSpectrum; - - signal.data().data - - //convert image2d single vector to 2d vector, just use pointers int signal_x = signal.width; int signal_y = signal.height; diff --git a/navMesh/NavMeshSettings.h b/navMesh/NavMeshSettings.h index 350fcc3..d93c789 100644 --- a/navMesh/NavMeshSettings.h +++ b/navMesh/NavMeshSettings.h @@ -36,7 +36,7 @@ namespace NM { /** algorithm choice */ SamplePartitionType partitionType = SamplePartitionType::SAMPLE_PARTITION_WATERSHED; - float regionMinSize = 8; // (isolated) regions smaller than this will not be rendered?! + float regionMinSize = 80; // (isolated) regions smaller than this will not be rendered?! const float regionMergeSize = 20; //?? diff --git a/navMesh/walk/NavMeshWalkSimple.h b/navMesh/walk/NavMeshWalkSimple.h index 7819b41..06eaa55 100644 --- a/navMesh/walk/NavMeshWalkSimple.h +++ b/navMesh/walk/NavMeshWalkSimple.h @@ -59,7 +59,7 @@ namespace NM { // to-be-walked distance; const float toBeWalkedDist = params.getToBeWalkedDistance(); - const float toBeWalkedDistSafe = 0.75 + toBeWalkedDist * 1.1; + const float toBeWalkedDistSafe = 0.75 + toBeWalkedDist * 1.1; // construct reachable region NavMeshSub reachable(params.start, toBeWalkedDistSafe); diff --git a/smc/filtering/ParticleFilter.h b/smc/filtering/ParticleFilter.h index 48d3aa2..c228480 100644 --- a/smc/filtering/ParticleFilter.h +++ b/smc/filtering/ParticleFilter.h @@ -160,7 +160,7 @@ namespace SMC { void updateTransitionOnly(const Control* control) { // sanity checks (if enabled) - Assert::isNotNull(transition, "transition MUST not be null! call setTransition() first!"); + Assert::isNotNull(transition, "transition MUST not be null! call setTransition() first!"); // perform the transition step transition->transition(particles, control); @@ -171,9 +171,9 @@ namespace SMC { State updateEvaluationOnly(const Observation& observation) { // sanity checks (if enabled) - Assert::isNotNull(resampler, "resampler MUST not be null! call setResampler() first!"); + Assert::isNotNull(resampler, "resampler MUST not be null! call setResampler() first!"); Assert::isNotNull(evaluation, "evaluation MUST not be null! call setEvaluation() first!"); - Assert::isNotNull(estimation, "estimation MUST not be null! call setEstimation() first!"); + Assert::isNotNull(estimation, "estimation MUST not be null! call setEstimation() first!"); // perform the evaluation step and calculate the sum of all particle weights evaluation->evaluation(particles, observation); @@ -184,13 +184,13 @@ namespace SMC { //Assert::isNotNull(weightSum, "sum of all particle weights (returned from eval) is 0.0!"); // normalize the particle weights and thereby calculate N_eff - const double neff = normalize(); + const double neff = normalize(); // estimate the current state const State est = estimation->estimate(particles); - // if the number of efficient particles is too low, perform resampling - if (neff < particles.size() * nEffThresholdPercent) { resampler->resample(particles); } + // if the number of efficient particles is too low, perform resampling + if (neff < particles.size() * nEffThresholdPercent) { resampler->resample(particles); } // done return est; diff --git a/smc/filtering/resampling/ParticleFilterResamplingDivergence.h b/smc/filtering/resampling/ParticleFilterResamplingDivergence.h index b8b2335..8b60a8a 100644 --- a/smc/filtering/resampling/ParticleFilterResamplingDivergence.h +++ b/smc/filtering/resampling/ParticleFilterResamplingDivergence.h @@ -6,6 +6,7 @@ #include "ParticleFilterResampling.h" #include "../../ParticleAssertions.h" +#include "../../../Assertions.h" int fuck_off = 0; @@ -39,7 +40,7 @@ namespace SMC { void resample(std::vector>& particles) override{ - + Assert::doThrow("lol, nothing happens here. Get out!"); } void resample(std::vector>& particles, double kld, std::vector>& particlesWifi) override { @@ -101,7 +102,7 @@ namespace SMC { Particle posteriorParticle = draw(cumWeight); Particle wifiParticle = drawWifi(cumWeightWifi); - posteriorParticle.state.position = wifiParticle.state.position; + posteriorParticle.state.pos.pos = wifiParticle.state.pos.pos; particles[i] = posteriorParticle; } else { particles[i] = draw(cumWeight); diff --git a/smc/filtering/resampling/ParticleFilterResamplingKLD.h b/smc/filtering/resampling/ParticleFilterResamplingKLD.h index 5f7e58b..f04f148 100644 --- a/smc/filtering/resampling/ParticleFilterResamplingKLD.h +++ b/smc/filtering/resampling/ParticleFilterResamplingKLD.h @@ -48,11 +48,11 @@ namespace SMC { public: /** ctor */ - ParticleFilterResamplingKLD(double delta = 0.01, double epsilon = 0.13, uint32_t N_max = 25000) : delta(delta), epsilon(epsilon), N_max(N_max) { + ParticleFilterResamplingKLD(double delta = 0.01, double epsilon = 0.13, uint32_t N_max = 10000) : delta(delta), epsilon(epsilon), N_max(N_max) { gen.seed(RANDOM_SEED); - bins.setBinSizes({0.01, 0.01, 0.2, 0.3}); - bins.setRanges({BinningRange(-1,100), BinningRange(-10,60), BinningRange(-1,15), BinningRange(0, 2 * M_PI)}); + bins.setBinSizes({0.01, 0.01, 0.2}); + bins.setRanges({BinningRange(-1,100), BinningRange(-10,60), BinningRange(-1,15)}); } void resample(std::vector>& particles) override {