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

Support intra-process communication between Clients and Services #1847

Open
wants to merge 4 commits into
base: rolling
Choose a base branch
from

Conversation

mauropasse
Copy link
Collaborator

@mauropasse mauropasse commented Dec 16, 2021

These changes extend the intra-process capabilities to support intra-process client/services communication, so no need to go through the DDS when sending client requests / services responses, when they belong to the same process.

Missing: Add unit tests.
Design: https://github.com/mauropasse/design/blob/mauro/gh-pages-ipc-clients-services/articles/intraprocess_communication.md

@clalancette
@alsora

@mauropasse mauropasse marked this pull request as draft December 17, 2021 14:50
@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch 3 times, most recently from 17a8555 to 78ea732 Compare March 18, 2022 13:51
@alsora
Copy link
Collaborator

alsora commented Mar 18, 2022

CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@alsora
Copy link
Collaborator

alsora commented Mar 21, 2022

CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@alsora
Copy link
Collaborator

alsora commented Mar 21, 2022

CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@alsora
Copy link
Collaborator

alsora commented Mar 21, 2022

New CI with updated cyclonedds

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

/// Implementation detail.
RCLCPP_PUBLIC
void
setup_intra_process(
Copy link
Collaborator

@alsora alsora Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be protected (and also the using definition above)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 0d17a8e

@@ -676,7 +711,7 @@ class Client : public ClientBase
PromiseWithRequest promise;
auto shared_future = promise.get_future().share();
auto req_id = async_send_request_impl(
*request,
request,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not std::move as in the other calls above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not moving here because needs to be valid for later use in line 718

@alsora
Copy link
Collaborator

alsora commented Mar 22, 2022

CI

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status


private:
using ClientIntraProcessT = rclcpp::experimental::ClientIntraProcess<ServiceT>;
std::shared_ptr<ClientIntraProcessT> client_intra_process_;
Copy link
Collaborator

@alsora alsora Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to match subscriptions implementation, we should have that client_intra_process_ is a protected member in client_base.hpp.
Its type will be ClientIntraProcessBase and the using definition can be moved to the create_intra_process_client

The same applies to servers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in bec9017

bool
resolve_use_intra_process(const OptionsT & options, const NodeBaseT & node_base)
resolve_use_intra_process(const IntraProcessSetting & ipc_setting, const NodeBaseT & node_base)
Copy link
Collaborator

@alsora alsora Mar 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntraProcessSetting is an enum, we can avoid passing that as a reference as it's likely to be a pessimization (and may cause confusion between the enum value and the memory address)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d19d5c2

// Not to be used in this class. Todo: review base class to avoid this.
bool use_take_shared_method() const override
{
throw std::runtime_error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to throw here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just returning false now: 08290a8

auto & typed_response = data_ptr->first;
auto & value = data_ptr->second;

if (std::holds_alternative<Promise>(value)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice if we could avoid duplicating this logic between here and client.hpp

@mauropasse mauropasse marked this pull request as ready for review March 23, 2022 16:19
@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2022-04-21/25293/1

@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch from bec9017 to b6245f2 Compare May 26, 2022 09:55
@alsora
Copy link
Collaborator

alsora commented Jun 1, 2022

Hi, can we get a review here?

@clalancette clalancette requested a review from wjwwood June 1, 2022 13:31
@audrow audrow changed the base branch from master to rolling June 28, 2022 14:21
@alsora
Copy link
Collaborator

alsora commented Aug 15, 2022

Hi, anyone available for a review?

@alsora
Copy link
Collaborator

alsora commented Aug 30, 2022

Friendly ping for a review

@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch 2 times, most recently from 98aad33 to abf4e71 Compare September 23, 2022 12:15
Mauro Passerino added 2 commits September 23, 2022 13:18
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch from abf4e71 to 0a98fda Compare September 23, 2022 12:18
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch from d45b7ea to b995963 Compare October 3, 2022 13:57
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
@alsora
Copy link
Collaborator

alsora commented Feb 10, 2023

@wjwwood @clalancette @audrow @hidmic @ivanpauno can we get a review?
this PR has been open for more than 1 year

alsora pushed a commit to irobot-ros/rclcpp that referenced this pull request Apr 29, 2023
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request Nov 8, 2023
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request Nov 8, 2023
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
alsora pushed a commit to irobot-ros/rclcpp that referenced this pull request Jan 30, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
apojomovsky pushed a commit to apojomovsky/rclcpp that referenced this pull request Jun 20, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
apojomovsky pushed a commit to apojomovsky/rclcpp that referenced this pull request Jun 21, 2024
Signed-off-by: Mauro Passerino <mpasserino@irobot.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants