Add pulley support to spatial tendons in MJX.

PiperOrigin-RevId: 683103659
Change-Id: I22544071a3fc6fbd09f9a59690106701b101ee6a
This commit is contained in:
Taylor Howell
2024-10-07 03:00:02 -07:00
committed by Copybara-Service
parent bce43b63ed
commit 160ed9bfe2
10 changed files with 480 additions and 15 deletions
@@ -0,0 +1,103 @@
<mujoco model="pulley_fixed_site_wrap">
<option>
<flag contact="disable" gravity="disable"/>
</option>
<worldbody>
<body>
<joint name="joint0" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site0" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere0" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint1" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site1" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere1" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint2" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site2" pos="0.25 0 0.1" size="0.025"/>
<geom name="cylinder2" type="cylinder" contype="0" conaffinity="0" pos="0.5 0 0.25" euler="90 0 0" size="0.085 0.1"/>
<geom name="sphere2" type="sphere" contype="0" conaffinity="0" pos="0.5 0 0.25" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint3" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site3" pos="0.25 0 0.1" size="0.025"/>
</body>
</body>
</body>
</body>
</worldbody>
<tendon>
<spatial width="0.0125">
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="0.2"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<fixed>
<joint joint="joint0" coef=".1"/>
<joint joint="joint1" coef=".2"/>
<joint joint="joint2" coef=".3"/>
</fixed>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<pulley divisor="7"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="4"/>
<site site="site0"/>
<site site="site2"/>
<site site="site3"/>
<pulley divisor="3"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
</tendon>
</mujoco>
@@ -0,0 +1,84 @@
<mujoco model="pulley_site">
<option>
<flag contact="disable" gravity="disable"/>
</option>
<worldbody>
<body>
<joint name="joint0" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site0" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere0" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint1" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site1" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere1" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint2" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site2" pos="0.25 0 0.1" size="0.025"/>
<geom name="cylinder2" type="cylinder" contype="0" conaffinity="0" pos="0.5 0 0.25" euler="90 0 0" size="0.085 0.1"/>
<geom name="sphere2" type="sphere" contype="0" conaffinity="0" pos="0.5 0 0.25" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint3" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site3" pos="0.25 0 0.1" size="0.025"/>
</body>
</body>
</body>
</body>
</worldbody>
<tendon>
<spatial width="0.0125">
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="0.2"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<pulley divisor="7"/>
<site site="site2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<site site="site0"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="4"/>
<site site="site0"/>
<site site="site2"/>
<site site="site3"/>
<pulley divisor="3"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
</tendon>
</mujoco>
@@ -0,0 +1,98 @@
<mujoco model="pulley_site_wrap">
<option>
<flag contact="disable" gravity="disable"/>
</option>
<worldbody>
<body>
<joint name="joint0" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site0" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere0" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint1" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site1" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere1" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint2" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site2" pos="0.25 0 0.1" size="0.025"/>
<geom name="cylinder2" type="cylinder" contype="0" conaffinity="0" pos="0.5 0 0.25" euler="90 0 0" size="0.085 0.1"/>
<geom name="sphere2" type="sphere" contype="0" conaffinity="0" pos="0.5 0 0.25" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint3" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site3" pos="0.25 0 0.1" size="0.025"/>
</body>
</body>
</body>
</body>
</worldbody>
<tendon>
<spatial width="0.0125">
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="0.2"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<pulley divisor="7"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="4"/>
<site site="site0"/>
<site site="site2"/>
<site site="site3"/>
<pulley divisor="3"/>
<site site="site0"/>
<site site="site1"/>
<site site="site2"/>
<site site="site3"/>
</spatial>
</tendon>
</mujoco>
@@ -0,0 +1,78 @@
<mujoco model="pulley_wrap">
<option>
<flag contact="disable" gravity="disable"/>
</option>
<worldbody>
<body>
<joint name="joint0" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site0" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere0" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint1" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site1" pos="0.25 0 0.1" size="0.025"/>
<geom name="sphere1" type="sphere" pos="0.5 0 0.125" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint2" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site2" pos="0.25 0 0.1" size="0.025"/>
<geom name="cylinder2" type="cylinder" contype="0" conaffinity="0" pos="0.5 0 0.25" euler="90 0 0" size="0.085 0.1"/>
<geom name="sphere2" type="sphere" contype="0" conaffinity="0" pos="0.5 0 0.25" size="0.085"/>
<body pos="0.5 0 0">
<joint name="joint3" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.05 0.5" fromto="0 0 0 0.5 0 0"/>
<site name="site3" pos="0.25 0 0.1" size="0.025"/>
</body>
</body>
</body>
</body>
</worldbody>
<tendon>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<pulley divisor="3"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<pulley divisor="7"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
<pulley divisor="2"/>
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site1"/>
<geom geom="sphere1"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
<spatial width="0.0125">
<site site="site0"/>
<geom geom="sphere0"/>
<site site="site2"/>
<geom geom="cylinder2"/>
<site site="site3"/>
</spatial>
</tendon>
</mujoco>
@@ -0,0 +1,66 @@
<mujoco model="tendon">
<default>
<joint axis="0 1 0" range="0 60" limited="true"/>
<geom type="capsule" size=".01" rgba=".9 .7 .1 1"/>
<site rgba=".9 .9 .9 1"/>
<default class="visual_cylinder">
<geom type="cylinder" fromto="0 .015 0 0 -.015 0" size=".02" rgba=".3 .9 .3 .4"/>
</default>
</default>
<worldbody>
<light pos="0 0 1"/>
<body name="weight" pos="-.03 0 .175">
<joint axis="0 0 1" pos="0 0 .025" type="slide"/>
<geom type="cylinder" size=".03 .025" density="5000" rgba=".2 .2 .5 1"/>
<site name="s1" pos="0 0 .025"/>
</body>
<site name="s2" pos="-.03 0 .33"/>
<body pos="0 0 .3">
<joint/>
<geom name="g1" class="visual_cylinder"/>
<geom fromto="0 0 0 .1 0 0"/>
<site name="s3" pos=".02 0 .03"/>
<body pos=".1 0 0">
<joint/>
<geom name="g2" class="visual_cylinder"/>
<geom fromto="0 0 0 .1 0 0"/>
<site name="s4" pos=".03 0 .01"/>
<site name="s5" pos=".05 0 .02"/>
<site name="side2" pos="0 0 .03"/>
<body pos=".1 0 0">
<joint/>
<geom name="g3" class="visual_cylinder"/>
<geom fromto="0 0 0 .1 0 0"/>
<site name="s6" pos=".03 0 .01"/>
<site name="side3" pos="0 0 .03"/>
</body>
</body>
</body>
</worldbody>
<tendon>
<spatial range="0 .33" limited="true" width=".002" rgba=".95 .3 .3 1">
<site site="s1"/>
<site site="s2"/>
<geom geom="g1"/>
<site site="s3"/>
<pulley divisor="2"/>
<site site="s3"/>
<geom geom="g2" sidesite="side2"/>
<site site="s4"/>
<pulley divisor="2"/>
<site site="s3"/>
<geom geom="g2" sidesite="side2"/>
<site site="s5"/>
<geom geom="g3" sidesite="side3"/>
<site site="s6"/>
</spatial>
</tendon>
</mujoco>