Skip to content

Docs/Sphinx cleanup and blocks/ type hints #574

Description

@petercorke

Migrated from tech-debt.md (deleted, see repo history via git log -- tech-debt.md). Groups docstring/Sphinx and type-hint hygiene sweeps.

  • Sweep robot/*.py for repeated :returns:/:param: field markers. Repeated field names don't trigger a Sphinx/docutils warning (silently accepted) but are still wrong. Known instances: BaseRobot.hasdynamics/hascollision (two consecutive :returns:), BaseRobot.ets (duplicated :param :param start:/:param :param end:, stray trailing colon), BaseRobot.todegrees (six consecutive :returns: lines), a path-returning method and a gripper/end-effector method (three consecutive :returns: each), one of BaseRobot's q-random methods (:returns: ... :rtype: ... crammed onto one line). Fix: grep ^\s*:returns:.*\n\s*:returns: (and :param:) and manually merge each into a single well-formed field -- needs a human read of intent, not a mechanical script.

  • Systematic sweep: bare NumPy-style section headers → explicit reST directives, codebase-wide. The codebase is mid-migration from NumPy-style docstrings to reST fields. :seealso: is used 202 times (the intended convention), but the vestigial bare See Also NumPy-style heading (underlined with ----) still appears 48 times across 6 files -- each one a latent instance of the Napoleon/sphinx_autodoc_typehints conflict that broke the Sphinx build once already (BaseRobot.dotfile, fixed by converting to .. rubric:: Notes). Likely true for other NumPy-recognized headers too (Notes, Warning, Raises, Attributes, Examples). Grep ^\s*(Notes?|Warnings?|Parameters|Returns|Raises|Yields|Attributes|Methods|References|See Also|Examples)\s*$ followed by a matching -+ underline, outside tools/urdf/ (which has genuine vendored NumPy-style docstrings Napoleon correctly converts -- don't touch those), and convert each to its reST equivalent.

  • Rewrite intro.rst's "Collision checking" section. Still describes PyBullet ("dramatically improved... using [PyBullet]_", plus a [PyBullet]_ citation) even though the collision backend switched to coal. This is prose adapted from the ICRA2021 paper, not a plain install matrix, so it needs a deliberate rewrite (describing coal's GJK/EPA, CollisionObject/BVHModelOBBRSS, primitive shapes) rather than a mechanical find-replace, plus updating/dropping the [PyBullet]_ reference and noting collision checking is Linux/macOS-only via pip (no Windows wheels for coal on PyPI -- conda-forge has them, that's an accepted, deliberate gap, not itself something to fix).

  • Add type hints throughout src/roboticstoolbox/blocks/. 5 files (arm.py, mobile.py, quad_model.py, spatial.py, uav.py) defining bdsim block classes have essentially no type hints (arm.py alone has 16 untyped __init__ methods) -- unlike the rest of the codebase's modern-syntax convention. Real consequence already hit once: blocks/arm.py's gravity parameter docstring claimed float but the actual runtime value is always a 3-vector passed straight to Robot.rne()/gravload() -- nothing caught the mismatch because there was no annotation to check against. Not urgent standalone, but worth doing opportunistically whenever a block class is touched, and worth a dedicated pass if blocks/ sees more maintenance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtKnown technical debt / deferred cleanup, not a live bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions