From 88d04b2cfe4fc1d9c14f661802f4bd5626070076 Mon Sep 17 00:00:00 2001 From: BuildingAtom <84liadam@gmail.com> Date: Wed, 14 Feb 2024 22:57:12 -0500 Subject: [PATCH] add documentation --- .github/workflows/publish-doc.yml | 159 +++++++++++++++++++ .gitignore | 13 +- README.md | 94 ++++++++++- docs/Dockerfile | 11 ++ docs/Makefile | 24 +++ docs/build-docs.sh | 62 ++++++++ docs/generate_versions.sh | 45 ++++++ docs/make.bat | 35 ++++ docs/requirements.txt | 16 ++ docs/source/_static/css/custom.css | 25 +++ docs/source/_templates/autosummary/class.rst | 33 ++++ docs/source/conf.py | 100 ++++++++++++ docs/source/dynamics.rst | 13 ++ docs/source/index.rst | 25 +++ docs/source/kinematics.rst | 13 ++ docs/source/robots.rst | 19 +++ docs/source/trajectories.rst | 17 ++ docs/source/utils.rst | 13 ++ setup.py | 10 +- zonopyrobots/__init__.py | 10 +- zonopyrobots/properties.py | 22 +++ 21 files changed, 745 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish-doc.yml create mode 100644 docs/Dockerfile create mode 100644 docs/Makefile create mode 100755 docs/build-docs.sh create mode 100755 docs/generate_versions.sh create mode 100644 docs/make.bat create mode 100644 docs/requirements.txt create mode 100644 docs/source/_static/css/custom.css create mode 100644 docs/source/_templates/autosummary/class.rst create mode 100644 docs/source/conf.py create mode 100644 docs/source/dynamics.rst create mode 100644 docs/source/index.rst create mode 100644 docs/source/kinematics.rst create mode 100644 docs/source/robots.rst create mode 100644 docs/source/trajectories.rst create mode 100644 docs/source/utils.rst create mode 100644 zonopyrobots/properties.py diff --git a/.github/workflows/publish-doc.yml b/.github/workflows/publish-doc.yml new file mode 100644 index 00000000..47be1e60 --- /dev/null +++ b/.github/workflows/publish-doc.yml @@ -0,0 +1,159 @@ +# action.yml +name: 'Build Docs' + +on: + push: + branches: + - main + # - develop + release: + types: [published] + +jobs: + build_docs: + runs-on: ubuntu-latest + name: 'Build Sphinx documentation' + steps: + - name: 'Checkout the repo' + uses: actions/checkout@v4 + + - name: 'Run the buildscript' + # Workaround to keep tty working + # https://github.com/gfx/example-github-actions-with-tty + shell: 'script -q -e -c "bash {0}"' + run: ./docs/build-docs.sh ${{ fromJSON('{"tag":"html","branch":"html-dev"}')[github.ref_type] }} + + # Cache the build so we can deploy it + - name: 'cache built docs' + id: cache-build + uses: actions/cache/save@v4 + with: + path: ${{ github.workspace }}/docs/build/html + key: ${{ github.sha }}-docs + + # Cache version generation script if we are on a tag + - name: 'cache version generation script' + id: cache-version-script + uses: actions/cache/save@v4 + if: github.ref_type == 'tag' + with: + path: ${{ github.workspace }}/docs/generate_versions.sh + key: ${{ github.sha }}-docs + + deploy_main_docs: + permissions: + contents: write + pages: write + runs-on: ubuntu-latest + name: 'Publish latest docs to github pages' + needs: build_docs + if: github.ref_type == 'branch' && github.ref == 'refs/heads/main' + steps: + - name: 'Restore built docs cache' + uses: actions/cache/restore@v4 + id: restore-build + with: + path: ${{ github.workspace }}/docs/build/html + key: ${{ github.sha }}-docs + + - name: 'Deploy to gh-pages' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/build/html + publish_branch: gh-pages + destination_dir: dev + + deploy_version_docs: + permissions: + contents: write + pages: write + runs-on: ubuntu-latest + name: 'Publish versioned documentation to github pages' + needs: build_docs + if: github.ref_type == 'tag' + steps: + - name: 'Checkout the repo' + uses: actions/checkout@v4 + with: + ref: gh-pages + path: ./public + + - name: 'Get cached version script' + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/docs/generate_versions.sh + key: ${{ github.sha }}-docs + + - name: 'Get cached version build' + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/docs/build/html + key: ${{ github.sha }}-docs + + - name: 'Move file & directories & run version update script' + shell: 'script -q -e -c "bash {0}"' + run: > + mv ./docs/generate_versions.sh ./public/generate_versions.sh + && mv ./docs/build/html ./public/${{ github.ref_name }} + && rm -rf ./docs/ + && ./public/generate_versions.sh + && rm -f ./public/generate_versions.sh + + - name: 'Update latest symlink and kill git' + shell: 'script -q -e -c "bash {0}"' + run: cd ./public/ && ln -sfn ./${{ github.ref_name }} ./latest && ls -la + + # - name: 'Deploy to gh-pages' + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./public + # publish_branch: gh-pages + - name: 'Manually deploy to gh-pages' + run: | + git config --global user.email "${{github.actor}}@users.noreply.github.com" + git config --global user.name "${{github.actor}}" + cd ./public + git add . + git commit -m "deploy: ${{ github.sha }}" && git push origin gh-pages + + # deploy_develop_docs: + # permissions: + # contents: write + # pages: write + # runs-on: ubuntu-latest + # name: 'Publish development documentation to github pages' + # needs: build_docs + # if: endsWith(github.ref, '/develop') + # steps: + # - name: 'Restore built docs cache' + # uses: actions/cache/restore@v3 + # id: restore-build + # with: + # path: ${{ github.workspace }}/docs/build/html + # key: ${{ github.sha }}-docs + + # - name: 'Deploy to gh-pages' + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./docs/build/html + # publish_branch: gh-pages + # destination_dir: develop + + + # Probably not necesary with cache + # cleanup: + # runs-on: ubuntu-latest + # needs: ['build_docs', 'deploy_main_docs', 'deploy_develop_docs'] + # name: 'cache cleanup' + # if: always() && needs.build_docs.result == 'success' + # # Fun trick to say we need the above to all finish but only care about the first success + # steps: + # - uses: adapttive/cache-delete-action@v1.1 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # cache-key: ${{ github.sha }}-docs + +# TODO Versioned docs (look into the release event) diff --git a/.gitignore b/.gitignore index b4f2480d..9f607ca8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,15 @@ video_test/ .vscode/ trace.json pyprof.out -/render/ \ No newline at end of file +/render/ + +# Generated documentation +docs/source/generated/ +docs/_site +_site +docs/dev + +# MACOS +.ds_store +.DS_Store +.DS_STORE diff --git a/README.md b/README.md index 8eaf5e3a..6a0bbb99 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,96 @@ -# Zono-Py -Implementation of various set representations in Python +# zonopy-robots +Zonopy-robots is a Python package that extends the capabilities of the [zonopy](https://github.com/roahmlab/zonopy) library to facilitate robotics research. +Where zonopy introduces continuous set types such as zonotopes into Python, this package provides additional tools for kinematics, dynamics, and loading of URDF's. +For now, this package is particularly focused on the manipulation of arm robots. +It integrates with [urchin](https://github.com/fishbotics/urchin) for loading and working with URDF (Unified Robot Description Format) models of articulated robots. +## Features +- **Continuous Set Types**: Support for zonotopes and other continuous set representations for geometric operations. +- **Robot Kinematics and Dynamics**: Functions for calculating the kinematics and dynamics of robotic mechanisms. +- **URDF Loader**: Integration with `urchin` to load and manipulate URDF models of articulated arm robots. +## Requirements + +- zonopy: The base library for continuous set operations. +- urchin: Required for URDF model loading and manipulation. + +## Installation + +Either clone the latest version or a specific tag of this repo and inside of the repo path run: + +``` +pip install -e . +``` + +## Quick Start + +Here's a simple example to get started with `zonopy-robots`: + +```python +# Example: Load a robot model and build the forward kinematics of the robot joints following the ARMTD piecewise trajectory +import numpy as np +import zonopyrobots as zpr + +# There is an example URDF in this repo - kinova from kinova robotics' ros_kortex +import os +basedirname = os.path.dirname(zpr.__file__) +urdfpath = os.path.join(basedirname, 'robots/assets/robots/kinova_arm/gen3.urdf') + +# Load the robot with zonopy-robots. we can access the underlying urchin representation with +# `robot_model.urdf`, and we visualize it with urchin here. +robot_model = zpr.ZonoArmRobot.load(urdfpath, device="cpu") +robot_model.urdf.show() +# Note that this line sometimes stops the script for some reason + +# Prepare the JRS generator +traj_class = zpr.trajectory.PiecewiseArmTrajectory +jrs_gen = zpr.JrsGenerator(robot_model, traj_class=traj_class, param_range=np.pi/6, batched=True) + +# Initial configuration for the online JRS +q = np.zeros(robot_model.dof) +qd = q +qdd = q + +# Generate the JRS for that configuration +rotatotopes = jrs_gen.gen_JRS(q, qd, qdd, only_R=True) + +# Get the position PZ's and rotation MPZ's +fk = zpr.kinematics.forward_kinematics(rotatotopes, robot_model) +# The result is a dictionary of link names and their position and rotation PZ's. +``` + + + +## How to Cite + +If you use zonopy or zonopy-robots in your research, please cite one or more of the following papers: + +Safe Planning for Articulated Robots Using Reachability-based Obstacle Avoidance With Spheres. J. Michaux, A. Li, Q. Chen, C. Chen, B. Zhang, and R. Vasudevan. ArXiv, 2024. (https://arxiv.org/abs/2402.08857) +```bibtex +@article{michaux2024sparrows, + title={Safe Planning for Articulated Robots Using Reachability-based Obstacle Avoidance With Spheres}, + author={Jonathan Michaux and Adam Li and Qingyi Chen and Che Chen and Bohao Zhang and Ram Vasudevan}, + journal={ArXiv}, + year={2024}, + volume={abs/2402.08857}, + url={https://arxiv.org/abs/2402.08857}} +``` + +Reachability-based Trajectory Design with Neural Implicit Safety Constraints. J. B. Michaux, Y. S. Kwon, Q. Chen, and R. Vasudevan. Robotics: Science and Systems, 2023. (https://www.roboticsproceedings.org/rss19/p062.pdf) +```bibtex +@inproceedings{michaux2023rdf, + title={{Reachability-based Trajectory Design with Neural Implicit Safety Constraints}}, + author={Jonathan B Michaux AND Yong Seok Kwon AND Qingyi Chen AND Ram Vasudevan}, + booktitle={Proceedings of Robotics: Science and Systems}, + year={2023}, + address={Daegu, Republic of Korea}, + doi={10.15607/RSS.2023.XIX.062}} +``` diff --git a/docs/Dockerfile b/docs/Dockerfile new file mode 100644 index 00000000..a36cec4c --- /dev/null +++ b/docs/Dockerfile @@ -0,0 +1,11 @@ +FROM sphinxdoc/sphinx:7.1.2 + +ENV DEBIAN_FROTNEND="noninteractive" TZ="Etc/UTC" +RUN apt-get update \ + && apt-get install --no-install-recommends -y nodejs \ + && apt-get clean \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt /tmp/requirements.txt +RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..3fdcce42 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,24 @@ +# 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 = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +# Inspired by pytorch, but opposite +html-dev: + DEVELOP=1 make html + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/build-docs.sh b/docs/build-docs.sh new file mode 100755 index 00000000..f01c13c9 --- /dev/null +++ b/docs/build-docs.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# Some general conf +NAME="zonopy-sphinx" +IMAGE="roahmlab/zonopy-sphinx:latest" + +# Identify the script directory +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" + +## First build the docs container +tar -cf - -C "$SCRIPT_DIR/docs" Dockerfile requirements.txt | docker build -t $IMAGE - + +## Configuration for script vars +MOUNT_DIR="$SCRIPT_DIR" +STARTING_DIR="$SCRIPT_DIR" +USE_UNIQUE=true +ADD_UNAME=true +if $USE_UNIQUE;then + NAME+="-$(uuidgen)" +fi +if $ADD_UNAME;then + NAME="$(id -un)-$NAME" +fi + +## Setup uid requirements and workdir for temporaries +if [ -z "$HOME" ];then + HOME=/tmp +fi +if [ -z "$ID" ];then + ID=$(id -u) +fi +WORKDIR="$HOME/.docker" +mkdir -p "$WORKDIR" +DOCKER_HOME="$WORKDIR/$NAME" +mkdir -p "$DOCKER_HOME" + +## Build out the Docker options +DOCKER_OPTIONS="" +DOCKER_OPTIONS+="-it " +DOCKER_OPTIONS+="--rm " + +## USER ACCOUNT STUFF +DOCKER_OPTIONS+="--user $(id -u):$(id -g) " +DOCKER_OPTIONS+="$(id -G | sed -E "s/([[:blank:]]|^)([[:alnum:]_]+)/--group-add \2 /g") " +DOCKER_OPTIONS+="-e HOME=$HOME " + +## PROJECT +DOCKER_OPTIONS+="-v $MOUNT_DIR:/zonopy " +DOCKER_OPTIONS+="-v $DOCKER_HOME:$HOME " +DOCKER_OPTIONS+="--name $NAME " +DOCKER_OPTIONS+="--workdir=/zonopy/docs " +DOCKER_OPTIONS+="--entrypoint make " +DOCKER_OPTIONS+="--net=host " + +## CLEANUP +function cleanup { + rm -rf "$DOCKER_HOME" +} +trap cleanup EXIT + +## RUN +docker run $DOCKER_OPTIONS $IMAGE $1 diff --git a/docs/generate_versions.sh b/docs/generate_versions.sh new file mode 100755 index 00000000..408869d3 --- /dev/null +++ b/docs/generate_versions.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# This is a helper script to generate a JSON file listing all versions of zonopy's documentation +# to be used by github actions during a release to update the version dropdown in the documentation. + +# Directory to scan for versions +DIRECTORY="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +# Base URL for your site +BASE_URL="https://roahmlab.github.io/zonopy-robots/" + +# Initialize the JSON array with special versions manually if they exist +json_array="[" + +# Add special versions if they exist +if [ -d "$DIRECTORY/dev" ]; then + json_array+="{\"name\": \"devel\", \"version\": \"dev\", \"url\": \"${BASE_URL}dev/\"}," +fi + +# Collect all version directories excluding special ones +versions=() +for dir in $(find $DIRECTORY -maxdepth 1 -mindepth 1 -type d ! -name 'dev' ! -name '.git' -exec basename {} \; | sort -Vr); do + versions+=("$dir") +done + +# Determine the latest version for naming +latest_version=${versions[0]} + +# Loop through the versions array to build JSON objects +for version in "${versions[@]}"; do + if [ "$version" == "$latest_version" ]; then + # Mark the latest version with a special name + json_array+="{\"name\": \"latest ($version)\", \"version\": \"$version\", \"url\": \"${BASE_URL}${version}/\", \"preferred\": true}," + else + json_array+="{\"version\": \"$version\", \"url\": \"${BASE_URL}${version}/\"}," + fi +done + +# Remove the last comma to properly close the JSON array +json_array=${json_array%,} + +# Close the JSON array +json_array+="]" + +# Output the JSON array +echo $json_array | python3 -m json.tool > "$DIRECTORY/versions.json" diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..32bb2452 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..62d62507 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,16 @@ +sphinx==7.1.2 +# Theme +# furo==2024.1.29 +# pydata-sphinx-theme==0.15.2 +sphinx-book-theme==1.1.1 +# Extensions +sphinxcontrib.katex==0.9.9 +matplotlib==3.8.2 +sphinx-copybutton==0.5.2 +sphinx_design==0.5.0 +myst-parser==2.0.0 + +# External packages +# torch==2.0.0 +numpy==1.24 +# scipy==1.9.0 diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css new file mode 100644 index 00000000..5363ea81 --- /dev/null +++ b/docs/source/_static/css/custom.css @@ -0,0 +1,25 @@ +/* force a centered display math */ +span.katex-display { + width: 100%; +} + +/* fix the version dropdown button */ +.version-switcher__button { + margin-bottom: unset !important; +} + +/* fix dropdown menu position */ +.bd-header-article .dropdown-menu { + position: absolute; + inset: 0px auto auto 0px; + margin: 0px; + transform: translate3d(0px, 28px, 0px); +} + +/* fix dropdown menu hover */ +.bd-header-article .dropdown-source-buttons:hover + .btn + .dropdown-menu { + display: block; +} +.bd-header-article .btn { + display: block; +} diff --git a/docs/source/_templates/autosummary/class.rst b/docs/source/_templates/autosummary/class.rst new file mode 100644 index 00000000..e9bd0c7b --- /dev/null +++ b/docs/source/_templates/autosummary/class.rst @@ -0,0 +1,33 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :show-inheritance: + :inherited-members: + :undoc-members: + + {% block methods %} + .. automethod:: __init__ + + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 00000000..95bc8154 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,100 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", + "sphinxcontrib.katex", + "sphinx.ext.autosectionlabel", + "sphinx_copybutton", + "myst_parser", + "sphinx_design", +] +myst_enable_extensions = [ + "colon_fence", + "deflist", + "substitution", + "html_image", +] + +sd_fontawesome_latex = True + +katex_prerender = True + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +autodoc_mock_imports = ["torch", "scipy", "zonopy", "urchin", "trimesh", "networkx"] +autosummary_generate = True # Turn on sphinx.ext.autosummary + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_book_theme' +html_static_path = ['_static'] + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +import os, sys +sys.path.insert(0, os.path.abspath('../..')) +main_ns = {} +ver_path = os.path.join(os.path.abspath('../..'), ('zonopyrobots/properties.py')) +with open(ver_path) as ver_file: + exec(ver_file.read(), main_ns) + +DEVELOP = os.environ.get("DEVELOP", False) +if DEVELOP: + project = 'zonopy-robots (development)' + version = f"{main_ns['__version__']}-dev" + version_match = "dev" +else: + project = 'zonopy-robots' + version = main_ns['__version__'] + version_match = f"v{version}" + + +copyright = '2024, ROAHM Lab' +author = 'ROAHM Lab' +release = version +html_title = f"{project} v{version}" + +# Version switcher code +json_url = "https://roahmlab.github.io/zonopy/versions.json" + +html_theme_options = { + "path_to_docs": version_match, + "repository_url": "https://github.com/roahmlab/zonopy-robots", + "repository_branch": "gh-pages", + "use_repository_button": True, + "switcher": { + "json_url": json_url, + "version_match": version_match, + }, + "article_header_end": ["version-switcher", "article-header-buttons"], +} + +html_css_files = [ + "css/custom.css", +] + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "numpy": ("https://numpy.org/doc/stable", None), + "torch": ('https://pytorch.org/docs/master/', None), + "zonopy": ('https://roahmlab.github.io/zonopy/latest/', None), + "trimesh": ('https://trimesh.org/', None), +} + diff --git a/docs/source/dynamics.rst b/docs/source/dynamics.rst new file mode 100644 index 00000000..a18c988e --- /dev/null +++ b/docs/source/dynamics.rst @@ -0,0 +1,13 @@ +Dynamics Module +=============== +.. automodule:: zonopyrobots.dynamics + :members: + :show-inheritance: + :noindex: +.. currentmodule:: zonopyrobots.dynamics + +.. autosummary:: + :toctree: generated + :nosignatures: + + pzrnea diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 00000000..f06460b2 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,25 @@ +Zonopy Robots - Extensions to Zonopy for Robotics +================================================= + +Zonopy-robots extends the Zonopy library to include functionality for robotics. +This includes kinematics, dynamics, and trajectory planning for robotic systems. +At the current moment, focus is on serial-link manipulators, but there are plans to support other types of robots. +This project is still early in development, so much of the API is subject to change. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + robots + trajectories + kinematics + dynamics + utils + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/kinematics.rst b/docs/source/kinematics.rst new file mode 100644 index 00000000..63bb5047 --- /dev/null +++ b/docs/source/kinematics.rst @@ -0,0 +1,13 @@ +Kinematics Module +================= +.. automodule:: zonopyrobots.kinematics + :members: + :show-inheritance: + :noindex: +.. currentmodule:: zonopyrobots.kinematics + +.. autosummary:: + :toctree: generated + :nosignatures: + + forward_kinematics diff --git a/docs/source/robots.rst b/docs/source/robots.rst new file mode 100644 index 00000000..8a1a144a --- /dev/null +++ b/docs/source/robots.rst @@ -0,0 +1,19 @@ +Robots Module +============= +.. automodule:: zonopyrobots + :members: + :show-inheritance: +.. currentmodule:: zonopyrobots + +This module contains classes which specify robot parameters. + +Arm Robots +---------- +.. autosummary:: + :toctree: generated + :nosignatures: + :recursive: + + ZonoArmRobot + robots.armrobot.ZonoArmRobotLink + robots.armrobot.ZonoArmRobotJoint diff --git a/docs/source/trajectories.rst b/docs/source/trajectories.rst new file mode 100644 index 00000000..cddcb4ef --- /dev/null +++ b/docs/source/trajectories.rst @@ -0,0 +1,17 @@ +Common Trajectory Types +======================= +.. automodule:: zonopyrobots.trajectory + :members: + :show-inheritance: + :noindex: +.. currentmodule:: zonopyrobots.trajectory + +Kinematic Trajectory Parameterizations +-------------------------------------- +.. autosummary:: + :toctree: generated + :nosignatures: + :recursive: + + PiecewiseArmTrajectory + BernsteinArmTrajectory diff --git a/docs/source/utils.rst b/docs/source/utils.rst new file mode 100644 index 00000000..82584f63 --- /dev/null +++ b/docs/source/utils.rst @@ -0,0 +1,13 @@ +Utility Functions +================= +.. automodule:: zonopyrobots + :members: + :show-inheritance: + :noindex: +.. currentmodule:: zonopyrobots + +.. autosummary:: + :toctree: generated + :nosignatures: + + make_cfg_dict diff --git a/setup.py b/setup.py index 7ab2aa06..561e7bc6 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,14 @@ from setuptools import setup, find_packages +from distutils.util import convert_path + +main_ns = {} +ver_path = convert_path('zonopyrobots/properties.py') +with open(ver_path) as ver_file: + exec(ver_file.read(), main_ns) setup(name='zonopy-robots', - version='0.0.1', - install_requires=['zonopy','urchin','scipy'], # scipy for loadmat in jrs trig + version=main_ns['__version__'], + install_requires=['zonopy','urchin'], # scipy for loadmat in jrs trig packages=find_packages(), package_dir={"": "."}, package_data = {'zonopyrobots': ['robots/assets/**/*', 'joint_reachable_set/jrs_trig/**/*']} diff --git a/zonopyrobots/__init__.py b/zonopyrobots/__init__.py index 18b7a806..823627c2 100644 --- a/zonopyrobots/__init__.py +++ b/zonopyrobots/__init__.py @@ -11,13 +11,5 @@ import zonopy.internal as internal -__version__ = "0.0.1" -__logo__ = """ -*** ZONO-PY ROBOTS *** - _____ _____ - | |__ __// - |_____| |__//‾‾ - |_____| | - |_____| -""" + diff --git a/zonopyrobots/properties.py b/zonopyrobots/properties.py new file mode 100644 index 00000000..881be7cd --- /dev/null +++ b/zonopyrobots/properties.py @@ -0,0 +1,22 @@ +""" +A collection of internal properties for zonopyrobots. + +.. data:: __version__ + + Version of the zonopyrobots package. This value is automatically propagated from here to + the package's setup.py file and the Sphinx documentation. + +.. data:: __logo__ + + A fun little logo for zonopyrobots. + +""" +__version__ = "0.0.1" +__logo__ = """ +*** ZONO-PY ROBOTS *** + _____ _____ + | |__ __// + |_____| |__//‾‾ + |_____| | + |_____| +"""