Skip to content

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

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

template<typename NodeBaseT>
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
@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch from abf4e71 to 0a98fda Compare September 23, 2022 12:18
@mauropasse mauropasse force-pushed the mauro/ipc-cli-serv-qos-getters branch from d45b7ea to b995963 Compare October 3, 2022 13:57
@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
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request Nov 8, 2023
mauropasse pushed a commit to mauropasse/rclcpp that referenced this pull request Nov 8, 2023
alsora pushed a commit to irobot-ros/rclcpp that referenced this pull request Jan 30, 2024
apojomovsky pushed a commit to apojomovsky/rclcpp that referenced this pull request Jun 20, 2024
apojomovsky pushed a commit to apojomovsky/rclcpp that referenced this pull request Jun 21, 2024
@roncapat
Copy link
Contributor

Any chance for this to get merged?

skyegalaxy pushed a commit to irobot-ros/rclcpp that referenced this pull request Mar 29, 2025
Signed-off-by: Mauro Passerino <[email protected]>
(cherry picked from commit 58d2a04)
skyegalaxy pushed a commit to irobot-ros/rclcpp that referenced this pull request Apr 3, 2025
Signed-off-by: Mauro Passerino <[email protected]>
(cherry picked from commit 58d2a04)

Remove redundant `add_subscription` cherry pick artifact

use const ref instead of ptr, add missing capacity fn

more style
skyegalaxy pushed a commit to irobot-ros/rclcpp that referenced this pull request May 14, 2025
Signed-off-by: Mauro Passerino <[email protected]>
(cherry picked from commit 58d2a04)

Remove redundant `add_subscription` cherry pick artifact

use const ref instead of ptr, add missing capacity fn

