@@ -345,7 +345,16 @@ ServerBase::execute_goal_request_received(std::shared_ptr<void> & data)
345345 }
346346
347347 if (RCL_RET_OK != ret) {
348- rclcpp::exceptions::throw_from_rcl_error (ret);
348+ if (ret == RCL_RET_TIMEOUT) {
349+ RCLCPP_WARN (
350+ pimpl_->logger_ ,
351+ " Failed to send goal response %s (timeout): %s" ,
352+ to_string (uuid).c_str (), rcl_get_error_string ().str );
353+ rcl_reset_error ();
354+ return ;
355+ } else {
356+ rclcpp::exceptions::throw_from_rcl_error (ret);
357+ }
349358 }
350359
351360 const auto status = response_pair.first ;
@@ -484,6 +493,15 @@ ServerBase::execute_cancel_request_received(std::shared_ptr<void> & data)
484493 pimpl_->action_server_ .get (), &request_header, response.get ());
485494 }
486495
496+ if (ret == RCL_RET_TIMEOUT) {
497+ GoalUUID uuid = request->goal_info .goal_id .uuid ;
498+ RCLCPP_WARN (
499+ pimpl_->logger_ ,
500+ " Failed to send cancel response %s (timeout): %s" ,
501+ to_string (uuid).c_str (), rcl_get_error_string ().str );
502+ rcl_reset_error ();
503+ return ;
504+ }
487505 if (RCL_RET_OK != ret) {
488506 rclcpp::exceptions::throw_from_rcl_error (ret);
489507 }
@@ -539,6 +557,14 @@ ServerBase::execute_result_request_received(std::shared_ptr<void> & data)
539557 std::lock_guard<std::recursive_mutex> lock (pimpl_->action_server_reentrant_mutex_ );
540558 rcl_ret_t rcl_ret = rcl_action_send_result_response (
541559 pimpl_->action_server_ .get (), &request_header, result_response.get ());
560+ if (rcl_ret == RCL_RET_TIMEOUT) {
561+ RCLCPP_WARN (
562+ pimpl_->logger_ ,
563+ " Failed to send result response %s (timeout): %s" ,
564+ to_string (uuid).c_str (), rcl_get_error_string ().str );
565+ rcl_reset_error ();
566+ return ;
567+ }
542568 if (RCL_RET_OK != rcl_ret) {
543569 rclcpp::exceptions::throw_from_rcl_error (rcl_ret);
544570 }
@@ -672,7 +698,13 @@ ServerBase::publish_result(const GoalUUID & uuid, std::shared_ptr<void> result_m
672698 for (auto & request_header : iter->second ) {
673699 rcl_ret_t ret = rcl_action_send_result_response (
674700 pimpl_->action_server_ .get (), &request_header, result_msg.get ());
675- if (RCL_RET_OK != ret) {
701+ if (ret == RCL_RET_TIMEOUT) {
702+ RCLCPP_WARN (
703+ pimpl_->logger_ ,
704+ " Failed to send result response %s (timeout): %s" ,
705+ to_string (uuid).c_str (), rcl_get_error_string ().str );
706+ rcl_reset_error ();
707+ } else if (RCL_RET_OK != ret) {
676708 rclcpp::exceptions::throw_from_rcl_error (ret);
677709 }
678710 }
0 commit comments