From a0a7237c01779dbc21523c8702c47cc87af1c3b8 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sat, 22 Apr 2017 19:29:13 -0400 Subject: [PATCH] Occupancy grid graph changed detection: Quiet warning when map is empty --- corelib/src/OccupancyGrid.cpp | 2 +- corelib/src/OctoMap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/corelib/src/OccupancyGrid.cpp b/corelib/src/OccupancyGrid.cpp index 9ec74215..9c26dc7e 100644 --- a/corelib/src/OccupancyGrid.cpp +++ b/corelib/src/OccupancyGrid.cpp @@ -424,7 +424,7 @@ void OccupancyGrid::update(const std::map & posesIn) // First, check of the graph has changed. If so, re-create the map by moving all occupied nodes (fullUpdate==false). bool graphOptimized = false; // If a loop closure happened (e.g., poses are modified) - bool graphChanged = true; // If the new map doesn't have any node from the previous map + bool graphChanged = addedNodes_.size()>0; // If the new map doesn't have any node from the previous map std::map transforms; for(std::map::iterator iter=addedNodes_.begin(); iter!=addedNodes_.end(); ++iter) { diff --git a/corelib/src/OctoMap.cpp b/corelib/src/OctoMap.cpp index b7cf45df..542604da 100644 --- a/corelib/src/OctoMap.cpp +++ b/corelib/src/OctoMap.cpp @@ -89,7 +89,7 @@ void OctoMap::update(const std::map & poses) // First, check of the graph has changed. If so, re-create the octree by moving all occupied nodes. bool graphOptimized = false; // If a loop closure happened (e.g., poses are modified) - bool graphChanged = true; // If the new map doesn't have any node from the previous map + bool graphChanged = addedNodes_.size()>0; // If the new map doesn't have any node from the previous map std::map transforms; std::map updatedAddedNodes; for(std::map::iterator iter=addedNodes_.begin(); iter!=addedNodes_.end(); ++iter)