F1tenth repository
Currently the ubm-f1tenth repository is composed of ros2 packages written in C++ or Python, each package must be documented in a different way based on the language it is written in.
Python packages
To generate the documentation of ros2 packages written in Python we use mkdocs and each package is treated as a different mkdocs project.
To start writing the documentation you must first initialize the directory as a mkdocs project (you only have to do this once per package), to do so run the following commands within the docker container:
Thesource ~/mkdocs/bin/activate
command will activate the virtual environment where the mkdocs python package is installed.
Next, modify the mkdocs.yml
file so that the plugins
section includes the mkdocstrings
plugin and use the readthedocs
theme, in the end the mkdocs.yml
file should look something like this:
Now you can place the documentation in markdown format inside the docs
folder:
- You can use the usual markdown formatting instructions, such as tables and images (put the images in the
docs/img
folder) - To generate the documentation automatically from the python docstrings use the
:::
directive (more info here) 🚨 If you do this ALWAYS include theshow_source: false
option 🚨, like so: You can structure the documentation as you think is most effective, create as many markdown files as you want and add them to thenav
section ofmkdocs.yml
. To see how the documentation will turn out run this command in the docker container then open theindex.html
file in your browser:
C++ packages
The documentation of C++ packages is generated with rosdoc2, which in turn uses Doxygen and Sphinx in conjunction with breathe and exhale. In order for these tools to work the file structure of the package must follow the ros2 guidelines, the main aspect of these guidelines is that all classes, methods and functions must be defined in .hpp
files located in the include
folder and the Doxygen style documentation comments must be written in these files.
You can generate and view the documentation with: