Streamline creation of subscriptions in callback groups
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
Feature description
The motivation behind this is that I would like a convenient way to create a subscription associated with a callback group within a node's initializer list. It is straightforward to do this for actions and services, since rclcpp::create_service, rclcpp_action::create_server, etc., allow me to pass a callback group as an argument. However, the rclcpp::create_subscription function takes a SubscriptionOptions struct as an argument, and the SubscriptionOptions struct does not provide a constructor that takes a rclcpp::CallbackGroup::SharedPtr. This means that I have to pass an instance of a CallbackGroup to my SubscriptionOptions in the body of the node's constructor and then create the subscription using those SubscriptionOptions.
Implementation considerations
A simple approach would be to add a constructor overload to SubscriptionOptions that just takes rclcpp::CallbackGroup::SharedPtr as an argument. As an extension, rclcpp::create_subscription could be overloaded to take a callback group as an argument, similar to the equivalent functions that create clients and servers.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SubscriptionOptions type and the rclcpp::create_subscription entry point described in the issue, then compare them with the callback-group arguments accepted by the client and server creation helpers. Determine whether initializer-list construction can support a callback group through SubscriptionOptions or an overload. Done means subscriptions can be associated with a callback group during node initialization, with the chosen API behavior covered by the relevant project tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100