Skip to content

Commit 19f7f68

Browse files
charleslin4copybara-github
authored andcommitted
dm_control: Import of refs/pull/468/head
PiperOrigin-RevId: 631836013 Change-Id: I4544185aa0bbd501d9e81db64d253cd2da8382d4
1 parent db4a392 commit 19f7f68

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

dm_control/mjcf/schema.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ def _parse_attribute(attribute_xml):
160160
else:
161161
try:
162162
attribute_callable = _SCALAR_TYPE_MAP[attribute_type]
163-
except KeyError:
164-
raise ValueError('Invalid attribute type: {}'.format(attribute_type))
163+
except KeyError as exc:
164+
raise ValueError(
165+
'Invalid attribute type: {}'.format(attribute_type)
166+
) from exc
165167

166168
return AttributeSpec(
167169
name=name, type=attribute_callable, required=required,
@@ -215,7 +217,7 @@ def _attachment_frame_spec(is_world_attachment):
215217
body_spec = MUJOCO.children['worldbody'].children['body']
216218
# 'name' and 'childclass' attributes are excluded.
217219
for attrib_name in (
218-
'mocap', 'pos', 'quat', 'axisangle', 'xyaxes', 'zaxis', 'euler'):
220+
'mocap', 'pos', 'quat', 'axisangle', 'xyaxes', 'zaxis', 'euler', 'user'):
219221
frame_spec.attributes[attrib_name] = copy.deepcopy(
220222
body_spec.attributes[attrib_name])
221223

@@ -258,4 +260,3 @@ def override_schema(schema_xml_path):
258260
MUJOCO = parse_schema(schema_xml_path)
259261
FINDABLE_NAMESPACES = frozenset(
260262
collect_namespaces(MUJOCO).union(_ADDITIONAL_FINDABLE_NAMESPACES))
261-

dm_control/mjcf/schema.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,7 @@
13081308
<attribute name="zaxis" type="array" array_type="float" array_size="3"/>
13091309
<attribute name="euler" type="array" array_type="float" array_size="3"/>
13101310
<attribute name="gravcomp" type="float"/>
1311+
<attribute name="user" type="array" array_type="float"/>
13111312
</attributes>
13121313
<children>
13131314
<element name="plugin" repeated="true" namespace="body">

0 commit comments

Comments
 (0)