Skip to content

Commit

Permalink
Fix race condition in AMCL for #4537
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMacenski committed Aug 7, 2024
1 parent 31b9557 commit 19fdf5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nav2_amcl/src/amcl_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ AmclNode::initialPoseReceived(geometry_msgs::msg::PoseWithCovarianceStamped::Sha
global_frame_id_.c_str());
return;
}
if (abs(msg->pose.pose.position.x) > map_->size_x ||
abs(msg->pose.pose.position.y) > map_->size_y)
if (first_map_received_ && (abs(msg->pose.pose.position.x) > map_->size_x ||
abs(msg->pose.pose.position.y) > map_->size_y))
{
RCLCPP_ERROR(
get_logger(), "Received initialpose from message is out of the size of map. Rejecting.");
Expand Down

0 comments on commit 19fdf5c

Please sign in to comment.