Skip to content

Commit

Permalink
Allow mjcf to load obj files.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 435273158
Change-Id: If40f4444a3939c11247094f2df93b5b0fd936678
  • Loading branch information
yuvaltassa authored and copybara-github committed Mar 17, 2022
1 parent af2cf92 commit 469a8bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dm_control/mjcf/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'Reference should be an MJCF Element whose type is {valid_type!r}: '
'got {actual_type!r}.')

_MESH_EXTENSIONS = ('.stl', '.msh')
_MESH_EXTENSIONS = ('.stl', '.msh', '.obj')

# MuJoCo's compiler enforces this.
_INVALID_MESH_EXTENSION = (
Expand Down Expand Up @@ -142,7 +142,8 @@ def _assign(self, value):
if float_value != int_value:
raise ValueError
except ValueError:
raise ValueError('Expect an integer value: got {}'.format(value))
raise ValueError(
'Expect an integer value: got {}'.format(value)) from None
self._value = int_value


Expand All @@ -153,7 +154,7 @@ def _assign(self, value):
try:
float_value = float(value)
except ValueError:
raise ValueError('Expect a float value: got {}'.format(value))
raise ValueError('Expect a float value: got {}'.format(value)) from None
self._value = float_value


Expand All @@ -175,7 +176,7 @@ def _assign(self, value):
self._value = self._valid_values[str(value).lower()]
except KeyError:
raise ValueError('Expect keyword to be one of {} but got: {}'.format(
list(self._valid_values.values()), value))
list(self._valid_values.values()), value)) from None

@property
def valid_values(self):
Expand Down

0 comments on commit 469a8bd

Please sign in to comment.