updated sensors and filter to current code version
removed KLib stuff added new activity filter is uncommand! at the moment, the app is not able to load new maps and breaks using old maps
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include <random>
|
||||
|
||||
#include <Indoor/grid/Grid.h>
|
||||
#include <KLib/math/filter/particles/resampling/ParticleFilterResampling.h>
|
||||
#include <Indoor/smc/filtering/resampling/ParticleFilterResampling.h>
|
||||
|
||||
|
||||
/**
|
||||
@@ -16,12 +16,12 @@
|
||||
* O(log(n)) per particle
|
||||
*/
|
||||
template <typename State, typename Node>
|
||||
class NodeResampling : public K::ParticleFilterResampling<State> {
|
||||
class NodeResampling : public SMC::ParticleFilterResampling<State> {
|
||||
|
||||
private:
|
||||
|
||||
/** this is a copy of the particle-set to draw from it */
|
||||
std::vector<K::Particle<State>> particlesCopy;
|
||||
std::vector<SMC::Particle<State>> particlesCopy;
|
||||
|
||||
/** random number generator */
|
||||
std::minstd_rand gen;
|
||||
@@ -35,7 +35,7 @@
|
||||
gen.seed(1234);
|
||||
}
|
||||
|
||||
void resample(std::vector<K::Particle<State>>& particles) override {
|
||||
void resample(std::vector<SMC::Particle<State>>& particles) override {
|
||||
|
||||
// compile-time sanity checks
|
||||
// TODO: this solution requires EXPLICIT overloading which is bad...
|
||||
@@ -99,7 +99,7 @@
|
||||
private:
|
||||
|
||||
/** draw one particle according to its weight from the copy vector */
|
||||
const K::Particle<State>& draw(const double cumWeight) {
|
||||
const SMC::Particle<State>& draw(const double cumWeight) {
|
||||
|
||||
// generate random values between [0:cumWeight]
|
||||
std::uniform_real_distribution<float> dist(0, cumWeight);
|
||||
@@ -108,7 +108,7 @@
|
||||
const float rand = dist(gen);
|
||||
|
||||
// search comparator (cumWeight is ordered -> use binary search)
|
||||
auto comp = [] (const K::Particle<State>& s, const float d) {return s.weight < d;};
|
||||
auto comp = [] (const SMC::Particle<State>& s, const float d) {return s.weight < d;};
|
||||
auto it = std::lower_bound(particlesCopy.begin(), particlesCopy.end(), rand, comp);
|
||||
return *it;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user