This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Fusion2016/code/frank/OrientationSensorReader.h
FrankE 716b004f3c changed visualisation
added new eval code for new walkers
improved barometer (moving avg and median)
floorplan-staircase-fixes
disabled step-turn (now part of transition)
added abs-orientation-reader (for testing)
added beacons
2016-02-05 20:21:46 +01:00

43 lines
924 B
C++

#ifndef ORIENTATIONSENSORREADER_H
#define ORIENTATIONSENSORREADER_H
#include "../reader/SensorReader.h"
#include "OrientationObservation.h"
#include <cassert>
class OrientationSensorReader {
public:
/** get wifi observation data from one CSV entry */
static OrientationObservation read(const SensorEntry& se) {
std::string tmp = se.data;
OrientationObservation obs;
size_t pos1 = tmp.find(';');
size_t pos2 = tmp.find(';', pos1+1);
size_t pos3 = tmp.find(';', pos2+1);
assert(pos1 != std::string::npos);
assert(pos2 != std::string::npos);
assert(pos3 != std::string::npos);
const std::string s1 = tmp.substr(0, pos1);
const std::string s2 = tmp.substr(pos1+1, pos2-pos1-1);
const std::string s3 = tmp.substr(pos2+1, pos3-pos2-1);
obs.values[0] = std::stof(s1);
obs.values[1] = std::stof(s2);
obs.values[2] = std::stof(s3);
return obs;
}
};
#endif // ORIENTATIONSENSORREADER_H