From a9bf12629bc3544835fc297f97ce63d4630ed6fa Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Wed, 4 Oct 2023 16:50:34 +0200 Subject: [PATCH] Fix submodules import errors for autodoc --- docs/Makefile | 1 + docs/conf.py | 11 +++++--- docs/guide/install.rst | 2 +- docs/index.rst | 5 ++-- docs/make.bat | 1 + docs/modules/high_level.rst | 10 +++++++- docs/modules/math.rst | 36 ++++++++++++++++++++++++-- docs/modules/parsers.rst | 16 ++++++++++-- docs/modules/physics.rst | 50 +++++++++++++++++++++++++++++++++++-- docs/modules/simulation.rst | 10 ++++---- docs/modules/sixd.rst | 9 ------- docs/modules/utils.rst | 4 +-- docs/requirements.txt | 2 +- 13 files changed, 125 insertions(+), 32 deletions(-) delete mode 100644 docs/modules/sixd.rst diff --git a/docs/Makefile b/docs/Makefile index d4bb2cbb9..6744ed5d6 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -7,6 +7,7 @@ SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build +SPHINXPROJ = JAXsim # Put it first so that "make" without argument is like "make help". help: diff --git a/docs/conf.py b/docs/conf.py index 7182bd72e..c7117f489 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,13 +1,16 @@ # Configuration file for the Sphinx documentation builder. import pathlib import sys +import os # -- Version information -sys.path.insert(0, pathlib.Path(__file__).parents[2].absolute()) -version_file = ( - pathlib.Path(__file__).parents[1].absolute() / "src" / "jaxsim" / "version.txt" -) +sys.path.insert(0, os.path.abspath(".")) +sys.path.insert(0, os.path.abspath("../")) + +module_path = pathlib.Path(__file__).parent.parent.absolute() / "src" +sys.path.insert(0, str(module_path)) +version_file = str(module_path / "jaxsim" / "version.txt") with open(version_file) as file_handler: __version__ = file_handler.read().strip() diff --git a/docs/guide/install.rst b/docs/guide/install.rst index b39c51904..74b44c05e 100644 --- a/docs/guide/install.rst +++ b/docs/guide/install.rst @@ -9,7 +9,7 @@ Prerequisites JAXsim requires Python 3.10 or later. Basic Installation ------------- +------------------ You can install the project with `pypa/pip`, preferably in a `virtual environment`_: diff --git a/docs/index.rst b/docs/index.rst index 4fcb3e53f..224124454 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,7 +12,7 @@ A scalable physics engine implemented with JAX. With JIT batteries 🔋 Features -------- -- Physics engine in reduced coordinates implemented with `JAX`_ in Python. +- Physics engine in reduced coordinates implemented with `JAX `_ in Python. - Supported JIT compilation of Python code for increased performance. - Transparent support to execute the simulation on CPUs, GPUs, and TPUs. - Possibility to run parallel multi-body simulations on hardware accelerators for significantly increased throughput. @@ -38,7 +38,7 @@ Planned features: guide/install .. toctree:: - :maxdepth: 3 + :maxdepth: 2 :caption: JAXsim API Reference modules/high_level @@ -46,7 +46,6 @@ Planned features: modules/physics modules/parsers modules/simulation - modules/sixd modules/utils diff --git a/docs/make.bat b/docs/make.bat index 2119f5109..f9fe453e4 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -9,6 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build +set SPHINXPROJ=JaxSim if "%1" == "" goto help diff --git a/docs/modules/high_level.rst b/docs/modules/high_level.rst index 1c512d2a1..1afb6ead5 100644 --- a/docs/modules/high_level.rst +++ b/docs/modules/high_level.rst @@ -4,6 +4,14 @@ High Level ========== -.. automodule:: src.jaxsim.high_level +.. autoclass:: jaxsim.high_level.model.Model + :members: + :inherited-members: + +.. autoclass:: jaxsim.high_level.joint.Joint + :members: + :inherited-members: + +.. autoclass:: jaxsim.high_level.link.Link :members: :inherited-members: \ No newline at end of file diff --git a/docs/modules/math.rst b/docs/modules/math.rst index 5097f3e5d..1c6964c2c 100644 --- a/docs/modules/math.rst +++ b/docs/modules/math.rst @@ -4,6 +4,38 @@ Math ==== -.. automodule:: src.jaxsim.math +.. automodule:: jaxsim.math.adjoint :members: - :inherited-members: \ No newline at end of file + :inherited-members: + +.. automodule:: jaxsim.math.conv + :members: + :inherited-members: + +.. automodule:: jaxsim.math.cross + :members: + :inherited-members: + +.. automodule:: jaxsim.math.inertia + :members: + :inherited-members: + +.. automodule:: jaxsim.math.joint + :members: + :inherited-members: + +.. automodule:: jaxsim.math.plucker + :members: + :inherited-members: + +.. automodule:: jaxsim.math.quaternion + :members: + :inherited-members: + +.. automodule:: jaxsim.math.rotation + :members: + :inherited-members: + +.. automodule:: jaxsim.math.skew + :members: + :inherited-members: diff --git a/docs/modules/parsers.rst b/docs/modules/parsers.rst index aad6824e2..17dca62df 100644 --- a/docs/modules/parsers.rst +++ b/docs/modules/parsers.rst @@ -4,6 +4,18 @@ Parsers ======= -.. automodule:: src.jaxsim.parsers +.. automodule:: jaxsim.parsers.descriptions.collision :members: - :inherited-members: \ No newline at end of file + :inherited-members: + +.. automodule:: jaxsim.parsers.descriptions.joint + :members: + :inherited-members: + +.. automodule:: jaxsim.parsers.descriptions.link + :members: + :inherited-members: + +.. automodule:: jaxsim.parsers.descriptions.model + :members: + :inherited-members: diff --git a/docs/modules/physics.rst b/docs/modules/physics.rst index dab6999da..d91e80fbb 100644 --- a/docs/modules/physics.rst +++ b/docs/modules/physics.rst @@ -4,6 +4,52 @@ Physics ======= -.. automodule:: src.jaxsim.physics +.. _algos: + +Algos +----- + +.. automodule:: jaxsim.physics.algos + +.. autofunction:: jaxsim.physics.algos.aba.aba + +.. autofunction:: jaxsim.physics.algos.crba.crba + + +.. autofunction:: jaxsim.physics.algos.forward_kinematics.forward_kinematics + +.. autofunction:: jaxsim.physics.algos.jacobian.jacobian + +.. autofunction:: jaxsim.physics.algos.rnea.rnea + +.. automodule:: jaxsim.physics.algos.soft_contacts + :members: + :inherited-members: + +.. automodule:: jaxsim.physics.algos.terrain + :members: + :inherited-members: + +.. automodule:: jaxsim.physics.algos.utils :members: - :inherited-members: \ No newline at end of file + :inherited-members: + +Model +----- + +.. automodule:: jaxsim.physics.model + :members: + :inherited-members: + +.. automodule:: jaxsim.physics.model.ground_contact + :members: + :inherited-members: + +.. automodule:: jaxsim.physics.model.physics_model_state + :members: + :inherited-members: + +.. automodule:: jaxsim.physics.model.physics_model + :members: + :inherited-members: + diff --git a/docs/modules/simulation.rst b/docs/modules/simulation.rst index 819c34c9a..7f2bbf9ae 100644 --- a/docs/modules/simulation.rst +++ b/docs/modules/simulation.rst @@ -4,12 +4,12 @@ Simulation ========== -.. automodule:: src.jaxsim.simulation +.. automodule:: jaxsim.simulation -.. autoclass:: src.jaxsim.simulation.SimulatorData +.. autoclass:: jaxsim.simulation.simulator.SimulatorData :members: :inherited-members: -.. autoclass:: src.jaxsim.simulation.JaxSim -:members: -:inherited-members: +.. autoclass:: jaxsim.simulation.simulator.JaxSim + :members: + :inherited-members: diff --git a/docs/modules/sixd.rst b/docs/modules/sixd.rst deleted file mode 100644 index 8c125ae3d..000000000 --- a/docs/modules/sixd.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _sixd: - - -SixD -========== - -.. automodule:: src.jaxsim.sixd - :members: - :inherited-members: \ No newline at end of file diff --git a/docs/modules/utils.rst b/docs/modules/utils.rst index 1a105f0d4..269f5f53d 100644 --- a/docs/modules/utils.rst +++ b/docs/modules/utils.rst @@ -2,8 +2,8 @@ Utils -========== +===== -.. automodule:: src.jaxsim.utils +.. automodule:: jaxsim.utils :members: :inherited-members: \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 7db1f079a..ec32e09ae 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ sphinx==7.1.2 sphinx-rtd-theme==1.3.0rc1 sphinx_autodoc_typehints -sphinx_copybutton \ No newline at end of file +sphinx_copybutton