65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
#ifndef WALKMODULEBUTTERACTIVITY_H
|
|
#define WALKMODULEBUTTERACTIVITY_H
|
|
|
|
#include "WalkModule.h"
|
|
#include "WalkStateHeading.h"
|
|
|
|
#include "../../../../geo/Heading.h"
|
|
#include "../../../../math/Distributions.h"
|
|
#include "../../../../sensors/pressure/ActivityButterPressure.h"
|
|
|
|
|
|
/** favor z-transitions */
|
|
template <typename Node, typename WalkState> class WalkModuleButterActivity : public WalkModule<Node, WalkState> {
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
WalkModuleButterActivity() {
|
|
;
|
|
}
|
|
|
|
virtual void updateBefore(WalkState& state) override {
|
|
(void) state;
|
|
}
|
|
|
|
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.act == ActivityButterPressure::Activity::DOWN){
|
|
if (deltaZ_cm < 0) {return 0;}
|
|
if (deltaZ_cm == 0) {return 0.1;}
|
|
return 0.9;
|
|
} else if (state.act == 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
|