Skip to content

Commit 23e70ad

Browse files
committed
docs: added existing documentation main repo
1 parent bbc1237 commit 23e70ad

25 files changed

+2086
-0
lines changed

.github/workflows/docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Deploy Sphinx Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r docs/requirements.txt
34+
35+
- name: Build Sphinx HTML
36+
run: sphinx-build -b html docs docs/_build/html
37+
38+
- name: Setup GitHub Pages
39+
uses: actions/configure-pages@v3
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/_build/html
45+
46+
deploy:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ settings.json
1919
*.egg-info
2020
video*
2121
GEMINI.md
22+
docs/_build

docs/_static/.keep

Whitespace-only changes.

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

docs/conf.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
import sys
3+
sys.path.insert(0, os.path.abspath('..'))
4+
5+
project = 'Robot Control Stack'
6+
author = 'Tobias Jülg'
7+
release = '0.4'
8+
9+
extensions = [
10+
'myst_parser',
11+
'sphinx.ext.autodoc',
12+
'sphinx.ext.napoleon',
13+
'sphinx.ext.viewcode',
14+
]
15+
16+
templates_path = ['_templates']
17+
exclude_patterns = []
18+
19+
html_theme = 'pydata_sphinx_theme'
20+
html_static_path = ['_static']
21+
html_logo = "images/rcs_logo_multiline.svg"
22+
html_favicon = "images/favicon.ico"
23+
24+
html_theme_options = {
25+
"github_url": "https://github.com/RobotControlStack/robot-control-stack",
26+
"use_edit_page_button": True,
27+
"show_prev_next": False,
28+
"navbar_start": ["navbar-logo"], # ensures the logo is shown
29+
"logo": {
30+
"image_light": "images/rcs_logo_multiline.svg", # your PNG
31+
"image_dark": "images/rcs_logo_multiline.svg", # can be same or a dark-mode version
32+
},
33+
34+
}
35+
36+
html_context = {
37+
"github_user": "RobotControlStack",
38+
"github_repo": "robot-control-stack",
39+
"github_version": "main", # branch name
40+
"doc_path": "docs", # relative path in the repo where your docs live
41+
}
42+
43+
44+
myst_enable_extensions = [
45+
"colon_fence",
46+
"deflist",
47+
"linkify",
48+
]

docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Contributing

docs/documentation.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Documentation
2+
3+
```{toctree}
4+
:maxdepth: 1
5+
documentation/getting_started.md
6+
documentation/usage.md
7+
documentation/hardware_extentions.md
8+
documentation/development.md
9+
```

