WaitForAllComputation waits for work queue (#754)

master
gaschler 2017-12-13 18:49:22 +01:00 committed by Wally B. Feed
parent 59d1b968bc
commit f8452821d7
2 changed files with 4 additions and 3 deletions

View File

@ -60,7 +60,7 @@ class PoseGraphInterface {
PoseGraphInterface(const PoseGraphInterface&) = delete; PoseGraphInterface(const PoseGraphInterface&) = delete;
PoseGraphInterface& operator=(const PoseGraphInterface&) = delete; PoseGraphInterface& operator=(const PoseGraphInterface&) = delete;
// Computes optimized poses. // Waits for all computations to finish and computes optimized poses.
virtual void RunFinalOptimization() = 0; virtual void RunFinalOptimization() = 0;
// Returns data for all submaps. // Returns data for all submaps.

View File

@ -351,8 +351,9 @@ void PoseGraph::WaitForAllComputations() {
constraint_builder_.GetNumFinishedNodes(); constraint_builder_.GetNumFinishedNodes();
while (!locker.AwaitWithTimeout( while (!locker.AwaitWithTimeout(
[this]() REQUIRES(mutex_) { [this]() REQUIRES(mutex_) {
return constraint_builder_.GetNumFinishedNodes() == return ((constraint_builder_.GetNumFinishedNodes() ==
num_trajectory_nodes_; num_trajectory_nodes_) &&
!work_queue_);
}, },
common::FromSeconds(1.))) { common::FromSeconds(1.))) {
std::ostringstream progress_info; std::ostringstream progress_info;