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

Use const& signature for read-only sub callbacks #2297

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

aprotyas
Copy link
Member

@aprotyas aprotyas commented Feb 8, 2022

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha [email protected]

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, I'm fine with this change, but @aprotyas did you test out these tutorials on Foxy, Galactic, and Rolling to ensure that they still work?

@aprotyas
Copy link
Member Author

aprotyas commented Feb 9, 2022

In short, I'm fine with this change, but @aprotyas did you test out these tutorials on Foxy, Galactic, and Rolling to ensure that they still work?

Yes, I forgot to mention. I've tested and these tutorials only work on Rolling and Galactic because the const & callback signature doesn't exist in Foxy.

Also, since users will download code from ros2/examples in the simple pubsub tutorial, another PR is needed to reflect the changes in minimal_subscriber/member_function.cpp. I will open that shortly.

@clalancette
Copy link
Contributor

Yes, I forgot to mention. I've tested and these tutorials only work on Rolling and Galactic because the const & callback signature doesn't exist in Foxy.

Ah, excellent. Thanks for letting me know. In that case, I'm going to approve and merge this one, and backport to only Galactic.

@clalancette clalancette merged commit e4cd3cb into rolling Feb 9, 2022
@delete-merged-branch delete-merged-branch bot deleted the aprotyas/const_ref_sub_callbacks branch February 9, 2022 15:38
mergify bot pushed a commit that referenced this pull request Feb 9, 2022
The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
(cherry picked from commit e4cd3cb)

# Conflicts:
#	source/Tutorials/Custom-ROS2-Interfaces.rst
#	source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst
#	source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst
#	source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst
clalancette added a commit that referenced this pull request Feb 9, 2022
…2298)

* Use `const&` signature for read-only sub callbacks (#2297)

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
(cherry picked from commit e4cd3cb)

Co-authored-by: Chris Lalancette <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants