Skip to content

Commit

Permalink
check getCurrentPose in initialiseGoalPoses (#4341)
Browse files Browse the repository at this point in the history
This mirrors the check done in NavigateToPose::initializeGoalPose
checking that we can get a current pose in order to not accept
the goal request.

Signed-off-by: Mike Wake <[email protected]>
  • Loading branch information
aosmw committed Jul 11, 2024
1 parent ccc0a4b commit c9b4d28
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nav2_bt_navigator/src/navigators/navigate_through_poses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ NavigateThroughPosesNavigator::onPreempt(ActionT::Goal::ConstSharedPtr goal)
bool
NavigateThroughPosesNavigator::initializeGoalPoses(ActionT::Goal::ConstSharedPtr goal)
{
geometry_msgs::msg::PoseStamped current_pose;
if (!nav2_util::getCurrentPose(
current_pose, *feedback_utils_.tf,
feedback_utils_.global_frame, feedback_utils_.robot_frame,
feedback_utils_.transform_tolerance))
{
current_error_code_ = ActionT::Result::POSE_NOT_AVAILABLE;
current_error_msg_ = "Initial robot pose is not available.";
RCLCPP_ERROR(logger_, current_error_msg_.c_str());
return false;
}

Goals goal_poses = goal->poses;
int i = 0;
for (auto & goal_pose : goal_poses) {
Expand Down

0 comments on commit c9b4d28

Please sign in to comment.