Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid generating the exception when rcl_send_response times out. #1136

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion rclpy/src/rclpy/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,16 @@ Service::service_send_response(py::object pyresponse, rmw_request_id_t * header)

rcl_ret_t ret = rcl_send_response(rcl_service_.get(), header, raw_ros_response.get());
if (RCL_RET_OK != ret) {
throw RCLError("failed to send response");
if (RCL_RET_TIMEOUT == ret) {
// Warning should use line number of the current stack frame
int stack_level = 1;
PyErr_WarnFormat(
PyExc_RuntimeWarning, stack_level, "failed to send response (timeout): %s",
rcl_get_error_string().str);
rcl_reset_error();
} else {
throw RCLError("failed to send response");
}
}
}

Expand Down