Skip to content

Commit 3bb5c09

Browse files
authored
Merge pull request #169 from purdue-arc/new-docs
Overhaul documentation
2 parents aba228f + b11f599 commit 3bb5c09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1630
-376
lines changed

.github/workflows/docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Docs
2+
on:
3+
workflow_call:
4+
inputs:
5+
tag:
6+
default: "latest"
7+
required: false
8+
type: string
9+
permissions:
10+
contents: write
11+
jobs:
12+
docs:
13+
runs-on: ubuntu-latest
14+
env:
15+
DOCKER_CMD: >-
16+
. /opt/ros/noetic/setup.zsh &&
17+
cd catkin_ws/src/rocket_league/docs &&
18+
pip install -r requirements.txt &&
19+
make html
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
path: src/rocket_league
25+
- name: Build the local Docker image
26+
run: ./src/rocket_league/docker/docker-build.sh --build-arg TAG=${{ inputs.tag }}
27+
- name: Build docs
28+
run: ./src/rocket_league/docker/docker-run.sh
29+
- name: Deploy
30+
uses: peaceiris/actions-gh-pages@v3
31+
if: ${{ github.event_name == 'push' }}
32+
with:
33+
publish_branch: gh-pages
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
publish_dir: src/rocket_league/docs/_build
36+
force_orphan: true

.github/workflows/top-push.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ jobs:
3232
needs: docker
3333
if: always()
3434
uses: purdue-arc/rocket_league/.github/workflows/catkin-build-test.yml@main
35+
docs:
36+
name: Build and deploy documentation
37+
if: always()
38+
uses: purdue-arc/rocket_league/.github/workflows/docs.yml@main

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ instance/
7070

7171
# Sphinx documentation
7272
docs/_build/
73+
docs/html/
74+
docs/autoapi
75+
docs/rosdoc/
76+
docs/rktl_*/
7377

7478
# PyBuilder
7579
target/
@@ -145,3 +149,7 @@ dmypy.json
145149

146150
# macOS
147151
.DS_Store
152+
153+
# docker files
154+
/docker/.vscode-server
155+
/docker/.zsh_history

docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ RUN apt update && \
2525
ros-$ROS_DISTRO-camera-calibration \
2626
ros-$ROS_DISTRO-joy \
2727
ros-$ROS_DISTRO-rosserial-arduino \
28-
ros-$ROS_DISTRO-rosbridge-server && \
28+
ros-$ROS_DISTRO-rosbridge-server \
29+
ros-$ROS_DISTRO-rosdoc-lite && \
2930
# pip
3031
pip3 install pybullet gym[box2d] stable-baselines3 pfilter optuna && \
3132
# clean up

docker/Dockerfile.local

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ RUN usermod -l $USER -u $UID -aG video,dialout -md /home/$USER $BASE_USER && \
1515
echo "$USER:$PW" | chpasswd
1616

1717
USER $USER
18+
ENV PATH="${PATH}:/home/$USER/.local/bin"
19+
1820
WORKDIR /home/$USER

docker/docker-build-base.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DOCKER_DIR=$(realpath $(dirname $0))
44
REPO_NAME="purduearc/rocket-league"
55

6-
docker buildx build \
6+
docker build \
77
--tag $REPO_NAME \
88
--cache-from=type=registry,ref=${REPO_NAME}:cache \
99
$@ \

docker/docker-run.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,34 @@ echo "Using display $MY_DISPLAY"
88
echo "mounting host directory $WS_DIR as container directory /home/$USER/catkin_ws"
99

1010
# tty-specific options
11-
if [ -t 0 -a -t 1 ]
12-
then
13-
TTY_OPTS="-it"
11+
if [ -t 0 -a -t 1 ]; then
12+
XTRA_OPTS="-it"
13+
fi
14+
15+
# gitconfig
16+
if [[ -f "$HOME/.gitconfig" ]]; then
17+
XTRA_OPTS="$XTRA_OPTS -v $HOME/.gitconfig:/home/$USER/.gitconfig:ro"
18+
fi
19+
20+
# Create histroy file and vscode-server files if they don't exist
21+
if [[ ! -f "$WS_DIR/.zsh_history" ]]; then
22+
touch "$WS_DIR/.zsh_history"
23+
fi
24+
25+
if [[ ! -d "$WS_DIR/.vscode-server" ]]; then
26+
mkdir "$WS_DIR/.vscode-server"
1427
fi
1528

1629
docker run --rm \
17-
$TTY_OPTS \
30+
$XTRA_OPTS \
1831
-e USER \
1932
-e DISPLAY=$MY_DISPLAY \
2033
-e NVIDIA_DRIVER_CAPABILITIES=all \
2134
-v $XAUTHORITY:/home/$USER/.Xauthority:ro \
2235
-v $WS_DIR:/home/$USER/catkin_ws \
2336
-v /tmp/.X11-unix:/tmp/.X11-unix \
24-
`[ -f ~/.gitconfig ] && echo "-v $HOME/.gitconfig:/home/$USER/.gitconfig:ro"` \
37+
-v $WS_DIR/.zsh_history:/home/$USER/.zsh_history \
38+
-v $WS_DIR/.vscode-server:/home/$USER/.vscode-server \
2539
-v ~/.ssh:/home/$USER/.ssh:ro \
2640
--name $CONTAINER_NAME \
2741
$@ \

