Skip to content

Commit 75f24c4

Browse files
Added error handling about update_ndt
Signed-off-by: Shintaro Sakoda <shintaro.sakoda@tier4.jp>
1 parent 7081a61 commit 75f24c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

localization/ndt_scan_matcher/src/map_update_module.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
7878

7979
ndt_ptr_->setParams(param);
8080

81-
update_ndt(position, *ndt_ptr_);
81+
const bool updated = update_ndt(position, *ndt_ptr_);
82+
if (!updated) {
83+
RCLCPP_ERROR_STREAM_THROTTLE(
84+
logger_, *clock_, 1000,
85+
"update_ndt failed. If this happens with initial position estimation, make sure that"
86+
"(1) the initial position matches the pcd map and (2) the map_loader is working properly.");
87+
last_update_position_ = position;
88+
ndt_ptr_mutex_->unlock();
89+
return;
90+
}
8291
ndt_ptr_->setInputSource(input_source);
8392
ndt_ptr_mutex_->unlock();
8493
need_rebuild_ = false;

0 commit comments

Comments
 (0)