fmrico / book_ros2

550 stars 112 forks source link

Question about lack of a "procedural" subscriber.cpp #25

Closed ru2saig closed 1 year ago

ru2saig commented 1 year ago

Type of bug

Issue Description

First off, I'd like to thank you for the excellent book and resource! I'm using it to study ROS2, and I'm really enjoying it so far. While reading the 2nd chapter and looking at the source code, I've noticed that there is no subscriber implementation without using classes like br2_basics/src/publisher.cpp in the br2_basics package. Is there any specific reason? Or did I miss a mention of it as an exercise?

fmrico commented 1 year ago

Hi @ru2saig

It's true. I have just checked it out. I recommended initially inheriting from rclcpp::Node and I didn't show an example with a simple function callback.

I can do it, but if you prefer you can give it a try yourself, make a PR and I can review it. What do you prefer?

Best

ru2saig commented 1 year ago

Hello!

I've given it a go, and have opened a PR: https://github.com/fmrico/book_ros2/pull/27