Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 954aeba

Browse files
griswaldbrooksmikeferguson
authored andcommitted
Increase scope of costmap mutex in publishCostmap to cover costmap calls (#992)
1 parent 494496c commit 954aeba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

costmap_2d/src/costmap_2d_publisher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void Costmap2DPublisher::publishCostmap()
125125
return;
126126
}
127127

128+
boost::unique_lock<Costmap2D::mutex_t> lock(*(costmap_->getMutex()));
128129
float resolution = costmap_->getResolution();
129130

130131
if (always_send_full_costmap_ || grid_.info.resolution != resolution ||
@@ -138,7 +139,6 @@ void Costmap2DPublisher::publishCostmap()
138139
}
139140
else if (x0_ < xn_)
140141
{
141-
boost::unique_lock<Costmap2D::mutex_t> lock(*(costmap_->getMutex()));
142142
// Publish Just an Update
143143
map_msgs::OccupancyGridUpdate update;
144144
update.header.stamp = ros::Time::now();

0 commit comments

Comments
 (0)