Creating a rope in MuJoCo 1.5

Discussion in 'Modeling' started by cyril, Dec 28, 2018.

  1. Hello I'm trying to create a rope in MuJoCo 1.5. I know 2.0 supports ropes using the following:

    <bodyname="B10"pos="0 0 1"><freejoint/><compositetype="rope"count="21 1 1"spacing="0.04"offset="0 0 2"><jointkind="main"damping="0.005"/><geomtype="capsule"size=".01 .015"rgba=".8 .2 .1 1"/></composite></body>

    but I can't use it due to dependency conflicts. In 1.5 I've tried stacking a few capsules with ball joints which seems to mimic the effect close enough but moving them with CONTROL+SHIFT+ RIGHT CLICK makes it jump around with too many collisions leading me to think it won't be stable in simulation. Any ideas on what else I can use to stabilize it?

    Sample code:

    <body>
    <joint type="ball" pos="0.075 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.090 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.105 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.12 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.135 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.15 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.165 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.18 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.195 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.21 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.225 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.24 0.020 0" euler="0 1.5708 0"/>
    <body>
    <joint type="ball" pos="0.255 0.020 0"></joint>
    <geom type="capsule" size="0.005 0.01" rgba=".8 .2 .1 1" mass="0.0001" pos="0.27 0.020 0" euler="0 1.5708 0"/>
    <body>
    </body>
    </body>
    </body>
    </body>
    </body>
    </body>
    </body>
    </body>

    EDIT: I've replaced the ball joints with two hinge joints orthogonal to the plane.
    EDIT 2: Noticed I get the
    WARNING: Nan, Inf or huge value in QACC at DOF 24. The simulation is unstable. Time = 95.7520. error when the weird animation happens
     
    Last edited: Dec 28, 2018
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    This system needs small time steps, because of the long kinematic chain which is hard to integrate numerically.

    You can create a rope model in 2.0 and save it as XML. The saved XML replaces the <composite> element with the list of bodies and joints, so you can copy that fragment into your 1.5 model.
     
  3. I was able to recreate the rope faithfully by using damping, contact exclusions and two hinges orthogonal to the plane and it behaves exactly like the 2.0 version. I'm just pondering how I'll be able to detect knots in the ropes programmatically
     
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    Interesting question. Mathematicians have studied knots for a long time, but I don't know if that has produced a computationally efficient algorithm for detecting knots... you may want to read some math papers.
     
    cyril likes this.
  5. Hi Emo, could you please tell me how to create a rope in 2.0 and then save it as XML as you mentioned?
     
  6. The simulate UI has a button "Save xml"
     
  7. Thanks so much for responding! Actually I think the latest HAPTIX right now does not support mujoco 2.0. It cannot open any default xml models in mujoco200 and it cannot recognize the attribute “composite”.