This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/grid/walk/v2/modules/WalkModule.h
kazu 4f511d907e some fixes [multithreading,..]
needed interface changes [new options]
logger for android
wifi-ap-optimization
new test-cases
2016-09-28 12:19:14 +02:00

56 lines
1.5 KiB
C++

#ifndef WALKMODULE_H
#define WALKMODULE_H
#include "../../../Grid.h"
/** base-class for all WalkStates */
struct WalkState {
/** current position within the grid (-> in cm!) */
GridPoint position;
/** nested struct to prevent name clashes */
struct Distance {
/**
* for every walk, the walker is given a desired distance
* however, the walking distance depends on the grid size and can
* therefore never be reached exactly. therefor we track the
* error between desired and walked distance to ensure "in average"
* the walked distance is correct
*/
float error_m;
Distance() : error_m(0) {;}
} distance;
/** ctor */
explicit WalkState(const GridPoint& position) : position(position) {;}
};
/**
* base-class for all walk-modules that influence p(e)
*/
template <typename Node, typename WalkState> class WalkModule {
public:
/** update the given WalkState before starting the walk. e.g. based on sensor readings */
virtual void updateBefore(WalkState& state, const Node& startNode) = 0;
/** get the probability p(e) from curNode to potentialNode */
virtual double getProbability(const WalkState& state, const Node& startNode, const Node& curNode, const Node& potentialNode) const = 0;
/** one step (edge) is taken */
virtual void step(WalkState& state, const Node& curNode, const Node& nextNode) = 0;
/** update the walk state based on the given transition (if any update is necssary) */
virtual void updateAfter(WalkState& state, const Node& startNode, const Node& endNode) = 0;
};
#endif // WALKMODULE_H