needed interface changes [new options] logger for android wifi-ap-optimization new test-cases
87 lines
2.1 KiB
C++
87 lines
2.1 KiB
C++
#ifndef WALKMODULEBUTTERACTIVITY_H
|
|
#define WALKMODULEBUTTERACTIVITY_H
|
|
|
|
#include "WalkModule.h"
|
|
|
|
#include "../../../../geo/Heading.h"
|
|
#include "../../../../math/Distributions.h"
|
|
#include "../../../../sensors/pressure/ActivityButterPressure.h"
|
|
|
|
DEPREACTED
|
|
SEE WalkModuleActivityControl
|
|
|
|
struct WalkStateBarometerActivity {
|
|
|
|
/** innser-struct to prevent name-clashes */
|
|
struct Barometer {
|
|
|
|
/** activity currently detected from the baromter */
|
|
ActivityButterPressure::Activity activity;
|
|
|
|
Barometer() : activity(ActivityButterPressure::Activity::STAY) {;}
|
|
|
|
} barometer;
|
|
|
|
/** ctor */
|
|
WalkStateBarometerActivity() : barometer() {;}
|
|
|
|
};
|
|
|
|
/** favor z-transitions */
|
|
template <typename Node, typename WalkState> class WalkModuleButterActivity : public WalkModule<Node, WalkState> {
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
WalkModuleButterActivity() {
|
|
|
|
// ensure templates WalkState inherits from 'WalkStateBarometerActivity'
|
|
StaticAssert::AinheritsB<WalkState, WalkStateBarometerActivity>();
|
|
|
|
}
|
|
|
|
virtual void updateBefore(WalkState& state, const Node& startNode) override {
|
|
(void) state;
|
|
(void) startNode;
|
|
}
|
|
|
|
virtual void updateAfter(WalkState& state, const Node& startNode, const Node& endNode) override {
|
|
(void) state;
|
|
(void) startNode;
|
|
(void) endNode;
|
|
|
|
}
|
|
|
|
virtual void step(WalkState& state, const Node& curNode, const Node& nextNode) override {
|
|
(void) state;
|
|
(void) curNode;
|
|
(void) nextNode;
|
|
}
|
|
|
|
double getProbability(const WalkState& state, const Node& startNode, const Node& curNode, const Node& potentialNode) const override {
|
|
|
|
(void) state;
|
|
(void) startNode;
|
|
|
|
const int deltaZ_cm = curNode.z_cm - potentialNode.z_cm;
|
|
|
|
if(state.barometer.activity == ActivityButterPressure::Activity::DOWN){
|
|
if (deltaZ_cm < 0) {return 0;}
|
|
if (deltaZ_cm == 0) {return 0.1;}
|
|
return 0.9;
|
|
} else if (state.barometer.activity == ActivityButterPressure::Activity::UP){
|
|
if (deltaZ_cm > 0) {return 0;}
|
|
if (deltaZ_cm == 0) {return 0.1;}
|
|
return 0.9;
|
|
} else {
|
|
if (deltaZ_cm == 0) {return 0.9;}
|
|
return 0.1;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
#endif // WALKMODULEBUTTERACTIVITY_H
|