docs/documentation/development.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Development
2+
```shell
3+
# check for c++ formatting errors
4+
make cppcheckformat
5+
# fix them
6+
make cppformat
7+
# Linting with clang tidy
8+
make cpplint
9+
# check for python formatting errors
10+
make pycheckformat
11+
# fix them
12+
make pyformat
13+
# Linting with ruff and mypy
14+
make pylint
15+
# Testing
16+
make pytest
17+
```
18+
19+
## Stub Files for Python Bindings
20+
We use autogenerated python stub files (`.pyi`) in the [`_core`](python/rcs/_core/) folder to show our linters the expected types of the C++ Python bindings.
21+
If the python bindings in the C++ code have changed you might need to regenerate them by using:
22+
```shell
23+
make stubgen
24+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Getting Started
2+
3+
```{toctree}
4+
:maxdepth: 1
5+
6+
getting_started/installation.md
7+
getting_started/docker_installation.md
8+
getting_started/concepts.md
9+
10+
```
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Build System
2+
3+
## 1. You Run
4+
5+
pip install -e .
6+
7+
This tells `pip` to:
8+
9+
- Perform an **editable install** of the current project.
10+
- Use the `pyproject.toml` as the **single source of truth** for building and packaging.
11+
12+
---
13+
14+
## 2. `pip` Reads `pyproject.toml`
15+
16+
It sees:
17+
18+
[build-system]
19+
build-backend = "scikit_build_core.build"
20+
21+
So `pip` uses **`scikit-build-core`** as the **build backend** (instead of legacy `setuptools`).
22+
23+
---
24+
25+
## 3. `scikit-build-core` Invokes CMake
26+
27+
It starts a CMake build, just like if you had run:
28+
29+
cmake -S . -B build
30+
cmake --build build
31+
32+
It uses the `CMakeLists.txt` at the project root, which:
33+
34+
- Declares the project:
35+
36+
project(rcs LANGUAGES C CXX VERSION 0.4.0)
37+
38+
- Sets modern C++20 and compiler policies.
39+
- Locates external dependencies:
40+
- `Eigen3`, `Python3`, `MuJoCo`, `pinocchio`
41+
- Downloads with `FetchContent`: `rl`, `pybind11`
42+
- Includes:
43+
44+
add_subdirectory(src)
45+
46+
---
47+
48+
## 4. CMake Enters `src/CMakeLists.txt`
49+
50+
add_subdirectory(rcs)
51+
target_include_directories(rcs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
52+
add_subdirectory(sim)
53+
add_subdirectory(pybind)
54+
55+
This loads and builds 3 subcomponents.
56+
57+
---
58+
59+
## 5. Subcomponent Builds
60+
61+
### `src/rcs/CMakeLists.txt`
62+
63+
add_library(rcs SHARED)
64+
target_sources(rcs PRIVATE Pose.cpp Robot.cpp IK.cpp utils.cpp)
65+
target_link_libraries(rcs PUBLIC Eigen3::Eigen mdl pinocchio::all)
66+
67+
- Builds a **shared C++ library**: `rcs`
68+
- Contains your **robot control logic**
69+
- Exposes `include/` headers
70+
- Linked against external libraries
71+
72+
### `src/sim/CMakeLists.txt`
73+
74+
add_library(sim)
75+
target_sources(sim PRIVATE sim.cpp SimRobot.cpp ...)
76+
target_link_libraries(sim PUBLIC rcs MuJoCo::MuJoCo)
77+
78+
- Builds a **C++ simulation library**
79+
- Depends on:
80+
- Your own `rcs` library
81+
- MuJoCo physics engine
82+
83+
### `src/pybind/CMakeLists.txt`
84+
85+
pybind11_add_module(_core MODULE rcs.cpp)
86+
target_link_libraries(_core PRIVATE sim rcs)
87+
88+
- Compiles a Python extension module: `_core.so`
89+
- Uses `pybind11` to bind C++ classes/functions
90+
- Links to both `sim` and `rcs` native libraries
91+
- Adds install instructions:
92+
93+
install(TARGETS _core rcs DESTINATION rcs COMPONENT python_package)
94+
95+
---
96+
97+
## 6. Packaging into Python
98+
99+
From `pyproject.toml`:
100+
101+
[tool.scikit-build]
102+
build.targets = ["_core", "scenes", "rcs"]
103+
wheel.packages = ["python/rcs"]
104+
install.components = ["python_package"]
105+
106+
- `scikit-build-core` installs `_core.so` into:
107+
108+
python/rcs/_core.so
109+
110+
- That directory becomes a valid **Python package**
111+
112+
---
113+
114+
## 7. Result: Python Import Works
115+
116+
After install:
117+
118+
from rcs import _core
119+
120+
- You now access the C++ functionality exposed in `rcs.cpp` through Python.
121+
- `_core` contains Python-wrapped C++ objects/functions via `pybind11`.
122+
123+
---
124+
125+
## Summary Diagram
126+
127+
pip install -e .
128+
129+
130+
Reads pyproject.toml (scikit_build_core used)
131+
132+
133+
CMakeLists.txt (root) → add_subdirectory(src)
134+
135+
136+
src/rcs → builds C++ library `rcs`
137+
src/sim → builds C++ library `sim`
138+
src/pybind → builds Python extension `_core`
139+
140+
141+
All .so libraries installed in `python/rcs/`
142+
`_core` accessible from Python as import
143+
144+
---
145+
146+
## Recap of Build Layers
147+
148+
| Layer | Role | Tool |
149+
| --- | --- | --- |
150+
| `pyproject.toml` | Project metadata, build backend | `pip`, `scikit-build-core` |
151+
| `CMakeLists.txt` (root) | Configure the full C++ build | `CMake` |
152+
| `src/rcs` | Core robot logic in C++ | `C++`, `Eigen`, `pinocchio` |
153+
| `src/sim` | Simulation logic, MuJoCo | `C++`, `MuJoCo` |
154+
| `src/pybind` | Bindings to Python | `pybind11` |
155+
| `python/rcs/` | Python package with compiled `.so` | `scikit-build`, `pip` |
156+
157+
158+

0 commit comments

Comments
 (0)