fixed some compiler warnings

added equality checks to sensor-data classes
more robust sensor reader [fixed some issues]
added support for gps
added support for compass
added sensor-data-writer
added test-cases
minor changes
This commit is contained in:
2017-03-21 16:25:36 +01:00
parent 18f48e23a8
commit bb43e7f0fe
20 changed files with 807 additions and 266 deletions

View File

@@ -38,7 +38,7 @@ TEST(MotionDetection, motionAxis) {
//table_flat: phone was flat on the table and moved slowly forward/backward for 60 cm.
//std::string filename = getDataFile("motion/table_flat.csv");
FileReader fr(filename);
Offline::FileReader fr(filename);
K::Gnuplot gp;
K::GnuplotPlot plot;
@@ -52,14 +52,14 @@ TEST(MotionDetection, motionAxis) {
Timestamp lastTs;
//calc motion axis
for (const FileReader::Entry& e : fr.getEntries()) {
for (const Offline::Entry& e : fr.getEntries()) {
ts = Timestamp::fromMS(e.ts);
if (e.type == FileReader::Sensor::LIN_ACC) {
if (e.type == Offline::Sensor::LIN_ACC) {
md.addLinearAcceleration(ts, fr.getLinearAcceleration()[e.idx].data);
} else if (e.type == FileReader::Sensor::GRAVITY) {
} else if (e.type == Offline::Sensor::GRAVITY) {
md.addGravity(ts, fr.getGravity()[e.idx].data);
curVec = md.getCurrentMotionAxis();
motionAxisAngleRad = md.getMotionChangeInRad();
@@ -126,7 +126,7 @@ TEST(MotionDetection, motionAngle) {
//table_flat: phone was flat on the table and moved slowly forward/backward for 60 cm.
//std::string filename = getDataFile("motion/table_flat.csv");
FileReader fr(filename);
Offline::FileReader fr(filename);
Timestamp ts;
//save for later plotting
@@ -134,23 +134,23 @@ TEST(MotionDetection, motionAngle) {
std::vector<float> delta_turnAngles;
//calc motion axis
for (const FileReader::Entry& e : fr.getEntries()) {
for (const Offline::Entry& e : fr.getEntries()) {
ts = Timestamp::fromMS(e.ts);
if (e.type == FileReader::Sensor::LIN_ACC) {
if (e.type == Offline::Sensor::LIN_ACC) {
md.addLinearAcceleration(ts, fr.getLinearAcceleration()[e.idx].data);
} else if (e.type == FileReader::Sensor::GRAVITY) {
} else if (e.type == Offline::Sensor::GRAVITY) {
md.addGravity(ts, fr.getGravity()[e.idx].data);
delta_motionAngles.push_back(md.getMotionChangeInRad());
} else if (e.type == FileReader::Sensor::ACC) {
const FileReader::TS<AccelerometerData>& _acc = fr.getAccelerometer()[e.idx];
} else if (e.type == Offline::Sensor::ACC) {
const Offline::TS<AccelerometerData>& _acc = fr.getAccelerometer()[e.idx];
td.addAccelerometer(ts, _acc.data);
} else if (e.type == FileReader::Sensor::GYRO) {
const FileReader::TS<GyroscopeData>& _gyr = fr.getGyroscope()[e.idx];
} else if (e.type == Offline::Sensor::GYRO) {
const Offline::TS<GyroscopeData>& _gyr = fr.getGyroscope()[e.idx];
delta_turnAngles.push_back(td.addGyroscope(ts, _gyr.data));
}