ros2 / ros2/rclcpp

Service callback without shared pointer

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

Nobody has claimed this yet.

Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

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.

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.