From 2d3c8b2a0f267619f120e148b328fcbc6639d66e Mon Sep 17 00:00:00 2001 From: Fabian Paus <fabian.paus@kit.edu> Date: Sat, 19 Oct 2019 13:14:58 +0200 Subject: [PATCH] Fix sync bug --- .../components/ArViz/Coin/Visualizer.cpp | 16 +++++++++------- .../components/ArVizExample/ArVizExample.cpp | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/RobotAPI/components/ArViz/Coin/Visualizer.cpp b/source/RobotAPI/components/ArViz/Coin/Visualizer.cpp index 81a70d33e..cf1c8de77 100644 --- a/source/RobotAPI/components/ArViz/Coin/Visualizer.cpp +++ b/source/RobotAPI/components/ArViz/Coin/Visualizer.cpp @@ -262,6 +262,7 @@ namespace armarx::viz layers.clear(); pulledUpdates.updateCounter = 0; pulledUpdates.updates.clear(); + updateResult = CoinVisualizerUpdateResult::SUCCESS; state = CoinVisualizerState::RUNNING; } break; @@ -290,13 +291,14 @@ namespace armarx::viz // We should restart the pull for updates so it can run in parallel updateResult = CoinVisualizerUpdateResult::WAITING; - storage->begin_pullUpdatesSince(pulledUpdates.updateCounter, callback); + LayerUpdates currentUpdates = pulledUpdates; + storage->begin_pullUpdatesSince(currentUpdates.updateCounter, callback); auto layerIDsBefore = getLayerIDs(); IceUtil::Time time_afterPull = IceUtil::Time::now(); - for (LayerUpdate const& update : pulledUpdates.updates) + for (LayerUpdate const& update : currentUpdates.updates) { apply(update); } @@ -310,11 +312,11 @@ namespace armarx::viz IceUtil::Time time_afterLayersChanged = IceUtil::Time::now(); // Most of the time is spent in apply - ARMARX_INFO << "Updates: " << pulledUpdates.updates.size() - << "\nTotal: " << (time_afterLayersChanged - time_start).toMilliSecondsDouble() - << "\nPull: " << (time_afterPull - time_start).toMilliSecondsDouble() - << "\nApply: " << (time_afterApply - time_afterPull).toMilliSecondsDouble() - << "\nLayers: " << (time_afterLayersChanged - time_afterApply).toMilliSecondsDouble(); + // ARMARX_INFO << "Updates: " << pulledUpdates.updates.size() + // << "\nTotal: " << (time_afterLayersChanged - time_start).toMilliSecondsDouble() + // << "\nPull: " << (time_afterPull - time_start).toMilliSecondsDouble() + // << "\nApply: " << (time_afterApply - time_afterPull).toMilliSecondsDouble() + // << "\nLayers: " << (time_afterLayersChanged - time_afterApply).toMilliSecondsDouble(); } break; case CoinVisualizerUpdateResult::WAITING: diff --git a/source/RobotAPI/components/ArVizExample/ArVizExample.cpp b/source/RobotAPI/components/ArVizExample/ArVizExample.cpp index b112aeac7..11e153134 100644 --- a/source/RobotAPI/components/ArVizExample/ArVizExample.cpp +++ b/source/RobotAPI/components/ArVizExample/ArVizExample.cpp @@ -709,12 +709,12 @@ void fillPointsLayer(viz::Layer& layer, double timeInSeconds) viz::ColoredPoint p; p.color = viz::Color{255, 255, 0, 255}; - for (int x = -400; x <= 400; ++x) + for (int x = -200; x <= 200; ++x) { p.x = 2.0f * x; double phase = timeInSeconds + x / 50.0f; double heightT = std::max(0.0, std::min(0.5 * (1.0 + std::sin(phase)), 1.0)); - for (int y = -400; y <= 400; ++y) + for (int y = -200; y <= 200; ++y) { p.y = 2.0f * y; p.z = 100.0 * heightT; -- GitLab