more style
skyegalaxy added a commit to irobot-ros/rclcpp that referenced this pull request May 20, 2025
* Add logs on failed take response/request (#107)

* Ignore local endpoints (#131)

* Refs #18846: PoC ignore local endpoints: extend RCLCPP API

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #18846: PoC ignore local endpoints: modify RCLCPP publish logic

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

---------

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>
Co-authored-by: JLBuenoLopez-eProsima <[email protected]>
(cherry picked from commit 106c03a)

style

* Support intra-process communication: Clients & Services (ros2#1847)

Signed-off-by: Mauro Passerino <[email protected]>
(cherry picked from commit 58d2a04)

Remove redundant `add_subscription` cherry pick artifact

use const ref instead of ptr, add missing capacity fn

more style

* Jazzy recreation of "Add action client/server IPC support" (aeacde9)

* add override attribute to some ipc methods

Signed-off-by: Alberto Soragna <[email protected]>

* clear intra-process manager on client/server destructors (#94)

(cherry picked from commit 378223d)

* move ipc lock to appropriate position in client.hpp

(cherry picked from commit 9de603e)

* Actions: Use ipc_setting = rclcpp::IntraProcessSetting::NodeDefault (#133)

Co-authored-by: Mauro Passerino <[email protected]>

* Allow for deferred responses with ipc (#135)

* allow for deferred responses with ipc

* fix send response

* fix use member service ipc process

* add map to store CallbackInfoVariant

* add send_response to base class, set function ptr to get handle

* move service intra process outside base

* copy response into shared pointer for ipc

* add typename for service template

* remove ref signature

* try without std::ref

* try without ref wrapper

* try emplace

* make pair with variant

* some cleanup

* erase callback info if client invalid

* add post_init_setup for services

* fix extra comma

* add post init setup after lifecycle node services

* add documentation for ServiceIntraProcess template change

* use weak ptr to service in ServiceIntraProcess

* move check for valid service handle to beginning of function

* add comment for callback info map

(cherry picked from commit aa95a48)

* check request header for intraprocess (#139)

* check request header for intraprocess

* set request header intraprocess to false in execute_service

(cherry picked from commit a617f93)

* Include namespaces in service names (#140)

* Include node namespace in IPC Action service name
* Include node namespace in IPC Client/Service service name
---------
Co-authored-by: Mauro Passerino <[email protected]>

(cherry picked from commit f5b2001)

remove whitespace in service.hpp

* Fix mutltiple client requests (#142)

* store map of unique request id to client id and callback info pair

* fix map end check

* fix undefined reference

* remove unnecessary request id erase, remove/fix unique id comment

* improve unique id comment

(cherry picked from commit b865383)

* RECREATION OF Fixes for intra-process actions (#144)

action client / server ipc decrustification

whitespace / line length / uncrustify - service_intra_process

const correctness

* add logs and minor fixes (#146)

* add logs and minor fixes

Signed-off-by: Alberto Soragna <[email protected]>

* use >0 rather than ==1 in comparison

Signed-off-by: Alberto Soragna <[email protected]>

---------

Signed-off-by: Alberto Soragna <[email protected]>

* correct template syntax

Signed-off-by: Alberto Soragna <[email protected]>
(cherry picked from commit d4dd4e4)

* avoid adding notify waitable twice to events-executor collection (ros2#2564)

* avoid adding notify waitable twice to events-executor entities collection

Signed-off-by: Alberto Soragna <[email protected]>

* remove redundant mutex lock

Signed-off-by: Alberto Soragna <[email protected]>

---------

Signed-off-by: Alberto Soragna <[email protected]>
(cherry picked from commit f27bdbf)

* Fix bug in timers lifecycle for events executor (ros2#2586)

* Remove expired timers before updating the collection

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Add regression test for reinitialized timers bug

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Add missing includes

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Relocate test under the executors directory

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Extend test to run with all supported executors

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Adjust comment in fix to make it more generic

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Apply ament clang format to test

Signed-off-by: Alexis Pojomovsky <[email protected]>

* Fix uncrustify findings

Signed-off-by: Alexis Pojomovsky <[email protected]>

---------

Signed-off-by: Alexis Pojomovsky <[email protected]>
Co-authored-by: Alexis Pojomovsky <[email protected]>
(cherry picked from commit 9ef9646)

* Bring lock_free_events_queue to rclcpp from the events_executor repo (#149)

Co-authored-by: Alexis Pojomovsky <[email protected]>
(cherry picked from commit 30050c1)

exclude lock free queue from linting

actually lint lock_free_events_queue

lock_free_events_queue copyright

whitespace / line length / uncrustify - lock_free_events_queue

* Add test_actions (#150)

Co-authored-by: Alexis Pojomovsky <[email protected]>
(cherry picked from commit aef928d)

* Jazzy - Action IPC Fixes (See 7a51f00)

whitespace / line length / uncrustify - rclcpp_action client

whitespace / line length / uncrustify - rclcpp_action server

fix duplicate member definitions in rclcpp_action server.hpp

fixes for IPC action server

delete log

whitespace / line length / uncrustify - rclcpp action server again

minor action client fixes

whitespace / line length / uncrustify - rclcpp action client again

* Always publish inter-process on TRANSIENT_LOCAL pubs (#152)

* Mauro/irobot iron fixes (#155)

whitespace / line length / uncrustify - publisher

proper inter_process_publish_needed

whitespace / line length / uncrustify - rclcpp publisher

* Add test_actions & test_transient_local (#157)

Co-authored-by: Mauro Passerino <[email protected]>
(cherry picked from commit cf182e0)

whitespace / line length / uncrustify - test_actions and test_transient_local

whitespace / line length / uncrustify - test actions and transient_local again

remove redundant test_actions

* Call service post_init_setup in test_service.cpp

---------

Signed-off-by: Alberto Soragna <[email protected]>
Signed-off-by: Alexis Pojomovsky <[email protected]>
Co-authored-by: Mauro Passerino <[email protected]>
Co-authored-by: mauropasse <[email protected]>
Co-authored-by: Alberto Soragna <[email protected]>
Co-authored-by: Jeffery Hsu <[email protected]>
Co-authored-by: bpwilcox <[email protected]>
Co-authored-by: Alexis Pojomovsky <[email protected]>
Co-authored-by: Alexis Pojomovsky <[email protected]>
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.

6 participants