final version of paper

This commit is contained in:
toni
2016-06-02 15:57:53 +02:00
parent 0f4435f86a
commit 927bec3e60
14 changed files with 119 additions and 132 deletions

View File

@@ -19,9 +19,11 @@
#include "../reader/SensorReader.h"
#include "../reader/SensorReaderStep.h"
#include "../reader/SensorReaderTurn.h"
#include "../reader/SensorReaderAccel.h"
#include "../lukas/TurnObservation.h"
#include "../lukas/StepObservation.h"
#include "../lukas/ActivityDetection.h"
#include "../toni/BarometerSensorReader.h"
@@ -127,8 +129,9 @@ public:
void run() {
// sensor numbers
const int s_wifi = 8; const int s_beacons = 9; const int s_barometer = 5; const int s_orientation = 6;
//const int s_linearAcceleration = 2;
const int s_wifi = 8; const int s_beacons = 9; const int s_barometer = 5; const int s_orientation = 6;
const int s_accel = 0;
std::list<TurnObservation> turn_observations;
std::list<StepObservation> step_observations;
@@ -136,6 +139,9 @@ public:
//Create an BarometerSensorReader
BarometerSensorReader baroSensorReader;
// activity detection
ActivityDetection actDet;
//Read all turn Observations
while(srt->hasNext()) {
@@ -213,9 +219,17 @@ public:
case s_barometer: {
obs.barometer = baroSensorReader.readBarometer(se);
actDet.addBaro(baroSensorReader.getHPA(se));
break;
}
case s_accel: {
float acc[3];
SensorReaderAccel sre; sre.read(se, acc);
actDet.addAccel(acc);
break;
}
// case s_linearAcceleration:{
// baroSensorReader.readVerticalAcceleration(se);
// break;
@@ -244,6 +258,11 @@ public:
}
ctrl.currentActivitiy = actDet.getCurrentActivity();
// this is just for testing purposes
obs.currentActivity = actDet.getCurrentActivity();
// time for a transition?
if (se.ts - lastTransitionTS > MiscSettings::timeSteps) {
@@ -268,7 +287,7 @@ public:
auto tick2 = Time::tick();
float diffTime = Time::diffMS(tick1, tick2) * 1.25f;
statsTime.add(diffTime);
std::cout << "#" << statsTime.getAvg() << "\t" << diffTime << std::endl;
//std::cout << "#" << statsTime.getAvg() << "\t" << diffTime << std::endl;
// skip the first 10 scans due to uniform distribution start
@@ -279,7 +298,7 @@ public:
// skip the first 24 scans due to uniform distribution start (12 seconds)
if (++cnt > 24) {
stats.add(err);
std::cout << stats.asString() << std::endl;
//std::cout << stats.asString() << std::endl;
}
// plot
@@ -297,6 +316,7 @@ public:
vis.gp << "set label 112 'baro: " << obs.barometer->hpa << "' at screen 0.1,0.2\n";
}
vis.gp << "set label 111 '" <<ctrl.walked_m << ":" << ctrl.headingChange_rad << "' at screen 0.1,0.1\n";
vis.gp << "set label 112 '" << "Act: " << actDet.toString() << "' at screen 0.1,0.15\n";
//vis.gp << "set label 111 '" <<ctrl.walked_m << ":" << obs.orientation.values[0] << "' at screen 0.1,0.1\n";
@@ -305,12 +325,12 @@ public:
//Point2 p2 = p1 + Angle::getPointer(obs.orientation.values[0]) * 0.05;
vis.gp << "set arrow 999 from screen " << p1.x<<","<<p1.y << " to screen " << p2.x<<","<<p2.y<<"\n";
static int dspCnt = 0;
if (++dspCnt > 0) {
vis.show();
usleep(1000*33); // prevent gnuplot errors
dspCnt = 0;
}
// static int dspCnt = 0;
// if (++dspCnt > 0) {
// vis.show();
// usleep(1000*33); // prevent gnuplot errors
// dspCnt = 0;
// }
}