Closed FelipeGdM closed 1 year ago
I'm fine with this change, but we should check the documentation at https://github.com/ros2/ros2_documentation to see if we need to update any of the Tutorials because of this.
@clalancette this particular example isn't used in the ROS 2 docs, the current example is the member_function.cpp. This change is part of the effort to replace std::bind
calls in the default examples in favor of lambda functions (https://github.com/ros2/ros2_documentation/issues/3618), so it should be used in the docs in the near future.
@clalancette this particular example isn't used in the ROS 2 docs, the current example is the member_function.cpp. This change is part of the effort to replace
std::bind
calls in the default examples in favor of lambda functions (ros2/ros2_documentation#3618), so it should be used in the docs in the near future.
Sounds good, thanks!
The current example of minimal subscriber using a lambda function performs the definition of the subscription and the lambda function in the same line.
This PR splits the same operation in two steps, the definition of the lambda function and then the definition of the subscription. The goal is make it easier to explain what is happening in each step, as this example will be the default one in the ROS 2 documentation page (see https://github.com/ros2/ros2_documentation/issues/3618). Another benefit is that the minimal subscriber with lambdas would now follow the same structure of the minimal publisher with lambdas (i.e. declaration of the lambda and then declaration of the publisher/subscriber)
The name of the lambda function variable is
topic_callback
in order to match the same pattern from the minimal subscriber member function example