Repository navigation
Contributing
agus-darmawan edited this page Oct 24, 2026
·
1 revision
The full conventions are in CONTRIBUTING.md of the hub and the manual's development chapter. In short:
-
<pkg>/core/is pure Python + numpy (no rclpy, messages, tf2 or launch);utils/holds the ROS-side helpers; nodes are thin and subclassdharma_utils.ros.DharmaNode. - Modules at most 300 lines (tests 400); ruff's complexity limits are on: split, do not
noqa. - Families of algorithms: an abstract base in
base.py, one implementation per file, adharma_utils.plugins.Registryopen to entry points. - Nothing robot-specific in code: geometry, limits and frames come from the
robot.*profile. - Parameters are dataclasses with
param(default, doc=, unit=, min=, max=); safety valueslive=False; units in names (_sec,_m,_deg), radians inside. - ROS 2 Foxy, Humble and Jazzy, Python 3.8+ (
from __future__ import annotationsfirst in every module, no 3.9+ runtime features), numpy >= 1.17; distro differences only throughdharma_utils.ros(compat,launch), never a branch on the distro in a package. - English, one-line docstrings, type hints, frozen dataclasses,
Enumstates.
pip install pre-commit && pre-commit install
pre-commit run --all-files # ruff, clang-format, prettier, shellcheck, yaml/xml checks
colcon build && colcon test && colcon test-result --verbose
PYTHONPATH=$PWD python -m pytest -q test/unit # fast, from a package directory, no ROS-
test/unit: pytest oncore/.test/ros: rclpy in-process node tests (unique node names,rclpy.init()/try_shutdown()per test).test/test_style.py: the package conventions. - Every fixed defect gets a regression test.
-
ament_pythonpackages declareextras_require={'test': ['pytest']}, otherwise colcon runs no tests: check thatcolcon test-resultreports your tests, not 0. - Never name a module-level test helper
setuporteardown: the Foxy, Humble and Jazzy pytest run them as nose-style fixtures. Foxy's CI runs pytest 4.6.
- Conventional Commits, one short line:
fix(mux): rotation inside the field. - One topic per pull request into
main; CI must be green on Foxy, Humble and Jazzy. - A change across several repositories uses the same branch name in each: CI builds the dependencies from that branch when it exists.
- Safety-relevant changes (speeds, limits, e-stop, avoidance, the mux, the robot profile) need a test that drives the logic, a note on how it was tried on the robot and a CHANGELOG entry.
SemVer with a Keep a Changelog CHANGELOG.md in every repository; the stack moves together
(0.1 -> 0.2 was a breaking release of every package). Products pin the release tags.
docs/ of the hub: make -C docs builds the diagrams, the manual and the paper (draw.io and a
LaTeX installation with latexmk); make -C docs reference SRC=<dir with the dharma_* checkouts>
regenerates the manual's parameter and interface tables from the code. This wiki's sources are in
docs/wiki/.