ROS2 Architecture (rclcpp, rcl, rmw)
Hi, I am a beginner with ROS2 and C++ and I can use some help understanding how the architecture of ROS 2 works. I want to implement a QoS-event into a simple chatter program and with my basic knowledge I can make following graph:
CODE (publisher.cpp) ==> RCLCPP(qos_event.cpp) this includes (qos_event.hpp) ==> RCL (event.c) this includes (event.h) ==> RMW (event.c) this includes (event.h) ==> DDS
But I have some questions about this:
1) If I understand it right, header files are used as some kind of library. So if you include them in your program you can use all the functions you want. This means I don't need to use this code in my program but I only need to implement those functions? Are the following files: qos_event.cpp / rcl event.c / rmw event.c examples of code that I can use into my own program ?
2) The Quality of Service (QoS) settings are declared in the Ros middelware (rmw). If I want to use one of those events, can I just directly use the rmw/event.h header file or do I need to respect the architecture and is it only possible to implement rclcpp code in your program ?
Thanks a lot !
Theoretically you can work on top of whichever layer you want. For the average ROS user I think working on the rclcpp layer is sufficient. The functions you use at rclcpp level will actually call the rcl and rmw layer functions for you. Registering a subscriber at rclcpp level is a lot easier than at rcl level.
You can set QoS settings when creating a publisher or subscriber something like this:
for this you just need to include rclcpp
This worked for me:
I guess I directly use the rmw/event.h header file here. But now I want to implement the deadline_missed event and I think it is important to know how to properly form this event.
If you say that it is easier to implement code from the rclcpp library: (qos_event.hpp code)
This could be code that automaticaly uses the rcl and rmw layers. Right ?
https://design.ros2.org/articles/ros_... It could be useful for you to have a look at this. Normally a new user should be able to work with ROS2 without having to leave "user-land". ROS2 is designed in such a way that the underlying system can be treated as a blackbox. Where the user only has to interact with rclcpp or rclpy. HOWEVER, not all of DDS' functionality has been exposed to the top-layer (more and more is being exposed in newer releases). So for very specific cases, a more advanced user could decide to dive deeper and directly address the lower level layers.
What is your goal? If you just want to use ROS2 and play with QoS settings, I would advise you to look at some tutorials and just set different QoS settings at rclcpp level. If you are truly interested in the inner workings of ROS2 and how all the layers work together then you will need quite a lot of time and I honestly think that for 99% of people it will not have much added value.
Have you ever implemented a qos-event ?
I only want to play with those QoS settings (I already succeeded to do so), but i would like to implement those events. And I am afraid that I need to learn the inner workings of ROS2 before being able to use them, because I haven't found any example of this already. Thanks for your time !