Skip to content

Commit

Permalink
Fix issues, add action support
Browse files Browse the repository at this point in the history
  • Loading branch information
rkent committed Mar 27, 2024
1 parent 5dc0885 commit 1a96ae5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def generate_package_toc_entry(*, build_context, interface_counts) -> str:
# inside the string to fall under the `:toctree:` directive
toc_entry_cpp = ' C++ API <generated/index>\n'
toc_entry_py = ' Python API <modules>\n'
toc_entry_msg = ' Message Definitions <generated/message_definitions>\n'
toc_entry_srv = ' Service Definitions <generated/service_definitions>\n'
toc_entry_action = ' Action Definitions <generated/action_definitions>\n'

toc_entry = '\n'

if build_type == 'ament_python' or always_run_sphinx_apidoc or ament_cmake_python:
Expand All @@ -53,6 +57,8 @@ def generate_package_toc_entry(*, build_context, interface_counts) -> str:
toc_entry += toc_entry_msg
if interface_counts['srv'] > 0:
toc_entry += toc_entry_srv
if interface_counts['action'] > 0:
toc_entry += toc_entry_action
return toc_entry


Expand Down
6 changes: 2 additions & 4 deletions rosdoc2/verbs/build/generate_interface_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
# limitations under the License.


"""Generate rst files for messages and services."""
"""Generate rst files for messages, services, and actions."""

import fnmatch
import os

# from jinja2 import Template

iface_fm_rst = """\
{iface_name}
{name_underline}
Expand Down Expand Up @@ -64,7 +62,7 @@ def generate_interface_docs(path: str, package: str, output_dir: str):
:rtype: dict(str, int)
"""
counts = {}
for type_info in (('msg', 'message'), ('srv', 'service')):
for type_info in (('msg', 'message'), ('srv', 'service'), ('action', 'action')):
count = 0
(type_ext, type_name) = type_info
interfaces = _find_files_with_extension(path, type_ext)
Expand Down
11 changes: 11 additions & 0 deletions test/packages/full_package/action/Fibonacci.action
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This action is based on the action tutorial
# https://docs.ros.org/en/rolling/Tutorials/Intermediate/Creating-an-Action.html

# order of the Fibonacci sequence we want to compute
int32 order
---
# the final result
int32[] sequence
---
# feedback of what is completed so far
int32[] partial_sequence
3 changes: 3 additions & 0 deletions test/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def test_full_package(session_dir):
PKG_NAME,
'python api',
'c++ api',
'message definitions',
'service definitions',
'action definitions'
]
file_includes = [
'generated/index.html'
Expand Down

0 comments on commit 1a96ae5

Please sign in to comment.