diff --git a/src/plugins/ros2/navigator_thread.cpp b/src/plugins/ros2/navigator_thread.cpp index 2f6a975969..3f2df5ede6 100644 --- a/src/plugins/ros2/navigator_thread.cpp +++ b/src/plugins/ros2/navigator_thread.cpp @@ -199,8 +199,6 @@ ROS2NavigatorThread::send_goal() case rclcpp_action::ResultCode::ABORTED: { nav_if_->set_final(true); - nav_if_->set_error_code(NavigatorInterface::ERROR_PATH_GEN_FAIL); - nav_if_->write(); std::stringstream ss; for (std::size_t i = 0; i < 16; i++) { if (i != 0) { @@ -211,7 +209,12 @@ ROS2NavigatorThread::send_goal() logger->log_warn(name(), ("Aborted goal with id: " + ss.str()).c_str()); auto val = result.result; + logger->log_error(name(), "Navigation Goal failed with error_code: %d", val->error_code); + + uint32_t error_code = (uint32_t)val->error_code; + nav_if_->set_error_code(error_code); + nav_if_->write(); } break; case rclcpp_action::ResultCode::CANCELED: {