Skip to content

Commit

Permalink
trying to create a new test
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Sep 17, 2023
1 parent 56aa3f4 commit 4370052
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 21 deletions.
67 changes: 46 additions & 21 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,51 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: [ "3.8", "3.9", "3.10" ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
test-shadow-hand:

runs-on: ubuntu-latest

steps:
- name: Clone mujoco_menagerie repository
run: |
git clone https://github.com/google-deepmind/mujoco_menagerie
working-directory: ${{ runner.workspace }}

- name: Copy test_shadow_hand.py to mujoco_menagerie/shadow_hand
run: |
cp test_shadow_hand.py mujoco_menagerie/shadow_hand
working-directory: ${{ runner.workspace }}

- name: Navigate to shadow_hand folder
run: |
cd mujoco_menagerie/shadow_hand
working-directory: ${{ runner.workspace }}/mujoco_menagerie

- name: Run test_shadow_hand.py
run: |
pytest test_shadow_hand.py
working-directory: ${{ runner.workspace }}/mujoco_menagerie/shadow_hand
15 changes: 15 additions & 0 deletions tests/test_shadow_hand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np

import pytorch_kinematics as pk


def test_shadow_hand():
with open('right_hand.xml') as f:
xml = f.read()
chain = pk.build_chain_from_mjcf(xml)
print(chain.get_frame_names())
print(chain.get_joint_parameter_names())
th = np.zeros(len(chain.get_joint_parameter_names()))
fk_dict = chain.forward_kinematics(th, end_only=True)
print(fk_dict['rh_lfproximal'])
print(fk_dict['rh_lfdistal'])

0 comments on commit 4370052

Please sign in to comment.