MapOptimizer: fixed a crash when optimizing a global map received

This commit is contained in:
matlabbe
2015-07-19 20:20:26 -04:00
parent 93c5b60c04
commit de98828dc3
+1 -3
View File
@@ -194,7 +194,6 @@ public:
} }
} }
} }
// Optimize only if there is a subscriber // Optimize only if there is a subscriber
if(mapDataPub_.getNumSubscribers()) if(mapDataPub_.getNumSubscribers())
{ {
@@ -214,9 +213,8 @@ public:
posesOut, posesOut,
linksOut); linksOut);
optimizedPoses = optimizer.optimize(fromId, posesOut, linksOut); optimizedPoses = optimizer.optimize(fromId, posesOut, linksOut);
mapToOdomMutex_.lock(); mapToOdomMutex_.lock();
mapCorrection = optimizedPoses.at(poses.rbegin()->first) * poses.rbegin()->second.inverse(); mapCorrection = optimizedPoses.at(posesOut.rbegin()->first) * posesOut.rbegin()->second.inverse();
mapToOdom_ = mapCorrection; mapToOdom_ = mapCorrection;
mapToOdomMutex_.unlock(); mapToOdomMutex_.unlock();
} }