Service callback without shared pointer

Open
#3,078 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
api

Research direction

Start with rclcpp/include/rclcpp/any_service_callback.hpp at lines 209-238 and inspect the existing service callback overloads, especially the overload without a request id. Determine the API and lifetime requirements for const-reference and reference callbacks, then define tests showing the intended overloads and callback behavior before implementation.

Written by the indexing model from the issue text.

Description

https://github.com/ros2/rclcpp/blob/1bf4e6a810fe58a8c4cbe37f057cdd9f042c94e3/rclcpp/include/rclcpp/any_service_callback.hpp#L209-L238

Would it be a good idea to support a service callback with a const reference and reference for services? At least for the overload without the request id.

Many services are able to return immediately and does not need the request/response object lifetime to exceed the call site. In general, it's also much cheaper to copy a small struct instead of doing atomic increments/decrements of shared pointers.

Dominant language
C++
Stars
829
Forks
587
Avg merge
4d 6h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ros2/rclcpp

All issues in ros2/rclcpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.