Use const& signature for read-only sub callbacks#2297
Conversation
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 <aprotyas@u.rochester.edu>
clalancette
left a comment
There was a problem hiding this comment.
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 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. |
Ah, excellent. Thanks for letting me know. In that case, I'm going to approve and merge this one, and backport to only Galactic. |
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 <aprotyas@u.rochester.edu> (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
…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 <aprotyas@u.rochester.edu> (cherry picked from commit e4cd3cb) Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
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 aprotyas@u.rochester.edu