From 4079ddc4e522f26f0902cefdf7bdbc370b533c2a Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 28 Feb 2023 18:13:38 +0100 Subject: [PATCH 1/8] Updated README.md --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f2008edd..2316fcc2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,44 @@ -# StepWise -A Python-based Trajectory Optimization Framework +# stepwise +### A Python-based Trajectory Optimization Framework + + +StepWise is an open-source framework for generating whole-body trajectories for legged robots, with a focus on direct transcription of optimal control problems solved with multiple-shooting methods. The framework takes as input the robot model and generates optimized trajectories that include both kinematic and dynamic quantities. + +## Features + +- [ ] Direct transcription of optimal control problems with multiple-shooting methods +- [ ] Support for floating-base robots, including humanoids and quadrupeds +- [ ] Integration with CasADi library for efficient numerical optimization +- [ ] Generation of optimized trajectories that include both kinematic and dynamic quantities +- [ ] Extensive documentation and examples to help you get started + +## Installation + +TODO + +## Citing this work + +If you find the work useful, please consider citing: + +```bib +@ARTICLE{dafarra2022dcc, + author={Dafarra, Stefano and Romualdi, Giulio and Pucci, Daniele}, + journal={IEEE Transactions on Robotics}, + title={Dynamic Complementarity Conditions and Whole-Body Trajectory Optimization for Humanoid Robot Locomotion}, + year={2022}, + volume={38}, + number={6}, + pages={3414-3433}, + doi={10.1109/TRO.2022.3183785}} +``` + + + +## Maintainer + +This repository is maintained by: + +| | | +| :----------------------------------------------------------: | :--------------------------------------------------: | +| [](https://github.com/S-Dafarra) | [@S-Dafarra](https://github.com/S-Dafarra) | + From fab37f0aef4d67002258633eea2ddfde8027d962 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 28 Feb 2023 18:30:13 +0100 Subject: [PATCH 2/8] Added initial skeleton. Inspired from https://github.com/ami-iit/rod --- .github/workflows/ci_cd.yml | 110 ++++++++++++++++++++++++++++++++++++ .github/workflows/style.yml | 53 +++++++++++++++++ .gitignore | 3 + pyproject.toml | 20 +++++++ setup.cfg | 73 ++++++++++++++++++++++++ setup.py | 3 + src/stepwise/__init__.py | 0 7 files changed, 262 insertions(+) create mode 100644 .github/workflows/ci_cd.yml create mode 100644 .github/workflows/style.yml create mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 src/stepwise/__init__.py diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 00000000..358818c0 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,110 @@ +name: Python CI/CD + +on: + push: + pull_request: + release: + types: + - published + +jobs: + + package: + name: Package the project + runs-on: ubuntu-22.04 + + steps: + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install Python tools + run: pip install build twine + + - name: Create distributions + run: python -m build -o dist/ + + - name: Inspect dist folder + run: ls -lah dist/ + + - name: Check wheel's abi and platform tags + run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0 + + - name: Run twine check + run: twine check dist/* + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + path: dist/* + name: dist + + test: + name: 'Python${{ matrix.python }}@${{ matrix.os }}' + needs: package + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + - macos-latest + - windows-latest + python: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + + steps: + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Download Python packages + uses: actions/download-artifact@v3 + with: + path: dist + name: dist + + - name: Install wheel + shell: bash + run: pip install dist/*.whl + + - name: Import the package + run: python -c "import stepwise" + + publish: + name: Publish to PyPI + needs: test + runs-on: ubuntu-22.04 + + steps: + + - name: Download Python packages + uses: actions/download-artifact@v3 + with: + path: dist + name: dist + + - name: Inspect dist folder + run: ls -lah dist/ + + - name: Publish to PyPI + if: | + github.repository == 'ami-iit/stepwise' && + ((github.event_name == 'push' && github.ref == 'refs/heads/main') || + (github.event_name == 'release')) + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + skip_existing: true diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 00000000..730cf330 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,53 @@ +name: Code Style + +on: + push: + branches: [ "**" ] + tags-ignore: [ "**" ] + pull_request: + workflow_dispatch: + +jobs: + + black: + + name: black + runs-on: ubuntu-latest + + steps: + + - name: "🔀 Checkout repository" + uses: actions/checkout@v2 + + - name: '🐍 Initialize Python' + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: "📝 Black Code Formatter" + uses: psf/black@stable + with: + options: --check --diff --color + + isort: + + name: isort + runs-on: ubuntu-latest + + steps: + + - name: "🔀 Checkout repository" + uses: actions/checkout@v2 + + - name: '🐍 Initialize Python' + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + # Workaround for https://github.com/isort/isort-action/issues/70 + - run: pip install colorama + + - name: "📝 isort" + uses: isort/isort-action@master + with: + configuration: --check --diff --color diff --git a/.gitignore b/.gitignore index b6e47617..ea7da93b 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ dmypy.json # Pyre type checker .pyre/ + +# Pycharm files +.idea/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..5dd01a33 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[build-system] +requires = [ + "wheel", + "setuptools>=45", + "setuptools_scm[toml]>=6.2", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +local_scheme = "dirty-tag" + +[tool.black] +line-length = 88 + +[tool.isort] +profile = "black" +multi_line_output = 3 + +[tool.cibuildwheel] +build-frontend = "build" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..54cd63be --- /dev/null +++ b/setup.cfg @@ -0,0 +1,73 @@ +[metadata] +name = stepwise +description = A Python-based Trajectory Optimization Framework +long_description = file: README.md +long_description_content_type = text/markdown +author = Stefano Dafarra +author_email = stefano.dafarra@iit.it +license = BSD-2 +license_files = LICENSE +platforms = any +url = https://github.com/ami-iit/stepwise + +project_urls = + Changelog = https://github.com/ami-iit/stepwise/releases + Source = https://github.com/ami-iit/stepwise + Tracker = https://github.com/ami-iit/stepwise/issues + +keywords = + trajectory + optimization + robots + humanoids + quadrupeds + kinematics + dynamics + contacts + +classifiers = + Development Status :: 5 - Production/Stable + Framework :: Robot Framework + Intended Audience :: Science/Research + Intended Audience :: Developers + Intended Audience :: Education + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Operating System :: POSIX :: Linux + Operating System :: MacOS + Operating System :: Microsoft :: Windows + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + Topic :: Games/Entertainment :: Simulation + +[options] +zip_safe = False +packages = find: +package_dir = + =src +python_requires = >=3.8 +install_requires = + coloredlogs + mashumaro + numpy + packaging + scipy + xmltodict + +[options.extras_require] +style = + black + isort +pptree = + pptree +all = + %(style)s + %(pptree)s + +[options.packages.find] +where = src diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..b908cbe5 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +import setuptools + +setuptools.setup() diff --git a/src/stepwise/__init__.py b/src/stepwise/__init__.py new file mode 100644 index 00000000..e69de29b From 7cff695da46883033771f59b12996a93269852d7 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 6 Mar 2023 11:24:23 +0100 Subject: [PATCH 3/8] Changed name and addressed reviews. --- .github/workflows/ci_cd.yml | 65 +------------------------------------ README.md | 6 ++-- pyproject.toml | 3 -- setup.cfg | 23 ++++--------- 4 files changed, 11 insertions(+), 86 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 358818c0..9ec647a7 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -9,42 +9,6 @@ on: jobs: - package: - name: Package the project - runs-on: ubuntu-22.04 - - steps: - - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install Python tools - run: pip install build twine - - - name: Create distributions - run: python -m build -o dist/ - - - name: Inspect dist folder - run: ls -lah dist/ - - - name: Check wheel's abi and platform tags - run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0 - - - name: Run twine check - run: twine check dist/* - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - path: dist/* - name: dist - test: name: 'Python${{ matrix.python }}@${{ matrix.os }}' needs: package @@ -80,31 +44,4 @@ jobs: run: pip install dist/*.whl - name: Import the package - run: python -c "import stepwise" - - publish: - name: Publish to PyPI - needs: test - runs-on: ubuntu-22.04 - - steps: - - - name: Download Python packages - uses: actions/download-artifact@v3 - with: - path: dist - name: dist - - - name: Inspect dist folder - run: ls -lah dist/ - - - name: Publish to PyPI - if: | - github.repository == 'ami-iit/stepwise' && - ((github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'release')) - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - skip_existing: true + run: python -c "import hippopt" diff --git a/README.md b/README.md index 2316fcc2..5673f586 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# stepwise -### A Python-based Trajectory Optimization Framework +# hippopt +### HIghly Pythonized Planning and OPTimization framework -StepWise is an open-source framework for generating whole-body trajectories for legged robots, with a focus on direct transcription of optimal control problems solved with multiple-shooting methods. The framework takes as input the robot model and generates optimized trajectories that include both kinematic and dynamic quantities. +hippopt is an open-source framework for generating whole-body trajectories for legged robots, with a focus on direct transcription of optimal control problems solved with multiple-shooting methods. The framework takes as input the robot model and generates optimized trajectories that include both kinematic and dynamic quantities. ## Features diff --git a/pyproject.toml b/pyproject.toml index 5dd01a33..884d3a71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,3 @@ line-length = 88 [tool.isort] profile = "black" multi_line_output = 3 - -[tool.cibuildwheel] -build-frontend = "build" diff --git a/setup.cfg b/setup.cfg index 54cd63be..41a422a3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] -name = stepwise -description = A Python-based Trajectory Optimization Framework +name = hippopt +description = HIghly Pythonized Planning and OPTimization framework long_description = file: README.md long_description_content_type = text/markdown author = Stefano Dafarra @@ -8,12 +8,12 @@ author_email = stefano.dafarra@iit.it license = BSD-2 license_files = LICENSE platforms = any -url = https://github.com/ami-iit/stepwise +url = https://github.com/ami-iit/hippopt project_urls = - Changelog = https://github.com/ami-iit/stepwise/releases - Source = https://github.com/ami-iit/stepwise - Tracker = https://github.com/ami-iit/stepwise/issues + Changelog = https://github.com/ami-iit/hippopt/releases + Source = https://github.com/ami-iit/hippopt + Tracker = https://github.com/ami-iit/hippopt/issues keywords = trajectory @@ -37,8 +37,6 @@ classifiers = Operating System :: MacOS Operating System :: Microsoft :: Windows Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3 :: Only @@ -50,14 +48,8 @@ zip_safe = False packages = find: package_dir = =src -python_requires = >=3.8 +python_requires = >=3.10 install_requires = - coloredlogs - mashumaro - numpy - packaging - scipy - xmltodict [options.extras_require] style = @@ -67,7 +59,6 @@ pptree = pptree all = %(style)s - %(pptree)s [options.packages.find] where = src From 170169dbcae552aabc0aa3bc58aa014cbbf05d76 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 6 Mar 2023 12:19:32 +0100 Subject: [PATCH 4/8] Restore package action in CI/CD. --- .github/workflows/ci_cd.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 9ec647a7..82a9f403 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -9,6 +9,42 @@ on: jobs: + package: + name: Package the project + runs-on: ubuntu-22.04 + + steps: + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install Python tools + run: pip install build twine + + - name: Create distributions + run: python -m build -o dist/ + + - name: Inspect dist folder + run: ls -lah dist/ + + - name: Check wheel's abi and platform tags + run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0 + + - name: Run twine check + run: twine check dist/* + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + path: dist/* + name: dist + test: name: 'Python${{ matrix.python }}@${{ matrix.os }}' needs: package From 1ef36821069126731a32b9809283bcf626c42369 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 6 Mar 2023 12:22:56 +0100 Subject: [PATCH 5/8] Removed unnecessary python versions in CI/CD file. --- .github/workflows/ci_cd.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 82a9f403..a90fcd2c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -57,8 +57,6 @@ jobs: - macos-latest - windows-latest python: - - "3.8" - - "3.9" - "3.10" - "3.11" From 700c08cf79c4f24d14445e70a6435d2c1360d86f Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 6 Mar 2023 13:20:38 +0100 Subject: [PATCH 6/8] Renamed forgotten dir name. --- src/{stepwise => hippopt}/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{stepwise => hippopt}/__init__.py (100%) diff --git a/src/stepwise/__init__.py b/src/hippopt/__init__.py similarity index 100% rename from src/stepwise/__init__.py rename to src/hippopt/__init__.py From ad5558983149b62b5c6f103b52f6301a13e71ec6 Mon Sep 17 00:00:00 2001 From: Stefano Dafarra Date: Mon, 6 Mar 2023 13:28:06 +0100 Subject: [PATCH 7/8] Update setup.cfg after review Co-authored-by: Diego Ferigo --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 41a422a3..1e34fae3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,8 +55,6 @@ install_requires = style = black isort -pptree = - pptree all = %(style)s From ebca8892773b3c1a235e80c3960ad1fa98225fc2 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 6 Mar 2023 14:18:54 +0100 Subject: [PATCH 8/8] Added CITATIONS.bib file. --- CITATIONS.bib | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 CITATIONS.bib diff --git a/CITATIONS.bib b/CITATIONS.bib new file mode 100644 index 00000000..113b9f70 --- /dev/null +++ b/CITATIONS.bib @@ -0,0 +1,9 @@ +@ARTICLE{dafarra2022dcc, + author={Dafarra, Stefano and Romualdi, Giulio and Pucci, Daniele}, + journal={IEEE Transactions on Robotics}, + title={Dynamic Complementarity Conditions and Whole-Body Trajectory Optimization for Humanoid Robot Locomotion}, + year={2022}, + volume={38}, + number={6}, + pages={3414-3433}, + doi={10.1109/TRO.2022.3183785}}