mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-11 03:59:53 +08:00
MapOptimizer: fixed a crash when optimizing a global map received
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user