Custom allocators for Service/Clients
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
Custom allocators for Service/Clients
Feature description
Currently the allocator for rclcpp services and clients cannot be configured by the user, though publishers and subscribers support this feature. This is useful for systems that implement a non-default allocator and would like to use ros2 services.
Implementation considerations
The implementation could mirror that of rclcpp publishers/subscribers where the create_publisher/create_subscriber functions are templated on an AllocatorT.
Steps that would need to be taken would then be:
- Create an analogue of
PublisherOptionsBaseclass for Services, i.e.ServiceOptionsBase.
- Implement a
ServiceOptionsWithAllocatorwhich templatesServiceOptionsBaseon anAllocatorTas per implementation withPublisherOptionsWithAllocator
- Update
create_service.hppto provide arclcpp::create_servicetemplated on anAllocatorTaccepting aServiceOptionsWithAllocator. - Pass the service options containing the custom allocator to
rcl_service_init - Do the same with clients
It may also be good to copy the Factory design pattern used on the publisher/subscriber implementation for consistency.
Reference:
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 by comparing the allocator-aware publisher and subscriber implementation in create_publisher.hpp and allocator_common.hpp. Then inspect publisher_options.hpp and create_service.hpp to map the proposed ServiceOptionsBase and ServiceOptionsWithAllocator design, followed by the corresponding client code. Done means services and clients accept custom allocator options and pass them to rcl_service_init.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100