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/reader/SensorReaderTurn.h

57 lines
850 B
C++
Executable File

#ifndef SENSORREADERTURN_H
#define SENSORREADERTURN_H
#include <fstream>
/** entry for one sensor */
struct SensorEntryTurn {
/** timestamp of occurrence */
float ts;
/** sensor data */
float delta_heading;
float delta_motion;
};
/** read sensor data from CSV */
class SensorReaderTurn {
private:
std::ifstream fp;
public:
SensorReaderTurn(const std::string& file) {
fp.open(file);
assert(fp.is_open());
}
bool hasNext() {
return !fp.bad() && !fp.eof();
}
/** read the next sensor entry */
SensorEntryTurn getNext() {
char delim;
SensorEntryTurn entry;
fp >> entry.ts;
fp >> delim;
fp >> entry.delta_heading;
fp >> delim;
fp >> entry.delta_motion;
return entry;
}
};
#endif // SENSORREADERTURN_H