ros2 / ros2/rclcpp

Client (async_send_request) could not return when the data (message) is lost

Open
#455 8 comments 0 reactions 1 assignee View on GitHub

@wjwwood is already working on this.

Since Feb 6, 2019.

question ready
Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

In ROS2 client, if the message is lost, the client function async_send_request will not return any more. I try to solve the problem in rmw level and hack the code in function rmw_take_response to return RMW_RET_ERROR if the message is lost, but it doesn't work.

The reason is that:

In function Executor::execute_client:

   if (status == RCL_RET_OK) {
        client->handle_response(request_header, response);
    } else if (status != RCL_RET_CLIENT_TAKE_FAILED) {
       fprintf(stderr,
      "[rclcpp::error] take response failed for client of service '%s': %s\n",
       client->get_service_name().c_str(), rcl_get_error_string_safe());
      rcl_reset_error();
  }

If the return value is Error, the function handle_response could not be executed.

However, in function handle_response

{
    // ...
    call_promise->set_value(typed_response);
    callback(future);
}

If the callback(future) is not executed, the async_send_request will not return f.

So I wonder if this problem can be solved in rclcpp? Because in our implementation in rmw, the message may be lost.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.