Skip to content

Commit 403e1a6

Browse files
authored
Merge pull request #41 from StoneT2000/bug-fixes
Fix some bugs in recently raised issues (capsule support, default torch device bug, and mujoco dependency) Closes #40 , closes #39 , and closes #35
2 parents 7d4e197 + cb2c95a commit 403e1a6

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.github/workflows/python-package.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
python -m pip install .[test]
3131
python -m pip install flake8 pytest
3232
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33+
pip install mujoco
3334
- name: Clone mujoco_menagerie repository into the tests/ folder
3435
run: |
3536
git clone https://github.com/google-deepmind/mujoco_menagerie

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ classifiers = [# Optional
4242
dependencies = [
4343
'absl-py',
4444
'lxml',
45-
"mujoco",
4645
'numpy<2', # pybullet requires numpy<2 for testing; for future versions this may be relaxed
4746
'pyyaml',
4847
'torch',

src/pytorch_kinematics/urdf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def _convert_transform(origin):
1414
if origin is None:
1515
return tf.Transform3d()
1616
else:
17-
rpy = torch.tensor(origin.rpy, dtype=torch.float32)
17+
rpy = torch.tensor(origin.rpy, dtype=torch.float32, device="cpu")
1818
return tf.Transform3d(rot=tf.quaternion_from_euler(rpy, "sxyz"), pos=origin.xyz)
1919

2020

src/pytorch_kinematics/urdf_parser_py/urdf.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ def __init__(self, radius=0.0, length=0.0):
101101
xmlr.Attribute('length', float)
102102
])
103103

104+
class Capsule(xmlr.Object):
105+
def __init__(self, radius=0.0, length=0.0):
106+
self.radius = radius
107+
self.length = length
108+
109+
xmlr.reflect(Capsule, tag='capsule', params=[
110+
xmlr.Attribute('radius', float),
111+
xmlr.Attribute('length', float)
112+
])
104113

105114
class Sphere(xmlr.Object):
106115
def __init__(self, radius=0.0):
@@ -130,7 +139,8 @@ def __init__(self):
130139
'box': Box,
131140
'cylinder': Cylinder,
132141
'sphere': Sphere,
133-
'mesh': Mesh
142+
'mesh': Mesh,
143+
'capsule': Capsule
134144
})
135145

136146
def from_xml(self, node, path):

0 commit comments

Comments
 (0)