Skip to content

Commit

Permalink
Update documentation index and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Jan 19, 2024
1 parent ba1634b commit 815141f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 24 deletions.
5 changes: 0 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
Expand Down
22 changes: 14 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ Features
- Default validation of JAX pytrees to prevent JIT re-compilations.
- Preliminary support for automatic differentiation of RBDAs.

Installation
------------

You can install the project with `pypa/pip <https://github.com/pypa/pip/>`_, preferably in a `virtual environment <https://docs.python.org/3/tutorial/venv.html>`_:
.. toctree::
:maxdepth: 2
:caption: User Guide

.. code-block:: bash
guide/install

pip install jaxsim
.. toctree::
:maxdepth: 2
:caption: JAXsim API

Check `setup.cfg` for the complete list of optional dependencies. Install all of them with ``jaxsim[all]``.
modules/typing
modules/high_level
modules/math
modules/physics
modules/parsers
modules/simulation
modules/utils

**Note:** For GPU support, follow the official `installation instruction of JAX <https://github.com/google/jax/#installation>`_.

Examples
--------
Expand Down
2 changes: 0 additions & 2 deletions docs/jaxsim_conda_env.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: jaxsim
channels:
- conda-forge
# - nvidia
dependencies:
- coloredlogs
- python=3.11
Expand All @@ -10,7 +9,6 @@ dependencies:
- jaxlib
- jaxlie
- jinja2
# - cuda-nvcc
- rod
- coloredlogs
- sphinx
Expand Down
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pushd %~dp0

REM Command file for Sphinx documentation
REM

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
Expand Down
35 changes: 27 additions & 8 deletions src/jaxsim/parsers/kinematic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,34 @@ def breadth_first_search(
yield child

def __iter__(self) -> Iterable[descriptions.LinkDescription]:
return self.breadth_first_search(root=self.root)
yield from KinematicGraph.breadth_first_search(root=self.root)

def __getitem__(self, name: str) -> descriptions.LinkDescription:
if name not in self.links_dict:
raise KeyError(f"Link '{name}' not found in the kinematic graph.")
return self.links_dict[name]
def __reversed__(self) -> Iterable[descriptions.LinkDescription]:
yield from reversed(list(iter(self)))

def __len__(self) -> int:
return len(self.links_dict)
return len(list(iter(self)))

def __contains__(self, name: str) -> bool:
return name in self.links_dict or name in self.frames_dict
def __contains__(self, item: Union[str, descriptions.LinkDescription]) -> bool:
if isinstance(item, str):
return item in self.link_names()

if isinstance(item, descriptions.LinkDescription):
return item in set(iter(self))

raise TypeError(type(item).__name__)

def __getitem__(self, key: Union[int, str]) -> descriptions.LinkDescription:
if isinstance(key, str):
if key not in self.link_names():
raise KeyError(key)

return self.links_dict[key]

if isinstance(key, int):
if key > len(self):
raise KeyError(key)

return list(iter(self))[key]

raise TypeError(type(key).__name__)

0 comments on commit 815141f

Please sign in to comment.