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

Split lambda and subscription definition in minimal subscriber example #363

Merged
merged 1 commit into from Jun 5, 2023

Conversation

FelipeGdM
Copy link
Contributor

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 ros2/ros2_documentation#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

Signed-off-by: Felipe Gomes de Melo <felipegmelo.42@gmail.com>
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

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.

@FelipeGdM
Copy link
Contributor Author

@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.

@clalancette
Copy link
Contributor

@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!

@clalancette clalancette merged commit 780ab41 into ros2:rolling Jun 5, 2023
3 checks passed
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.

None yet

3 participants