|
| 1 | +How to Contribute Doxygen Comments |
| 2 | +---------------------------------- |
| 3 | + |
| 4 | + |
| 5 | +This guide will provide an introduction and overview to good practices for contributing Doxygen comments. |
| 6 | + |
| 7 | +Learning Objectives |
| 8 | +------------------- |
| 9 | + |
| 10 | +- How to write helpful Doxygen Comments |
| 11 | +- Some useful Doxygen Plugins |
| 12 | + |
| 13 | +Instructions |
| 14 | +------------ |
| 15 | +When making a contribution to MoveIt (or any code, really), make sure your code is readable and well-commented throughout. |
| 16 | +Using Doxygen comments allows for standardization of documentation and ensures that all contributions have certain information included with them. |
| 17 | +One of the primary benefits of Doxygen is that it allows for automatic generation of API documentation in a consistent, readable format. |
| 18 | + |
| 19 | + |
| 20 | +Plugins exist to automate the creation of Doxygen documentation for |
| 21 | +- `SublimeText <https://packagecontrol.io/packages/DoxyDoxygen>`_ |
| 22 | +- `VIM <https://www.vim.org/scripts/script.php?script_id=987>`_ |
| 23 | +- `VSCode <https://marketplace.visualstudio.com/items?itemName=cschlosser.doxdocgen>`_ |
| 24 | + |
| 25 | +As well as for `many other IDEs <https://www.doxygen.nl/helpers.html>`_. |
| 26 | + |
| 27 | +In general, a Doxygen comment should include a brief description of the thing it is commenting on at the very least. |
| 28 | +Descriptions of the input parameters (if any) as well as the output parameters (if any) is helpful as well. |
| 29 | + |
| 30 | +Several examples are provided below: |
| 31 | + |
| 32 | + |
| 33 | + .. code-block:: c++ |
| 34 | + |
| 35 | + /** @brief Check for robot self collision. Any collision between any pair of links is checked for, NO collisions are |
| 36 | + * ignored. |
| 37 | + * |
| 38 | + * @param req A CollisionRequest object that encapsulates the collision request |
| 39 | + * @param res A CollisionResult object that encapsulates the collision result |
| 40 | + * @param state The kinematic state for which checks are being made */ |
| 41 | + virtual void checkSelfCollision(const CollisionRequest& req, CollisionResult& res, |
| 42 | + const moveit::core::RobotState& state) const = 0; |
| 43 | +
|
| 44 | + |
| 45 | + |
| 46 | + .. code-block:: c++ |
| 47 | + |
| 48 | + /** @brief A bounding volume hierarchy (BVH) implementation of a tesseract contact manager */ |
| 49 | + class BulletBVHManager |
| 50 | + { |
| 51 | + ... |
| 52 | +
|
| 53 | + .. code-block:: c++ |
| 54 | + |
| 55 | + /** @brief Instantiate and return a instance of a subclass of Type using our |
| 56 | + * pluginlib::ClassLoader. |
| 57 | + * @param class_id A string identifying the class uniquely among |
| 58 | + * classes of its parent class. rviz::GridDisplay might be |
| 59 | + * rviz/Grid, for example. |
| 60 | + * @param error_return If non-NULL and there is an error, *error_return is set to a description of the problem. |
| 61 | + * @return A new instance of the class identified by class_id, or NULL if there was an error. |
| 62 | + * |
| 63 | + * If makeRaw() returns NULL and error_return is not NULL, *error_return will be set. |
| 64 | + * On success, *error_return will not be changed. */ |
| 65 | + virtual Type* makeRaw(const QString& class_id, QString* error_return = nullptr) { |
| 66 | + |
| 67 | +These examples serve to provide the types and descriptions of inputs and outputs and capture what the function or class is doing, in brief. |
| 68 | + |
| 69 | + |
| 70 | +Further Reading |
| 71 | +--------------- |
| 72 | + |
| 73 | +Feel free to look around in the repositories to see additional examples of Doxygen comments. |
| 74 | +Looking at a similar piece of code to what you will be contributing and seeing its comments is the easiest way to learn. |
| 75 | + |
| 76 | + |
| 77 | +See the how-to guide on how to generate Doxygen API locally :doc:`here <./how_to_generate_api_doxygen_locally>`. |
| 78 | + |
| 79 | +See the Doxygen documentation guide `here <https://www.doxygen.nl/manual/docblocks.html>`_. |
0 commit comments