Skip to content

Commit 1b37d0a

Browse files
yuvaltassacopybara-github
authored andcommitted
Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
PiperOrigin-RevId: 884607673 Change-Id: Id336e65b65a899d676fe4444d85bf31a9e8b5a6f
1 parent 88415f2 commit 1b37d0a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

dm_control/mjcf/attribute.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ def to_xml_string(self, prefix_root=None,
231231
return util.to_native_string(out.getvalue())[:-1] # Strip trailing space.
232232

233233
def _check_shape(self, array):
234+
if array.ndim == 0:
235+
array = array.reshape(1)
234236
actual_length = array.shape[0]
235237
if len(array.shape) > 1:
236238
raise ValueError('Expect one-dimensional array: got {}'.format(array))

dm_control/mjcf/schema.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@
284284
<attribute name="solimplimit" type="array" array_type="float" array_size="5"/>
285285
<attribute name="solreffriction" type="array" array_type="float" array_size="2"/>
286286
<attribute name="solimpfriction" type="array" array_type="float" array_size="5"/>
287-
<attribute name="stiffness" type="float"/>
287+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
288288
<attribute name="range" type="array" array_type="float" array_size="2"/>
289289
<attribute name="actuatorfrcrange" type="array" array_type="float" array_size="2"/>
290290
<attribute name="margin" type="float"/>
291291
<attribute name="ref" type="float"/>
292292
<attribute name="springref" type="float"/>
293293
<attribute name="armature" type="float"/>
294-
<attribute name="damping" type="float"/>
294+
<attribute name="damping" type="array" array_type="float" array_size="3"/>
295295
<attribute name="frictionloss" type="float"/>
296296
<attribute name="user" type="array" array_type="float"/>
297297
<attribute name="actuatorgravcomp" type="keyword" valid_values="false true"/>
@@ -424,8 +424,8 @@
424424
<attribute name="width" type="float"/>
425425
<attribute name="material" type="reference"/>
426426
<attribute name="rgba" type="array" array_type="float" array_size="4"/>
427-
<attribute name="stiffness" type="float"/>
428-
<attribute name="damping" type="float"/>
427+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
428+
<attribute name="damping" type="array" array_type="float" array_size="3"/>
429429
<attribute name="user" type="array" array_type="float"/>
430430
</attributes>
431431
</element>
@@ -606,14 +606,14 @@
606606
<attribute name="solimplimit" type="array" array_type="float" array_size="5"/>
607607
<attribute name="solreffriction" type="array" array_type="float" array_size="2"/>
608608
<attribute name="solimpfriction" type="array" array_type="float" array_size="5"/>
609-
<attribute name="stiffness" type="float"/>
609+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
610610
<attribute name="range" type="array" array_type="float" array_size="2"/>
611611
<attribute name="actuatorfrcrange" type="array" array_type="float" array_size="2"/>
612612
<attribute name="margin" type="float"/>
613613
<attribute name="ref" type="float"/>
614614
<attribute name="springref" type="float"/>
615615
<attribute name="armature" type="float"/>
616-
<attribute name="damping" type="float"/>
616+
<attribute name="damping" type="array" array_type="float" array_size="3"/>
617617
<attribute name="frictionloss" type="float"/>
618618
<attribute name="user" type="array" array_type="float"/>
619619
<attribute name="actuatorgravcomp" type="keyword" valid_values="false true"/>
@@ -741,8 +741,8 @@
741741
<attribute name="width" type="float"/>
742742
<attribute name="material" type="reference"/>
743743
<attribute name="rgba" type="array" array_type="float" array_size="4"/>
744-
<attribute name="stiffness" type="float"/>
745-
<attribute name="damping" type="float"/>
744+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
745+
<attribute name="damping" type="array" array_type="float" array_size="3"/>
746746
<attribute name="user" type="array" array_type="float"/>
747747
</attributes>
748748
</element>
@@ -1405,7 +1405,7 @@
14051405
<attribute name="solimpfriction" type="array" array_type="float" array_size="5"/>
14061406
<attribute name="actuatorfrclimited" type="keyword" valid_values="false true auto"/>
14071407
<attribute name="actuatorfrcrange" type="array" array_type="float" array_size="2"/>
1408-
<attribute name="stiffness" type="float"/>
1408+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
14091409
<attribute name="range" type="array" array_type="float" array_size="2"/>
14101410
<attribute name="margin" type="float"/>
14111411
<attribute name="ref" type="float"/>
@@ -1942,7 +1942,7 @@
19421942
<attribute name="material" type="reference"/>
19431943
<attribute name="rgba" type="array" array_type="float" array_size="4"/>
19441944
<attribute name="springlength" type="array" array_type="float" array_size="2"/>
1945-
<attribute name="stiffness" type="float"/>
1945+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
19461946
<attribute name="damping" type="float"/>
19471947
<attribute name="armature" type="float"/>
19481948
<attribute name="user" type="array" array_type="float"/>
@@ -1977,7 +1977,7 @@
19771977
<attribute name="actuatorfrcrange" type="array" array_type="float" array_size="2"/>
19781978
<attribute name="margin" type="float"/>
19791979
<attribute name="frictionloss" type="float"/>
1980-
<attribute name="stiffness" type="float"/>
1980+
<attribute name="stiffness" type="array" array_type="float" array_size="3"/>
19811981
<attribute name="damping" type="float"/>
19821982
<attribute name="armature" type="float"/>
19831983
<attribute name="user" type="array" array_type="float"/>

0 commit comments

Comments
 (0)