Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/ros-tooling/setup-…
Browse files Browse the repository at this point in the history
…ros-0.7
  • Loading branch information
Mohamed authored Sep 5, 2023
2 parents b13c3a0 + d30071a commit cc25b5f
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ament_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
container:
image: ubuntu:22.04
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@v0.7
- uses: actions/checkout@v4
- uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: humble # We will have to keep it up-to-date with <https://docs.ros.org/en/foxy/Releases.html>
- uses: ros-tooling/action-ros-lint@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/colcon_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/setup-ros@v0.7
- uses: actions/checkout@v4
- uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: ${{ matrix.ros2-version }}
- uses: ros-tooling/action-ros-ci@v0.3
Expand Down
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.5
hooks:
- id: codespell
name: Fixing common spelling mistakes
args:
- --write-changes
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
rev: v0.36.0
hooks:
- id: markdownlint
name: Fixing markdown linting errors
Expand All @@ -29,12 +29,12 @@ repos:
- id: absolufy-imports
name: Make python imports absolute
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
name: Python formatting (black)
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.2
rev: v1.7.5
hooks:
- id: docformatter
name: Python docstring formatting (docformatter)
Expand All @@ -45,13 +45,13 @@ repos:
name: Sorting python imports
args: [--profile, black]
- repo: https://github.com/asottile/pyupgrade
rev: v3.6.0
rev: v3.10.1
hooks:
- id: pyupgrade
name: Upgrade common mistakes
args: [--py38-plus]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
name: Linting Python code (flake8)
Expand All @@ -61,21 +61,21 @@ repos:
- flake8-comprehensions
- flake8-simplify
- pep8-naming
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
hooks:
- id: ruff
name: Linting Python code (ruff)
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.9.0
rev: v2.10.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.5.1
hooks:
- id: mypy
name: Static typechecking (mypy)
Expand Down
32 changes: 16 additions & 16 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,78 +24,78 @@ TODO: description

- **`background_b`** (integer)

TODO: description
Blue channel of the background color

- **`background_g`** (integer)

TODO: description
Green channel of the background color

- **`background_r`** (integer)

TODO: description
Red channel of the background color

### Subscribers

- **`/turtle1/cmd_vel`** (geometry_msgs/msg/Twist)

TODO: description
TODO: description

### Publishers

- **`/turtle1/color_sensor`** (turtlesim/msg/Color)

TODO: description
TODO: description

- **`/turtle1/pose`** (turtlesim/msg/Pose)

TODO: description
TODO: description

### Services

- **`/clear`** (std_srvs/srv/Empty)

TODO: description
TODO: description

- **`/kill`** (turtlesim/srv/Kill)

TODO: description
TODO: description

- **`/reset`** (std_srvs/srv/Empty)

TODO: description
TODO: description

- **`/spawn`** (turtlesim/srv/Spawn)

TODO: description
TODO: description

- **`/turtle1/set_pen`** (turtlesim/srv/SetPen)

TODO: description
TODO: description

- **`/turtle1/teleport_absolute`** (turtlesim/srv/TeleportAbsolute)

TODO: description
TODO: description

- **`/turtle1/teleport_relative`** (turtlesim/srv/TeleportRelative)

TODO: description
TODO: description

### Actions

- **`/turtle1/rotate_absolute`** (turtlesim/action/RotateAbsolute)

TODO: description
TODO: description

### draw_square

### Subscribers

- **`/turtle1/pose`** (turtlesim/msg/Pose)

TODO: description
TODO: description

### Publishers

- **`/turtle1/cmd_vel`** (geometry_msgs/msg/Twist)

TODO: description
TODO: description
8 changes: 5 additions & 3 deletions ros2autodoc/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def get_nodes(package_name):
def document_node(node, package_name, node_name, path):
"""Document the given node."""
writer = DocWriter(package_name, node_name, path)
param_names, params = _get_parameters(node, node_name)
param_names, params, description = _get_parameters(node, node_name)
if len(params) > 0:
writer.get_parameters(param_names, params)
writer.get_parameters(param_names, params, description)
subscribers = get_subscriber_info(
node=node, remote_node_name=node_name, include_hidden=False
)
Expand All @@ -120,11 +120,13 @@ def document_node(node, package_name, node_name, path):

def _get_parameters(node, node_name):
name_to_type_map = {}
name_to_description_map = {}
parameter_names = call_list_parameters(node=node, node_name=node_name)
sorted_names = sorted(parameter_names)
resp = call_describe_parameters(
node=node, node_name=node_name, parameter_names=sorted_names
)
for descriptor in resp.descriptors:
name_to_type_map[descriptor.name] = get_parameter_type_string(descriptor.type)
return sorted_names, name_to_type_map
name_to_description_map[descriptor.name] = descriptor.description
return sorted_names, name_to_type_map, name_to_description_map
17 changes: 14 additions & 3 deletions ros2autodoc/api/doc_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ def __init__(self, package_name, node_name, directory):
self.services = []
self.actions = []

def get_parameters(self, param_names, params_map):
def get_parameters(self, param_names, params_map, desciption_map):
for param in param_names:
if param not in PARAMS_TO_IGNORE:
param_type = params_map[param]
self.parameters.append({"name": param, "type": param_type})
param_description = desciption_map[param]
self.parameters.append(
{
"name": param,
"type": param_type,
"description": param_description,
}
)

def get_subscribers(self, subscribers):
for sub in subscribers:
Expand Down Expand Up @@ -138,4 +145,8 @@ def _write_item(self, file, item):
_name = item["name"]
_type = item["type"]
file.write(f"- **`{_name}`** ({_type})\n\n")
file.write(f"{TODO}")
if "description" in item:
_description = item["description"]
file.write(f" {_description}\n\n")
else:
file.write(f" {TODO}")

0 comments on commit cc25b5f

Please sign in to comment.