Skip to content

Commit

Permalink
fixed baro back and forth example)
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Mar 29, 2017
1 parent efe7146 commit 68efe37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Examples/StandAloneSensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ class StandALoneSensors {
output_stream << std::fixed;

double last = Utils::getTimeSinceEpoch();
bool which_alt = false;
for(auto j = 0; j < 10; ++j) {
for (auto i = 0; i < interations_20s; ++i) {
const auto& output = baro.getOutput();
output_stream << Utils::getTimeSinceEpoch() << "\t";
output_stream << output.pressure << "\t" << output.altitude << std::endl;
output_stream << output.pressure << "\t" << output.altitude << "\t" <<
environment.getState().geo_point.altitude << std::endl;


std::this_thread::sleep_for(std::chrono::duration<double>(period - (Utils::getTimeSinceEpoch() - last)));
Expand All @@ -103,7 +105,8 @@ class StandALoneSensors {
baro.update(dt);
}

environment.setPosition(Vector3r(0, 0, environment.getState().geo_point.altitude <= 1.0f ? 1.78f : 0));
which_alt = !which_alt;
environment.setPosition(Vector3r(0, 0, which_alt ? -1.78f : 0));
}
}

Expand Down
4 changes: 2 additions & 2 deletions Examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ int main(int argc, const char *argv[])
std::ofstream out_file(argv[1]);
//StandALoneSensors::createStaticData(out_file, period, total_duration);
//StandALoneSensors::generateBarometerStaticData(out_file, period, total_duration);
//StandALoneSensors::generateBarometerDynamicData(out_file, period, total_duration);
StandALoneSensors::generateMagnetometerDataLoc(out_file, period, total_duration);
StandALoneSensors::generateBarometerDynamicData(out_file, period, total_duration);
//StandALoneSensors::generateMagnetometerDataLoc(out_file, period, total_duration);
}

0 comments on commit 68efe37

Please sign in to comment.