Skip to content

Commit f06d431

Browse files
committed
Removed unused debug variable and rename rebuild_ to need_rebuild_ for better understanding
Signed-off-by: anhnv3991 <anh.nguyen.2@tier4.jp>
1 parent b48e108 commit f06d431

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class MapUpdateModule
8484

8585
// Indicate if there is a prefetch thread waiting for being collected
8686
NdtPtrType secondary_ndt_ptr_;
87-
bool rebuild_;
87+
bool need_rebuild_;
8888
};
8989

9090
#endif // NDT_SCAN_MATCHER__MAP_UPDATE_MODULE_HPP_

localization/ndt_scan_matcher/src/map_update_module.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ MapUpdateModule::MapUpdateModule(
4040
// From the second update, the update is done on secondary_ndt_ptr_,
4141
// and ndt_ptr_ is only locked when swapping its pointer with
4242
// secondary_ndt_ptr_.
43-
rebuild_ = true;
43+
need_rebuild_ = true;
4444
}
4545

4646
bool MapUpdateModule::should_update_map(const geometry_msgs::msg::Point & position)
@@ -56,7 +56,7 @@ bool MapUpdateModule::should_update_map(const geometry_msgs::msg::Point & positi
5656
RCLCPP_ERROR_STREAM_THROTTLE(logger_, *clock_, 1000, "Dynamic map loading is not keeping up.");
5757
// If the map does not keep up with the current position,
5858
// lock ndt_ptr_ entirely until it is fully rebuilt.
59-
rebuild_ = true;
59+
need_rebuild_ = true;
6060
}
6161

6262
return distance > param_.update_distance;
@@ -95,7 +95,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
9595
{
9696
// If the current position is super far from the previous loading position,
9797
// lock and rebuild ndt_ptr_
98-
if (rebuild_) {
98+
if (need_rebuild_) {
9999
ndt_ptr_mutex_->lock();
100100
auto param = ndt_ptr_->getParams();
101101

@@ -105,7 +105,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
105105

106106
prefetch_map(position, ndt_ptr_);
107107
ndt_ptr_mutex_->unlock();
108-
rebuild_ = false;
108+
need_rebuild_ = false;
109109
} else {
110110
// Load map to the secondary_ndt_ptr, which does not require a mutex lock
111111
// Since the update of the secondary ndt ptr and the NDT align (done on
@@ -172,8 +172,6 @@ void MapUpdateModule::update_ndt(
172172
RCLCPP_INFO(logger_, "Time duration for creating new ndt_ptr: %lf [ms]", exe_time);
173173
}
174174

175-
int count = 0;
176-
177175
void MapUpdateModule::publish_partial_pcd_map()
178176
{
179177
pcl::PointCloud<PointTarget> map_pcl = ndt_ptr_->getVoxelPCD();

0 commit comments

Comments
 (0)