Skip to content
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

Support documentation generation using rosdoc2 #1103

Merged
merged 8 commits into from
Apr 5, 2023

Conversation

Yadunund
Copy link
Member

@Yadunund Yadunund commented Apr 2, 2023

Addresses #1080
Requires ros-infrastructure/rosdoc2#51

Here we add a custom rosdoc2.yaml file which forces rosdoc2 to generate documentation for this package as if it were an ament_python package. No underlay needs to be sourced.

rclpy_docs

Cavats:

  1. If I set sphinx_sourcedir to docs/source in the rosdoc2.yaml file, ie, if we provide the custom conf.py file there several hundred warnings reported by autodoc. I noticed that these warnings go away when using the default conf.py file that rosdoc2 generates and hence left out the custom sourcedir. Perhaps this can be done for future work.

  2. I had to add a few rclpy submodules as doc_depends such that autodoc will mock these modules when trying to import them. Without this, there are several type errors thrown upon import as these submodules load constants from python C modules.
    Open to any suggestions here!

Detailed errors below:

  File "home/yadunund/ws_rosdoc2/docs_build/rclpy/rclpy/duration.py", line 31, in __init__
    total_nanoseconds += int(nanoseconds)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'RMW_DURATION_INFINITE'

  File "/home/yadunund/ws_rolling/src/ros2/rclpy/rclpy/rclpy/qos.py", line 444, in <module>
    qos_profile_unknown = QoSProfile(**_rclpy.rmw_qos_profile_t.predefined(
  File "/usr/local/google/home/yadunund/ws_rolling/src/ros2/rclpy/rclpy/rclpy/qos.py", line 82, in __init__
    raise InvalidQoSProfileException('History and/or depth settings are required.')
rclpy.qos.InvalidQoSProfileException: ('Invalid QoSProfile', 'History and/or depth settings are required.')

  File "/home/yadunund/ws_rolling/src/ros2/rclpy/rclpy/rclpy/clock.py", line 126, in __new__
    if not isinstance(clock_type, ClockType):
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

rclpy/package.xml Outdated Show resolved Hide resolved
rclpy/rosdoc2.yaml Outdated Show resolved Hide resolved
Signed-off-by: Yadunund <[email protected]>
rclpy/package.xml Outdated Show resolved Hide resolved
@clalancette
Copy link
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette clalancette merged commit 6182526 into rolling Apr 5, 2023
@clalancette clalancette deleted the yadu/add_rosdoc2_yaml branch April 5, 2023 12:37
TODO: Remove these depends once a better solution is found.-->
<doc_depend>rclpy.duration</doc_depend>
<doc_depend>rclpy.qos</doc_depend>
<doc_depend>rclpy.clock</doc_depend>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any discussion about this anywhere? I'd like to understand it better, because it seems... like an abuse of the dependency system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not apart from what was mentioned in the PR description. I agree we're taking advantage of the doc_depend tag but I couldn't find a better way to deal with the import errors. I'm all ears for a better solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants