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

API docs for the whole stack via doxygen #278

Merged
merged 27 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d71f3cf
Use all repositories for doxygen
christophfroehlich Apr 20, 2024
4946910
Switch API also for multi-version
christophfroehlich Apr 20, 2024
f7e91f0
Convert bash scripts to python
christophfroehlich Apr 20, 2024
331d285
Fix check_links
christophfroehlich Apr 20, 2024
89fefaf
Add branch_version for every repo
christophfroehlich Apr 20, 2024
17a6747
Update .gitignore
christophfroehlich Apr 20, 2024
ff5c446
Abort only if subrepos have uncommited changes
christophfroehlich Apr 20, 2024
8b3c847
Checkout correct branches for multiversion-api
christophfroehlich Apr 20, 2024
b021c3b
Fix ci-format.yml
christophfroehlich Apr 20, 2024
e381fa5
Update exclude patterns
christophfroehlich Apr 20, 2024
06f41f8
Readd delete_sub_repos
christophfroehlich Apr 20, 2024
6682920
Add debug output
christophfroehlich Apr 20, 2024
77adae0
Add pycache to gitignore
christophfroehlich Apr 20, 2024
78ceba4
Fix multiversion (PR) workflow
christophfroehlich Apr 20, 2024
77391fc
Fix ref
christophfroehlich Apr 20, 2024
54bf3bc
Fix ref
christophfroehlich Apr 20, 2024
441ceb1
Fix refs for PR workflow
christophfroehlich Apr 20, 2024
9617e27
Fix add_sub_repos
christophfroehlich Apr 20, 2024
f319390
Add debug output
christophfroehlich Apr 20, 2024
7912e78
Delete sub-repos at the correct time
christophfroehlich Apr 20, 2024
f452f5c
Try to set the correct branch also for PRs
christophfroehlich Apr 20, 2024
53149b4
Fix multiversion-PR with sphinx
christophfroehlich Apr 20, 2024
f6c7919
Fix api_multi_version
christophfroehlich Apr 20, 2024
bbb654c
Add ROS version to doxygen output
christophfroehlich Apr 20, 2024
d25d895
Last text updates
christophfroehlich Apr 20, 2024
6709e57
Run wf only if relevant settings have changed
christophfroehlich Apr 20, 2024
8b356e2
Apply suggestions from code review
christophfroehlich Apr 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
reviewer-stats
path: ~/reviews
- name: Copy stats
run: ./make_help_scripts/add_pr_stats
run: ./make_help_scripts/add_pr_stats.py
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --hook-stage manual
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
name: "Build Multiversion Page (PR)"
name: "Build Multiversion Page"
on:
workflow_dispatch:
inputs:
BASE_BRANCH:
description: 'Chose branch to run on'
required: true
default: 'master'
type: choice
options:
- humble
- iron
- master
saikishor marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches:
- master
paths:
- 'make_help_scripts/**'
- 'conf.py'

