started working on the tex-part

started working on eval-graphics
ned helper methods
tested some new aspects
some fixes and changes
added some graphics
new test-floorplan
many cleanups
This commit is contained in:
2016-02-03 21:17:15 +01:00
parent 8a57b4cdbd
commit c5a5acbbf6
40 changed files with 69163 additions and 275 deletions

View File

@@ -3,6 +3,10 @@
struct MyControl {
float walked_m = 0;
float headingChange_rad = 0;
};
#endif // MYCONTROL_H

View File

@@ -61,14 +61,13 @@ public:
weight *= beaconEval.getProbability(p.state, observation);
}
// if (useStep) {
// weight *= stepEval.getProbability(p.state, observation.step);
// p.state.distanceWalkedCM = 0.0;
// }
if (useStep) {
weight *= stepEval.getProbability(p.state, observation.step);
}
// if (useTurn) {
// weight *= turnEval.getProbability(p.state, observation.turn, true);
// }
if (useTurn) {
weight *= turnEval.getProbability(p.state, observation.turn, true);
}
// set and accumulate
p.weight = weight;
@@ -76,6 +75,11 @@ public:
}
// reset
observation.step->steps = 0;
observation.turn->delta_heading = 0;
observation.turn->delta_motion = 0;
return sum;
}

View File

@@ -47,7 +47,6 @@ public:
p.state.pOld = p.state.pCur;
p.state.walkState.heading = Heading::rnd();
p.state.distanceWalkedCM = 0;
p.state.hPa = 0;
}

View File

@@ -23,7 +23,7 @@ struct MyState {
// the grid-walk state
GridWalkState<MyGridNode> walkState;
int distanceWalkedCM;
//int distanceWalkedCM;
// double heading_old;

View File

@@ -31,7 +31,7 @@ private:
/** a simple normal distribution */
K::UniformDistribution distWalkStop;
K::NormalDistribution distWalk;
K::NormalDistribution distWalkPerSec;
K::NormalDistribution distStop;
@@ -48,10 +48,10 @@ public:
*/
MyTransition(Grid<MyGridNode>& grid, GridWalk<MyGridNode>& walker) :
grid(grid), walker(walker),
distWalkStop(0.0, 1.0), distWalk(1.5, 0.5), distStop(0.0, 0.1), distBaro(0.3, 0.05) {
distWalkStop(0.0, 1.0), distWalkPerSec(1.0, 0.3), distStop(0.0, 0.1), distBaro(0.3, 0.05) {
distWalkStop.setSeed(1234);
distWalk.setSeed(1234);
distWalkPerSec.setSeed(1234);
distStop.setSeed(1234);
distBaro.setSeed(5678);
@@ -90,20 +90,17 @@ public:
p.state.pOld = p.state.pCur;
// 10% stand still, 90% walk
double dist_m;
if (distWalkStop.draw() > 0.9) {
dist_m = std::abs(distStop.draw() * deltaMS / 1000.0);
} else {
dist_m = std::abs(distWalk.draw() * deltaMS / 1000.0);
}
// update cumulative distance
p.state.distanceWalkedCM += std::abs(dist_m * 100.0);
// // 10% stand still, 90% walk
// double dist_m;
// if (distWalkStop.draw() > 0.9) {
// dist_m = std::abs(distStop.draw() * deltaMS / 1000.0);
// } else {
// dist_m = std::abs(distWalkPerSec.draw() * deltaMS / 1000.0);
// }
// get new destination
//const Node3* dst = choice->getTarget(src, p.state, dist_m);
p.state.walkState = walker.getDestination(grid, p.state.walkState, dist_m );
p.state.walkState = walker.getDestination(grid, p.state.walkState, control->walked_m, control->headingChange_rad );
// randomly move the particle within its target grid (box)
// (z remains unchanged!)
@@ -114,56 +111,9 @@ public:
p.state.pCur = (Point3) *p.state.walkState.node + noise;
// --- ATTENTION HORRIBLE CODE INCOMING. ---
// update the baromter
p.state.hPa += (p.state.pOld.z - p.state.pCur.z) / 100.0f * 0.105f;
// //how many floors are changed? and in what direction (given by the sign)
// double numFloorChanged = p.state.z_nr_old - p.state.z_nr;
// //The height of the single floor levels.
// const static double floor_height[3] = {4.1, 3.4, 3.4};
// //update barometer
// if(USE_BAROMETRIC_FORMULAR){
// //height the particle has climbed.
// double h_1 = 0.0;
// double mu = 0.0;
// //we need only the sign of the floors changed, since the pressure change between the floors
// //is calculated within s_getAtmosphericPressure
// numFloorChanged = sgn(numFloorChanged);
// for(int i = std::min(p.state.z_nr_old, p.state.z_nr); i < std::max(p.state.z_nr_old, p.state.z_nr); i++){
// h_1 += floor_height[i];
// }
// {
// // use the barometric formular to calculate the relative pressure
// // the calculation is done assuming sea level height at every floor.
// double mslp = BarometricFormular::s_getSeaLevelPressure();
// double pressure = BarometricFormular::s_getAtmosphericPressure(h_1, 297.0);
// mu = std::abs(mslp - pressure);
// }
// if (!USE_STATIC_CIRCULAR_BUFFERING && !USE_DYNAMIC_CIRCULAR_BUFFERING)
// p.state.hPa += numFloorChanged * K::NormalDistribution::draw(mu, 0.005);
// else
// p.state.hPa = numFloorChanged * K::NormalDistribution::draw(mu, 0.15);
// }
// else{
// if (!USE_STATIC_CIRCULAR_BUFFERING && !USE_DYNAMIC_CIRCULAR_BUFFERING)
// p.state.hPa += numFloorChanged * distBaro.draw();
// else
// p.state.hPa = numFloorChanged * distBaro.draw();
// }
// // sanity check
// if (p.state.heading != p.state.heading) {throw "detected NaN";}
// if (p.state.z_nr != p.state.z_nr) {throw "detected NaN";}
// if (p.state.x_cm != p.state.x_cm) {throw "detected NaN";}
// if (p.state.y_cm != p.state.y_cm) {throw "detected NaN";}
// // ensure p.state.z_nr IS discreet
// if ( std::abs(p.state.z_nr - std::round(p.state.z_nr)) > 0.01) {throw "detected continuous z_nr!";}
}