worked on synthetic sensors

worked on grid-walker
minor changes/fixes/improvements
This commit is contained in:
k-a-z-u
2017-10-18 16:54:57 +02:00
parent 72f083d32a
commit 3e31f6da53
8 changed files with 522 additions and 71 deletions

View File

@@ -83,6 +83,10 @@ namespace Offline {
// get all sensor events from the offline file
const std::vector<Entry> events = reader->getEntries();
// reference time (system vs. first-event)
Timestamp tsRef1 = Timestamp::fromMS(events.front().ts);
Timestamp tsRef2 = Timestamp::fromRunningTime();
// process every event
for (const Entry& e : events) {
@@ -92,6 +96,14 @@ namespace Offline {
// timestamp
const Timestamp ts = Timestamp::fromMS(e.ts);
// ensure events happen occur fast as they did during recording
if (realtime) {
const Timestamp ts1 = ts-tsRef1;
const Timestamp ts2 = Timestamp::fromRunningTime() - tsRef2;
const Timestamp diff = ts1-ts2;
if (diff.ms() > 0) {std::this_thread::sleep_for(std::chrono::milliseconds(diff.ms()));}
}
// event index
const size_t idx = e.idx;