jobs:
build-multiversion:
Expand Down Expand Up @@ -29,6 +44,9 @@ jobs:
- name: Install doxygen and graphviz
run: sudo apt-get install -y doxygen graphviz
- name: Build multiversion with API
env:
BASE_BRANCH: ${{ github.event.inputs.BASE_BRANCH }}
BASE_BRANCH_PR: ${{ github.event.pull_request.head.ref }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# ignore pages build by sphinx
_build/*

# ignore python cache
**/__pycache__/

# ignore other docs that are included either by checkout or symlink
doc/ros2_control
doc/ros2_control_demos
doc/ros2_controllers
doc/gazebo_ros2_control
doc/gz_ros2_control
doc/control_msgs/
doc/control_toolbox/
doc/kinematics_interface/
doc/realtime_tools/
46 changes: 23 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,80 +30,80 @@ html-with-api: Makefile
@echo Step 1: Creating html files
$(SPHINXBUILD) $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 2: Building API
./make_help_scripts/create_api
./make_help_scripts/create_api.py

html-all-subrepos: Makefile
@echo Single html file without API
@echo Step 1: Cloning all subrepositories
./make_help_scripts/add_sub_repos
./make_help_scripts/add_sub_repos.py
@echo Step 2: Building documentation
$(SPHINXBUILD) $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting subrepositories in doc/ folder
./make_help_scripts/delete_sub_repos
./make_help_scripts/delete_sub_repos.py

html-all-subrepos-with-errors: Makefile
@echo Single html file without API
@echo Step 1: Cloning all subrepositories
./make_help_scripts/add_sub_repos
./make_help_scripts/add_sub_repos.py
@echo Step 2: Building documentation
$(SPHINXBUILD) $(SPHINXOPTS) -W --keep-going $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting subrepositories in doc/ folder
./make_help_scripts/delete_sub_repos
./make_help_scripts/delete_sub_repos.py

html-all-subrepos-with-api: Makefile
@echo Single html file with API
@echo Step 1: Cloning all subrepositories
./make_help_scripts/add_sub_repos
./make_help_scripts/add_sub_repos.py
@echo Step 2: Building documentation
$(SPHINXBUILD) $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting subrepositories in doc/ folder
./make_help_scripts/delete_sub_repos
@echo Step 4: Building API
./make_help_scripts/create_api
@echo Step 3: Building API
./make_help_scripts/create_api.py
@echo Step 4: Deleting subrepositories in doc/ folder
./make_help_scripts/delete_sub_repos.py

linkcheck-all-subrepos-with-api: Makefile
@echo Single version html file with API and linkcheck
@echo Step 1: Cloning all subrepositories
./make_help_scripts/add_sub_repos
./make_help_scripts/add_sub_repos.py
@echo Step 2: Building API
./make_help_scripts/create_api
@echo Step 3: Cloning all subrepositories again
./make_help_scripts/add_sub_repos
saikishor marked this conversation as resolved.
Show resolved Hide resolved
@echo Step 4: Check links
./make_help_scripts/check_links $(BUILDDIR)
./make_help_scripts/create_api.py
@echo Step 3: Check links
./make_help_scripts/check_links.py $(BUILDDIR)/html
@echo Step 4: Deleting subrepositories in doc/ folder
./make_help_scripts/delete_sub_repos.py

multiversion: Makefile
@echo Building multi version documentation without API
@echo Step 1: Creating temporary commits
./make_help_scripts/add_tmp_commits
./make_help_scripts/add_tmp_commits.py
@echo Step 2: Build multi version documentation
sphinx-multiversion $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting temporary commits
./make_help_scripts/delete_tmp_commits
./make_help_scripts/delete_tmp_commits.py
@echo Step 4: Create correct index
@echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=master/index.html\" /></head></html>" > "$(BUILDDIR)"/html/index.html

multiversion-with-errors: Makefile
@echo Building multi version documentation without API
@echo Step 1: Creating temporary commits
./make_help_scripts/add_tmp_commits
./make_help_scripts/add_tmp_commits.py
@echo Step 2: Build multi version documentation
sphinx-multiversion $(SPHINXOPTS) -W --keep-going $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting temporary commits
./make_help_scripts/delete_tmp_commits
./make_help_scripts/delete_tmp_commits.py
@echo Step 4: Create correct index
@echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=master/index.html\" /></head></html>" > "$(BUILDDIR)"/html/index.html

multiversion-with-api: Makefile
@echo Building multi version documentation with API
@echo Step 1: Creating temporary commits
./make_help_scripts/add_tmp_commits
./make_help_scripts/add_tmp_commits.py
@echo Step 2: Build multi version documentation
sphinx-multiversion $(SPHINXOPTS) $(SOURCEDIR) $(BUILDDIR)/html
@echo Step 3: Deleting temporary commits
./make_help_scripts/delete_tmp_commits
./make_help_scripts/delete_tmp_commits.py
@echo Step 4: Building multiverison API
./make_help_scripts/create_api_multi_version
./make_help_scripts/create_api_multi_version.py
@echo Step 5: Create correct index
@echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=master/index.html\" /></head></html>" > "$(BUILDDIR)"/html/index.html

Expand Down
20 changes: 16 additions & 4 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
# exclude index.rst files for metapackages for rosdoc2
# exclude index.rst files from packages/metapackages for rosdoc2
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store",
"**/CHANGELOG.rst", "**/README.rst",
"doc/ros2_control/ros2_control/**.rst",
"doc/realtime_tools/doc/**.rst",
"doc/control_msgs/doc/**.rst",
"doc/control_toolbox/doc/**.rst",
christophfroehlich marked this conversation as resolved.
Show resolved Hide resolved
christophfroehlich marked this conversation as resolved.
Show resolved Hide resolved
"doc/kinematics_interface/**.rst",
"doc/ros2_controllers/ros2_controllers/**.rst"]

# The name of the Pygments (syntax highlighting) style to use.
Expand Down Expand Up @@ -187,9 +191,17 @@
# Drop any source link suffix
html_sourcelink_suffix = ""

# branch from which is started to checkout other branches
# TODO(anyone) use make_help_scripts/deploy_defines.py to set this variable
if os.environ.get('BASE_BRANCH_PR') is not None:
base_branch = os.environ.get('BASE_BRANCH_PR')
elif os.environ.get('BASE_BRANCH') is not None:
base_branch = os.environ.get('BASE_BRANCH')
else:
base_branch = "master"

