Acquire mutex before copying landmark poses. (#1007)
parent
4cc758e830
commit
e48e21849a
|
@ -616,6 +616,7 @@ MapById<NodeId, TrajectoryNodePose> PoseGraph2D::GetTrajectoryNodePoses() {
|
||||||
|
|
||||||
std::map<std::string, transform::Rigid3d> PoseGraph2D::GetLandmarkPoses() {
|
std::map<std::string, transform::Rigid3d> PoseGraph2D::GetLandmarkPoses() {
|
||||||
std::map<std::string, transform::Rigid3d> landmark_poses;
|
std::map<std::string, transform::Rigid3d> landmark_poses;
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
for (const auto& landmark : landmark_nodes_) {
|
for (const auto& landmark : landmark_nodes_) {
|
||||||
// Landmark without value has not been optimized yet.
|
// Landmark without value has not been optimized yet.
|
||||||
if (!landmark.second.global_landmark_pose.has_value()) continue;
|
if (!landmark.second.global_landmark_pose.has_value()) continue;
|
||||||
|
|
|
@ -659,6 +659,7 @@ MapById<NodeId, TrajectoryNodePose> PoseGraph3D::GetTrajectoryNodePoses() {
|
||||||
|
|
||||||
std::map<std::string, transform::Rigid3d> PoseGraph3D::GetLandmarkPoses() {
|
std::map<std::string, transform::Rigid3d> PoseGraph3D::GetLandmarkPoses() {
|
||||||
std::map<std::string, transform::Rigid3d> landmark_poses;
|
std::map<std::string, transform::Rigid3d> landmark_poses;
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
for (const auto& landmark : landmark_nodes_) {
|
for (const auto& landmark : landmark_nodes_) {
|
||||||
// Landmark without value has not been optimized yet.
|
// Landmark without value has not been optimized yet.
|
||||||
if (!landmark.second.global_landmark_pose.has_value()) continue;
|
if (!landmark.second.global_landmark_pose.has_value()) continue;
|
||||||
|
|
Loading…
Reference in New Issue