86 lines
1.9 KiB
C
86 lines
1.9 KiB
C
#ifndef STATE_H
|
|
#define STATE_H
|
|
|
|
#include <Indoor/grid/walk/v2/GridWalker.h>
|
|
#include <Indoor/grid/walk/v2/modules/WalkModuleActivityControl.h>
|
|
#include <Indoor/grid/walk/v2/modules/WalkModuleHeadingControl.h>
|
|
#include <Indoor/grid/walk/v2/modules/WalkModuleNodeImportance.h>
|
|
#include <Indoor/grid/walk/v2/modules/WalkModuleFavorZ.h>
|
|
|
|
#include <Indoor/sensors/radio/WiFiMeasurements.h>
|
|
#include <Indoor/sensors/gps/GPSData.h>
|
|
|
|
struct MyState : public WalkState, public WalkStateFavorZ, public WalkStateHeading {
|
|
|
|
|
|
/** ctor */
|
|
MyState(const int x_cm, const int y_cm, const int z_cm) : WalkState(GridPoint(x_cm, y_cm, z_cm)), WalkStateHeading(Heading(0), 0) {
|
|
;
|
|
}
|
|
|
|
MyState() : WalkState(GridPoint()), WalkStateHeading(Heading(0), 0) {
|
|
;
|
|
}
|
|
|
|
MyState& operator += (const MyState& o) {
|
|
position += o.position;
|
|
return *this;
|
|
}
|
|
|
|
MyState& operator /= (const float val) {
|
|
position /= val;
|
|
return *this;
|
|
}
|
|
|
|
MyState operator * (const float val) const {
|
|
MyState copy = *this;
|
|
copy.position = copy.position * val;
|
|
return copy;
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
/** observed sensor data */
|
|
struct MyObservation {
|
|
|
|
/** wifi measurements */
|
|
WiFiMeasurements wifi;
|
|
|
|
/** gps measurements */
|
|
GPSData gps;
|
|
|
|
// TODO: switch to a general activity enum/detector for barometer + accelerometer + ...?
|
|
/** detected activity */
|
|
Activity activity;
|
|
|
|
/** time of evaluation */
|
|
Timestamp currentTime;
|
|
|
|
};
|
|
|
|
/** (observed) control data */
|
|
struct MyControl {
|
|
|
|
/** turn angle (in radians) since the last transition */
|
|
float turnSinceLastTransition_rad = 0;
|
|
|
|
/** number of steps since the last transition */
|
|
int numStepsSinceLastTransition = 0;
|
|
|
|
// TODO: switch to a general activity enum/detector using barometer + accelerometer?
|
|
/** currently detected activity */
|
|
Activity activity;
|
|
|
|
/** reset the control-data after each transition */
|
|
void resetAfterTransition() {
|
|
turnSinceLastTransition_rad = 0;
|
|
numStepsSinceLastTransition = 0;
|
|
}
|
|
|
|
};
|
|
|
|
#endif // STATE_H
|