# Add branches you want to whitelist here.
smv_branch_whitelist = r"^(foxy|galactic|humble|iron|master)$"
smv_branch_whitelist = r"^(foxy|galactic|humble|iron|"+ base_branch + r")$"
smv_released_pattern = r"^refs/(heads|remotes/[^/]+)/(foxy|galactic|humble|iron).*$"
christophfroehlich marked this conversation as resolved.
Show resolved Hide resolved
smv_remote_whitelist = r"^(origin)$"
smv_latest_version = "iron"
Expand Down Expand Up @@ -317,15 +329,15 @@ def smv_rewrite_configs(app, config):
if app.config.smv_current_version != "":
# this map is used to match branches of control.ros.org to ROS distros, e.g., DISTRO macro
branch_distro = {
"master": "rolling",
base_branch: "rolling",
"iron": "iron",
"humble": "humble",
"foxy": "foxy",
"galactic": "galactic"
}
# this map is used to match branches of control.ros.org to REPOS_FILE_BRANCH macro
subrepo_branch = {
"master": "master",
base_branch: "master",
"iron": "iron",
"humble": "humble",
"foxy": "foxy",
Expand Down
4 changes: 4 additions & 0 deletions doc/api_list/api_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
API Documentation
=================

ros2_control stack
#############################
API documentation for the whole framework is parsed by doxygen and can be found `here <../api/index.html>`_.

Per-Package API Documentation
#############################
In the following, you can find links to the per-package API documentation published on docs.ros.org.

ros2_control
Expand Down
2 changes: 1 addition & 1 deletion doc/api_list/mainpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is the API documentation of the ros2_control framework including the follow

* [ros2_control][ros2_control] - the main interfaces and components of the framework;
* [ros2_controllers][ros2_controllers] - widely used controllers, such as forward command controller, joint trajectory controller, differential drive controller;
* [ros2_control_demos][ros2_control_demos] - examples implementations of common use-cases for a smooth start;
* [ros2_control_demos][ros2_control_demos] - example implementations of common use-cases for a smooth start;
* [control_toolbox][control_toolbox] - some widely-used control theory implementations (e.g. PID) used by controllers;
* [realtime_tools][realtime_tools] - general toolkit for realtime support, e.g., realtime buffers and publishers;
* [control_msgs][control_msgs] - common messages.
Expand Down
6 changes: 3 additions & 3 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ The ros2_control framework consists of the following Github repositories:
* `ros2_controllers`_ - widely used controllers, such as forward command controller, joint trajectory controller, differential drive controller;
* `control_toolbox`_ - some widely-used control theory implementations (e.g. PID) used by controllers;
* `realtime_tools`_ - general toolkit for realtime support, e.g., realtime buffers and publishers;
* `control_msgs`_ - common messages.
* `kinematics_interface`_ - for using C++ kinematics frameworks.
* `control_msgs`_ - common messages;
* `kinematics_interface`_ - for using C++ kinematics frameworks;


Additionally, there are following (unreleased) packages are relevant for getting-started and project management:

* `ros2_control_demos`_ - examples implementations of common use-cases for a smooth start;
* `ros2_control_demos`_ - example implementations of common use-cases for a smooth start;
* `roadmap`_ - planning and design docs for the project.

Development Organisation and Communication
Expand Down
9 changes: 0 additions & 9 deletions make_help_scripts/add_pr_stats

This file was deleted.

18 changes: 18 additions & 0 deletions make_help_scripts/add_pr_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# Copyright (c) 2023 ros2_control maintainers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from deploy_defines import add_pr_stats_file

add_pr_stats_file()
35 changes: 0 additions & 35 deletions make_help_scripts/add_sub_repos

This file was deleted.

48 changes: 48 additions & 0 deletions make_help_scripts/add_sub_repos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# Copyright (c) 2023 ros2_control maintainers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import subprocess
import deploy_defines

def add_sub_repositories(base_branch):
# checkout a base for defined starting point
print(f"base_branch: {base_branch}")
print(f"base_version: {deploy_defines.branch_version[base_branch]}")
os.chdir(deploy_defines.base_dir)
for repo_name, repo_details in deploy_defines.repos.items():
repo_path = os.path.join("doc", repo_name)
branch = repo_details["branch_version"][deploy_defines.branch_version[base_branch]]
if not os.path.isdir(repo_path):
print(f"Create {repo_path} and checkout {branch} branch")
subprocess.run(["git", "clone", "-b", branch, repo_details["url"], repo_path], check=True)
else:
print(f"Update {repo_path} and checkout {branch} branch")
os.chdir(repo_path)
subprocess.run(["git", "fetch", "origin"], check=True)
subprocess.run(["git", "checkout", branch], check=True)
subprocess.run(["git", "pull"], check=True)
os.chdir(deploy_defines.base_dir)
if repo_details["pr"]:
PR = repo_details["pr"]
print(f"checkout PR: {PR}")
os.chdir(repo_path)
subprocess.run(["git", "fetch", "origin", f"{PR}:PR"], check=True)
subprocess.run(["git", "checkout", "PR"], check=True)
os.chdir(deploy_defines.base_dir)

if __name__ == "__main__":
add_sub_repositories(deploy_defines.base_branch)
deploy_defines.add_pr_stats_file()
Loading
Loading