added c++11 fixes
removed old components disabled activity (for compiling reasons) added wifi 2.4ghz hack
This commit is contained in:
@@ -167,20 +167,21 @@ public:
|
||||
|
||||
}
|
||||
|
||||
double getStairProb(const K::Particle<MyState>& p, const ActivityButterPressure::Activity act) {
|
||||
double getStairProb(const K::Particle<MyState>& p, const Activity act) {
|
||||
|
||||
const float kappa = 0.75;
|
||||
|
||||
const MyGridNode& gn = grid->getNodeFor(p.state.position);
|
||||
switch (act) {
|
||||
|
||||
case ActivityButterPressure::Activity::STAY:
|
||||
case Activity::STANDING:
|
||||
case Activity::WALKING:
|
||||
if (gn.getType() == GridNode::TYPE_FLOOR) {return kappa;}
|
||||
if (gn.getType() == GridNode::TYPE_DOOR) {return kappa;}
|
||||
{return 1-kappa;}
|
||||
|
||||
case ActivityButterPressure::Activity::UP:
|
||||
case ActivityButterPressure::Activity::DOWN:
|
||||
case Activity::WALKING_UP:
|
||||
case Activity::WALKING_DOWN:
|
||||
if (gn.getType() == GridNode::TYPE_STAIR) {return kappa;}
|
||||
if (gn.getType() == GridNode::TYPE_ELEVATOR) {return kappa;}
|
||||
{return 1-kappa;}
|
||||
|
||||
@@ -45,8 +45,9 @@ class NavController :
|
||||
public SensorListener<WiFiMeasurements>,
|
||||
public SensorListener<GPSData>,
|
||||
public SensorListener<StepData>,
|
||||
public SensorListener<TurnData>,
|
||||
public SensorListener<ActivityData> {
|
||||
public SensorListener<TurnData>
|
||||
//public SensorListener<ActivityData>
|
||||
{
|
||||
|
||||
|
||||
private:
|
||||
@@ -116,7 +117,7 @@ public:
|
||||
SensorFactory::get().getWiFi().addListener(this);
|
||||
SensorFactory::get().getSteps().addListener(this);
|
||||
SensorFactory::get().getTurns().addListener(this);
|
||||
SensorFactory::get().getActivity().addListener(this);
|
||||
//SensorFactory::get().getActivity().addListener(this);
|
||||
|
||||
// hacky.. but we need to call this one from the main thread!
|
||||
//mainController->getMapView()->showParticles(pf->getParticles());
|
||||
@@ -211,14 +212,14 @@ public:
|
||||
gotSensorData(ts);
|
||||
}
|
||||
|
||||
void onSensorData(Sensor<ActivityData>* sensor, const Timestamp ts, const ActivityData& data) override {
|
||||
(void) sensor;
|
||||
(void) ts;
|
||||
curCtrl.activity = data.curActivity;
|
||||
curObs.activity = data.curActivity;
|
||||
debugActivity(data.curActivity);
|
||||
gotSensorData(ts);
|
||||
}
|
||||
// void onSensorData(Sensor<ActivityData>* sensor, const Timestamp ts, const ActivityData& data) override {
|
||||
// (void) sensor;
|
||||
// (void) ts;
|
||||
// curCtrl.activity = data.curActivity;
|
||||
// curObs.activity = data.curActivity;
|
||||
// debugActivity(data.curActivity);
|
||||
// gotSensorData(ts);
|
||||
// }
|
||||
|
||||
int cameraMode = 0;
|
||||
void toggleCamera() {
|
||||
@@ -234,16 +235,16 @@ private:
|
||||
}
|
||||
|
||||
|
||||
void debugActivity(const ActivityData& activity) {
|
||||
QString act;
|
||||
switch(activity.curActivity) {
|
||||
case ActivityButterPressure::Activity::STAY: act = "STAY"; break;
|
||||
case ActivityButterPressure::Activity::DOWN: act = "DOWN"; break;
|
||||
case ActivityButterPressure::Activity::UP: act = "UP"; break;
|
||||
default: act = "???"; break;
|
||||
}
|
||||
Assert::isTrue(QMetaObject::invokeMethod(mainController->getInfoWidget(), "showActivity", Qt::QueuedConnection, Q_ARG(const QString&, act)), "call failed");
|
||||
}
|
||||
// void debugActivity(const ActivityData& activity) {
|
||||
// QString act;
|
||||
// switch(activity.curActivity) {
|
||||
// case ActivityButterPressure::Activity::STAY: act = "STAY"; break;
|
||||
// case ActivityButterPressure::Activity::DOWN: act = "DOWN"; break;
|
||||
// case ActivityButterPressure::Activity::UP: act = "UP"; break;
|
||||
// default: act = "???"; break;
|
||||
// }
|
||||
// Assert::isTrue(QMetaObject::invokeMethod(mainController->getInfoWidget(), "showActivity", Qt::QueuedConnection, Q_ARG(const QString&, act)), "call failed");
|
||||
// }
|
||||
|
||||
/** particle-filter update loop */
|
||||
void filterUpdateLoop() {
|
||||
|
||||
@@ -54,7 +54,7 @@ struct MyObservation {
|
||||
|
||||
// TODO: switch to a general activity enum/detector for barometer + accelerometer + ...?
|
||||
/** detected activity */
|
||||
ActivityButterPressure::Activity activity;
|
||||
Activity activity;
|
||||
|
||||
/** time of evaluation */
|
||||
Timestamp currentTime;
|
||||
@@ -72,7 +72,7 @@ struct MyControl {
|
||||
|
||||
// TODO: switch to a general activity enum/detector using barometer + accelerometer?
|
||||
/** currently detected activity */
|
||||
ActivityButterPressure::Activity activity;
|
||||
Activity activity;
|
||||
|
||||
/** reset the control-data after each transition */
|
||||
void resetAfterTransition() {
|
||||
|
||||
Reference in New Issue
Block a user