-
Notifications
You must be signed in to change notification settings - Fork 85
Add 'Cache (C++)' tutorial #196
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
Conversation
ahcorde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on the documentation
doc/Tutorials/Cache-Cpp.rst
Outdated
|
|
||
| Prerequisites | ||
| ~~~~~~~~~~~~~ | ||
| This tutorial assumes you have a working knowledge of ROS 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This tutorial assumes you have a working knowledge of ROS 2 | |
| This tutorial assumes you have a working knowledge of ROS 2. |
| If you have not done so already `create a workspace <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>`_ and `create a package <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html>`_ | ||
|
|
||
|
|
||
| 1. Create a Basic Node with Includes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you have not done so already `create a workspace <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>`_ and `create a package <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html>`_ | |
| 1. Create a Basic Node with Includes | |
| If you have not done so already `create a workspace <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>`_ and `create a package <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html>`_ | |
| 1. Create a Basic Node with Includes |
doc/Tutorials/Cache-Cpp.rst
Outdated
| 1. Create a Basic Node with Includes | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Let's assume, you've already created an empty ros package for C++. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Let's assume, you've already created an empty ros package for C++. | |
| Let's assume, you've already created an empty ROS package for C++. |
| } | ||
|
|
||
|
|
||
| 2. Update package.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | |
| 2. Update package.xml | |
| } | |
| 2. Update package.xml |
doc/Tutorials/Cache-Cpp.rst
Outdated
| install(TARGETS cache_tutorial | ||
| DESTINATION lib/${PROJECT_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| install(TARGETS cache_tutorial | |
| DESTINATION lib/${PROJECT_NAME}) | |
| install(TARGETS cache_tutorial | |
| DESTINATION lib/${PROJECT_NAME}) |
doc/Tutorials/Cache-Cpp.rst
Outdated
|
|
||
| Now run the node using: | ||
|
|
||
| .. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. code-block:: bash | |
| .. code-block:: console |
doc/Tutorials/Cache-Cpp.rst
Outdated
|
|
||
| The first message in the output is going to be | ||
|
|
||
| .. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. code-block:: bash | |
| .. code-block:: console |
doc/Tutorials/Cache-Cpp.rst
Outdated
| As there were no messages published yet, and the cache is empty. | ||
| After that, the publisher will start populate the cache with messages: | ||
|
|
||
| .. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .. code-block:: bash | |
| .. code-block:: console |
6d5669a to
e4a1d0d
Compare
|
Thanks for the review @ahcorde! |
doc/Tutorials/Cache-Cpp.rst
Outdated
| Cache (C++): | ||
| --------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Cache (C++): | |
| --------------------------------------- | |
| Cache (C++): | |
| ------------ |
CursedRock17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tutorial looks great! That being said I left a couple nitpicking things to cover. Thanks!
doc/Tutorials/Cache-Cpp.rst
Outdated
|
|
||
| Next we define a tutorial class. | ||
| In this case it is the ``CacheNode`` class. | ||
| For starters, let's take a look at a ``private`` section of this class: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| For starters, let's take a look at a ``private`` section of this class: | |
| For starters, let's take a look at the ``private`` section of this class: |
| } | ||
|
|
||
| private: | ||
| rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_; | |
| rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_; | |
doc/Tutorials/Cache-Cpp.rst
Outdated
| class CacheNode : public rclcpp::Node { | ||
| public: | ||
| CacheNode() | ||
| : Node("cahce_node") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| : Node("cahce_node") | |
| : Node("cache_node") |
doc/Tutorials/Cache-Cpp.rst
Outdated
| Overview | ||
| ~~~~~~~~ | ||
|
|
||
| This tutorial demonstrates how to use the ``message_filters.Cache`` class in ROS 2 using C++. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This tutorial demonstrates how to use the ``message_filters.Cache`` class in ROS 2 using C++. | |
| This tutorial demonstrates how to use the ``message_filters::Cache`` class in ROS 2 using C++. |
doc/Tutorials/Cache-Cpp.rst
Outdated
| using namespace std::chrono_literals; | ||
|
|
||
| We start by including ``chrono`` and ``functional`` headers. | ||
| The ``chrono`` header is required for ``chrono_literals`` namespace, and the ``functional`` header is required to use ``std::bind`` function to bind timer callbacks to timers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The ``chrono`` header is required for ``chrono_literals`` namespace, and the ``functional`` header is required to use ``std::bind`` function to bind timer callbacks to timers. | |
| The ``chrono`` header is required for the ``chrono_literals`` namespace, necessary for creating timers. | |
| The ``functional`` header is also required to use ``std::bind`` function to bind timer callbacks to timers. |
e4a1d0d to
55b991d
Compare
|
Thank you for the review @CursedRock17! I've fixed the places in the code, you've pointed to. May I ask you to have another look at this PR, when it is possible? |
Signed-off-by: EsipovPA <esipov.p@mail.ru>
Signed-off-by: EsipovPA <esipov.p@mail.ru>
55b991d to
7318016
Compare
CursedRock17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
This is documentation, merging! |
|
https://github.com/Mergifyio backport kilted jazzy humble |
✅ Backports have been created
|
Signed-off-by: EsipovPA <esipov.p@mail.ru> (cherry picked from commit c7821ef)
Signed-off-by: EsipovPA <esipov.p@mail.ru> (cherry picked from commit c7821ef)
Signed-off-by: EsipovPA <esipov.p@mail.ru> (cherry picked from commit c7821ef)
Description
Added a tutorial for Cache message filter class for C++ programming language.
fixes partially #130. Does not close the issue
Is this user-facing behavior change?
Did you use Generative AI?
Additional Information