Skip to content

Commit

Permalink
dm_control: Import of refs/pull/487/head
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 657564508
Change-Id: I4126748fecfe2c5a81f2e2d9d186e4ec0c26e97b
  • Loading branch information
kevinzakka authored and copybara-github committed Jul 30, 2024
1 parent 1608629 commit 9c295be
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dm_control/locomotion/walkers/rescale.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
def rescale_subtree(body, position_factor, size_factor):
"""Recursively rescales an entire subtree of an MJCF model."""
for child in body.all_children():
if child.tag == 'sensor':
continue
if getattr(child, 'fromto', None) is not None:
new_pos = position_factor * 0.5 * (child.fromto[3:] + child.fromto[:3])
new_size = size_factor * 0.5 * (child.fromto[3:] - child.fromto[:3])
Expand Down
36 changes: 36 additions & 0 deletions dm_control/mjcf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2620,6 +2620,42 @@
</element>
</children>
</element>
<element name="fromto" repeated="true" namespace="sensor">
<attributes>
<attribute name="name" type="identifier"/>
<attribute name="noise" type="float"/>
<attribute name="user" type="array" array_type="float"/>
<attribute name="cutoff" type="float"/>
<attribute name="geom1" type="reference" required="true" reference_namespace="geom"/>
<attribute name="geom2" type="reference" required="true" reference_namespace="geom"/>
<attribute name="body1" type="reference" required="true" reference_namespace="body"/>
<attribute name="body2" type="reference" required="true" reference_namespace="body"/>
</attributes>
</element>
<element name="normal" repeated="true" namespace="sensor">
<attributes>
<attribute name="name" type="identifier"/>
<attribute name="noise" type="float"/>
<attribute name="user" type="array" array_type="float"/>
<attribute name="cutoff" type="float"/>
<attribute name="geom1" type="reference" required="true" reference_namespace="geom"/>
<attribute name="geom2" type="reference" required="true" reference_namespace="geom"/>
<attribute name="body1" type="reference" required="true" reference_namespace="body"/>
<attribute name="body2" type="reference" required="true" reference_namespace="body"/>
</attributes>
</element>
<element name="distance" repeated="true" namespace="sensor">
<attributes>
<attribute name="name" type="identifier"/>
<attribute name="noise" type="float"/>
<attribute name="user" type="array" array_type="float"/>
<attribute name="cutoff" type="float"/>
<attribute name="geom1" type="reference" required="true" reference_namespace="geom"/>
<attribute name="geom2" type="reference" required="true" reference_namespace="geom"/>
<attribute name="body1" type="reference" required="true" reference_namespace="body"/>
<attribute name="body2" type="reference" required="true" reference_namespace="body"/>
</attributes>
</element>
</children>
</element>
<element name="keyframe">
Expand Down

0 comments on commit 9c295be

Please sign in to comment.