Skip to content

Commit

Permalink
Fix race condition in AMCL for ros-navigation#4537 (ros-navigation#4605)
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Duchesne <[email protected]>
  • Loading branch information
SteveMacenski authored and josephduchesne committed Dec 10, 2024
1 parent c01ec92 commit 873572a
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 873572a

Please sign in to comment.