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

Add thing which adds things to wait set #588

Closed
sloretz opened this issue Nov 20, 2018 · 3 comments
Closed

Add thing which adds things to wait set #588

sloretz opened this issue Nov 20, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sloretz
Copy link
Contributor

sloretz commented Nov 20, 2018

Feature request

This is a request for a feature to allow waiting on action servers and action clients. Action servers and Action clients are to be implemented in libraries on top of the core rcl and rclcpp features in rcl_action and rclcpp_action. Adding them to the wait set in rcl is covered by ros2/rcl#335.

Feature description

This feature would allow an executor to wait on action servers and action clients which have servers/timers/clients/subscribers created in C. Since the individual entities don't have rclcpp::<Entity>Base types they can't be used by the existing callback group and executor APIs.

With #519 in mind it could make sense to change callback groups to be the class that adds things to the wait set, but I don't think there is time before the Crystal release. Instead this feature is proposing to add a new class to be used along with callback groups.

Implementation considerations

Assuming class called Waitable with virtual APIs

  • virtual get_number_of_entities(size_t * num_subscriptions, ...)
    • Called by executor when determining how big to allocate the wait set
  • virtual void add_to_wait_set(rcl_wait_set_t *)
    • Called by executor when populating the wait set
    • Because get_number_of_entities() and add_to_wait_set() are separate calls, it must be assumed that the number of entities in a Waitable are constant between the two calls. For actions this assumption holds because the number of waitable entities is constant for the life of the server and client.
  • virtual bool can_execute(rcl_wait_set_t *)
    • Return true if there is something that can be executed in the waitset.
  • virtual void execute();
    • It's assumed the waitable will set some state within itself during can_execute() so that it does the right thing here.

Using Waitable requires:

Requires ros2/rcl#335 so Executor and Waitable can know which entities belong to which.

@sloretz sloretz added the enhancement New feature or request label Nov 20, 2018
@sloretz sloretz added this to the crystal milestone Nov 20, 2018
@wjwwood
Copy link
Member

wjwwood commented Nov 20, 2018

This makes sense to me, I had imagined a "Waitable" concept from early days, but didn't have time to implement it.

Thanks for writing it down so clearly :)

@jacobperron jacobperron self-assigned this Nov 20, 2018
@jacobperron
Copy link
Member

👍

Correct me if I'm wrong. Specifically, can_execute(rcl_wait_set_t *) should return true if the Waitable has some internal entities that can execute in the wait set (not necessary any entity in the wait set).

@jacobperron jacobperron added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 21, 2018
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label Nov 22, 2018
@ros-discourse
Copy link

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

https://discourse.ros.org/t/the-design-of-waitable/19136/3

nnmm pushed a commit to ApexAI/rclcpp that referenced this issue Jul 9, 2022
* Changed rosidl_generator_c/cpp to rosidl_runtime_c/cpp

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Fixed rcl rcl_runtime_c dependency

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Fixed rcl_action rcl_runtime_c dependency

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Fixed rcl_lifecycle rcl_runtime_c dependency

Signed-off-by: ahcorde <ahcorde@gmail.com>

* keep the originally used dependency type

Signed-off-by: ahcorde <ahcorde@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants