Skip to content

Commit 4370052

Browse files
author
Peter
committed
trying to create a new test
1 parent 56aa3f4 commit 4370052

File tree

2 files changed

+61
-21
lines changed

2 files changed

+61
-21
lines changed

.github/workflows/python-package.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,51 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10"]
19+
python-version: [ "3.8", "3.9", "3.10" ]
2020

2121
steps:
22-
- uses: actions/checkout@v3
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v3
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install .[test]
31-
python -m pip install flake8 pytest
32-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33-
- name: Lint with flake8
34-
run: |
35-
# stop the build if there are Python syntax errors or undefined names
36-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39-
- name: Test with pytest
40-
run: |
41-
pytest
22+
- uses: actions/checkout@v3
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install .[test]
31+
python -m pip install flake8 pytest
32+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33+
- name: Lint with flake8
34+
run: |
35+
# stop the build if there are Python syntax errors or undefined names
36+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
- name: Test with pytest
40+
run: |
41+
pytest
42+
43+
test-shadow-hand:
44+
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Clone mujoco_menagerie repository
49+
run: |
50+
git clone https://github.com/google-deepmind/mujoco_menagerie
51+
working-directory: ${{ runner.workspace }}
52+
53+
- name: Copy test_shadow_hand.py to mujoco_menagerie/shadow_hand
54+
run: |
55+
cp test_shadow_hand.py mujoco_menagerie/shadow_hand
56+
working-directory: ${{ runner.workspace }}
57+
58+
- name: Navigate to shadow_hand folder
59+
run: |
60+
cd mujoco_menagerie/shadow_hand
61+
working-directory: ${{ runner.workspace }}/mujoco_menagerie
62+
63+
- name: Run test_shadow_hand.py
64+
run: |
65+
pytest test_shadow_hand.py
66+
working-directory: ${{ runner.workspace }}/mujoco_menagerie/shadow_hand

tests/test_shadow_hand.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import numpy as np
2+
3+
import pytorch_kinematics as pk
4+
5+
6+
def test_shadow_hand():
7+
with open('right_hand.xml') as f:
8+
xml = f.read()
9+
chain = pk.build_chain_from_mjcf(xml)
10+
print(chain.get_frame_names())
11+
print(chain.get_joint_parameter_names())
12+
th = np.zeros(len(chain.get_joint_parameter_names()))
13+
fk_dict = chain.forward_kinematics(th, end_only=True)
14+
print(fk_dict['rh_lfproximal'])
15+
print(fk_dict['rh_lfdistal'])

0 commit comments

Comments
 (0)