We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66c7121 commit 780ab41Copy full SHA for 780ab41
rclcpp/topics/minimal_subscriber/lambda.cpp
@@ -23,12 +23,12 @@ class MinimalSubscriber : public rclcpp::Node
23
MinimalSubscriber()
24
: Node("minimal_subscriber")
25
{
26
- subscription_ = this->create_subscription<std_msgs::msg::String>(
27
- "topic",
28
- 10,
29
- [this](std_msgs::msg::String::UniquePtr msg) {
+ auto topic_callback =
+ [this](std_msgs::msg::String::UniquePtr msg) -> void {
30
RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str());
31
- });
+ };
+ subscription_ =
+ this->create_subscription<std_msgs::msg::String>("topic", 10, topic_callback);
32
}
33
34
private:
0 commit comments