@Paul_Bovbel
It is not a strict answer to your question, but I’d like to share my ‘best practice’ when it comes to learning ROS 2 and Gazebo Sim code.
This for sure is trivial info to those with elaborate and recent coding experience, but I think it is relevant to share nevertheless; in any case it would have saved me countless hours if I’d have known this from the start (I come from a time when state-of-the-art was C++98, Vim/Emacs and CVS/SVN instead ):
I find that generally, for ROS 2 and Gazebo, the API docs are not the best sources of info.
What I have resorted to instead, and what works really well for me, are the following three simple things:
1. Clone the source and use VSCode:
I cloned the ROS and Gazebo source tree, and I use VSCode (configured with the ROS plugin etc.) to read through the code.
This, I find, has multiple benefits, e.g.:
-
You get info tooltips when hovering above any variable or method:
This is also particularly handy when it comes to auto
declared variables, as you don’t have to guess what the auto
could be:
- It allows you to jump through the code by pressing ‘F12’ (or through the right mouse click menu), so you can look into some function, and then return by ‘ALT + left arrow’.
2. Look up blame history in GitHub:
To learn more about specific concepts and the ‘why’ of the code, I look up that part of code in the GitHub repository and click ‘view Git Blame’ (either the button at the top, or through clicking on the line number). This will lead you to the specific pull request (and typically also the corresponding issue) by which that part of the code was added or changed. Reading through the discussions of the issue and PR gives insight on:
- The chosen concept,
- Possible other options that were considered,
- How this impacted or was impacted by other parts of the code,
- Etc.
In some cases it even leads to elaborate design specifications (not often, though… ), or e.g. to a recording of a video conf explaning the implementation. That info typically is not disclosed anywhere else, but in the GitHub discussion.
3. Look through issues in GitHub:
In case something does not work as expected, apart from searching the Robotics Stack Exchange and the ROS/Gazebo Answers sites, cultivate the reflex to also search through the issues (open as well as closed) in the corresponding GitHub repository. Often something has been reported, discussed, possibly resolved or a workaround described, etc.
So for ROS 2 core and Gazebo Sim, this way of learning the code has proven far more valuable to me than reading header files or API docs.