docs/Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= ~/.local/bin/sphinx-build
8+
SOURCEDIR := .
9+
BUILDDIR := _build
10+
11+
# All Local Rocket League Packages
12+
RKTLPKGS := $(wildcard ../rktl_*/)
13+
14+
# Gather all READMES from the project
15+
READMES := $(foreach readme,$(shell find $(RKTLPKGS) -name 'README.md'),$(subst ../,,$(readme)))
16+
17+
# rosdoc output folder
18+
ROSDOC_DIR := rosdoc
19+
ROSDOC_PACKS := $(shell rospack list-names)
20+
ROSDOC_OUT := $(foreach pack,$(ROSDOC_PACKS),$(ROSDOC_DIR)/$(pack))
21+
ROSDOC_LOCAL := $(filter $(ROSDOC_DIR)/rktl_%,$(ROSDOC_OUT))
22+
ROSDOC_HTML_DIRS := action msg srv
23+
24+
# Put it first so that "make" without argument is like "make help".
25+
help:
26+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(SPHINXOPTS)
27+
28+
.PHONY: help clean readmes rosdoc Makefile $(READMES) $(ROSDOC_LOCAL)
29+
30+
clean:
31+
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(SPHINXOPTS)
32+
@rm -rf autoapi $(foreach readme,$(READMES),$(dir $(readme))) $(ROSDOC_OUT)
33+
34+
$(READMES):
35+
@mkdir -p $(dir $@)
36+
@cp ../$@ $@
37+
38+
readmes: $(READMES)
39+
40+
$(ROSDOC_OUT):
41+
@mkdir -p $@
42+
rosdoc_lite -o $@ $(shell rospack find $(notdir $@)) > /dev/null 2>&1
43+
@# Clean up big unnecessary files
44+
@rm $@/html/*.png
45+
@rm $@/html/*.js
46+
47+
rosdoc: $(ROSDOC_OUT)
48+
49+
# Catch-all target: route all unknown targets to Sphinx using the new
50+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
51+
%: Makefile readmes rosdoc
52+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(SPHINXOPTS)

docs/conf.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
13+
import os
14+
import sys
15+
import shutil
16+
sys.path.insert(0, os.path.abspath(".."))
17+
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = "Purdue ARC—Rocket League IRL"
22+
copyright = "2023, Autonomous Robotics Club of Purdue (Purdue ARC)"
23+
author = "Autonomous Robotics Club of Purdue (Purdue ARC)"
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
31+
extensions = [
32+
"sphinx.ext.duration",
33+
"sphinx.ext.doctest",
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.autosummary",
36+
"sphinx.ext.intersphinx",
37+
"autoapi.extension",
38+
"myst_parser",
39+
]
40+
41+
autoapi_dirs = [
42+
"../rktl_autonomy/src",
43+
"../rktl_perception/src",
44+
"../rktl_planner/src",
45+
"../rktl_sim/src",
46+
]
47+
autoapi_keep_files = True
48+
# autoapi_file_patterns = ["*.py", "*"]
49+
# autoapi_ignore = ["*.pyc", "*.cpp"]
50+
51+
intersphinx_mapping = {
52+
"rtd": ("https://docs.readthedocs.io/en/stable/", None),
53+
"python": ("https://docs.python.org/3/", None),
54+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
55+
}
56+
intersphinx_disabled_domains = ["std"]
57+
58+
templates_path = ["_templates"]
59+
60+
# -- Options for EPUB output
61+
epub_show_urls = "footnote"
62+
63+
# List of patterns, relative to source directory, that match files and
64+
# directories to ignore when looking for source files.
65+
# This pattern also affects html_static_path and html_extra_path.
66+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
67+
68+
# -- Options for HTML output -------------------------------------------------
69+
70+
# The theme to use for HTML and HTML Help pages. See the documentation for
71+
# a list of builtin themes.
72+
#
73+
html_theme = "sphinx_rtd_theme"
74+
75+
# Add any paths that contain custom static files (such as style sheets) here,
76+
# relative to this directory. They are copied after the builtin static files,
77+
# so a file named "default.css" will overwrite the builtin "default.css".
78+
html_static_path = ["_static"]
79+
html_extra_path = ["rosdoc"]

docs/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```{include} ../README.md
2+
```
3+
4+
```{note}
5+
This project is under active development.
6+
```
7+
8+
```{toctree}
9+
:caption: Contents
10+
:maxdepth: 2
11+
12+
Home <self>
13+
packages
14+
autoapi/index
15+
```

0 commit comments

Comments
 (0)