Friction not helping

Discussion in 'Simulation' started by Mincheol, Jun 18, 2020.

  1. Hello I'm trying to simulate rolling an object A on object B using another object C.

    So it will be looking something like C A B, where A is sandwiched in between B and C.

    This works fairly well when CAB are aligned with gravity. I am able to roll object A on B using C.

    However, this fails to work when I'm working in perpendicular to the gravity.

    There should be some force that C can apply to A to hold it against B using friction but no matter how I change the coefficients, A slips out of B and C.

    Intuitively, I thought this could work if only friction were larger. So I tried adjusting the friction coefficients in <contact> but it did not help at all (it rather breaks if I go beyond a certain value).

    Are there any tips in situations like this? I just want slippage to be gone, leaving only rolling. Thanks in advance.
     
    Last edited: Jun 18, 2020
  2. Does it work if you tilt it only slightly? E.g. at 10 degrees, 30, 50, etc. up to 90.

    Also, how do you apply the pressure to push them together?
     
  3. I just tried with 70 and it did not work. Object A slips out in the same way. And if the slope is too low, the gravity won't be sufficient to make A fall because of its ellipsoidal shape.

    I'm using a position actuator attached to object C to push A against a stationary object B.

    I tried with condim 4 and 6, and both did not work. Friction coefficients do not seem to help either.

    I'm starting to think MuJoCo does not support this type of simulation. It looks like object A is covered with oil and thus very slippery, such that if I push it too hard, either C penetrates into A or A slips out, and if I push it too weak, it just falls because of gravity. I want something in between.. to hold it in place without it moving.

    Only then I will be able to roll A using C.
     
  4. I made a little example model to test this (see bottom).

    It's fairly easy to make the ball almost stick, but it seems to always trickle down very very slowly. I don't know how to prevent it.

    Code:
    <!--
        Demonstration for keeping a ball squashed between two other objects
    -->
    <mujoco model="Squash">
    
        <compiler inertiafromgeom="true" angle="radian"/>
    
        <default>
            <joint armature="0"/>
            <geom condim="3" material="matgeom"/>
        </default>
    
        <visual>
            <quality shadowsize="2048"/>
        </visual>
    
        <asset>
            <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0.2 0.2 0.2" width="512" height="512"/>
            <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/> 
           
            <material name="matplane" texture="texplane" texrepeat="1 1" texuniform="true"/>
            <material name="matgeom" rgba="0.1 0.8 0.1 1"/>
        </asset>
       
        <worldbody>
            <light directional="false" diffuse="0.2 0.2 0.2" specular="0 0 0" pos="0 0 5" dir="0 0 -1" castshadow="false"/>
            <light mode="targetbodycom" target="ball" directional="false" diffuse="0.6 0.6 0.6" specular="0.3 0.3 0.3" pos="-0.5 0.5 2.0" dir="0 0 -1"/>
    
            <geom name="terrain" pos="0 0 0" type="plane" size="5 5 1" material="matplane" condim="3"/>
    
            <body name="ball" pos="0 0 1.5">
                <freejoint />
                <geom type="sphere" size="0.2"/>
            </body>
    
            <body pos="-0.22 0 1.0">
                <joint type="slide" axis="1 0 0" stiffness="10000.0" springref="1.0" damping="100.0"/>
                <geom type="box" size="0.02 1 1" />
            </body>
    
            <body pos="0.22 0 1.0">
                <joint type="slide" axis="-1 0 0" stiffness="10000.0" springref="1.0" damping="100.0"/>
                <geom type="box" size="0.02 1 1" />
            </body>
    
        </worldbody>
    
        <actuator>
        </actuator>
    
    </mujoco>
    
     
  5. It seems that dry friction is missing (or too small) between the ball and plates, hence a small velocity is needed for the friction force.
    I don't know if MuJoCo supports dry (static) friction and if it does where to change those settings.
     
  6. Thanks for trying this one out yourself Robert. Yes, this is precisely what is happening with my model. Basically, if you replace these boxes with something that's concave, the ball slips out right away as soon as it finds space to do so after some trickling down.
     
  7. So I tweaked some friction coefficients from your model and it seems to be working. Try moving one of the planes in the vertical direction:

    Code:
    <!--
      Demonstration for keeping a ball squashed between two other objects
    -->
    <mujoco model="Squash">
    
      <compiler inertiafromgeom="true" angle="radian"/>
    
      <default>
      <joint armature="0"/>
      <geom condim="3" material="matgeom"/>
      </default>
    
      <visual>
      <quality shadowsize="2048"/>
      </visual>
    
      <asset>
      <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0.2 0.2 0.2" width="512" height="512"/>
      <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
     
      <material name="matplane" texture="texplane" texrepeat="1 1" texuniform="true"/>
      <material name="matgeom" rgba="0.1 0.8 0.1 1"/>
      </asset>
     
      <worldbody>
      <light directional="false" diffuse="0.2 0.2 0.2" specular="0 0 0" pos="0 0 5" dir="0 0 -1" castshadow="false"/>
      <light mode="targetbodycom" target="ball" directional="false" diffuse="0.6 0.6 0.6" specular="0.3 0.3 0.3" pos="-0.5 0.5 2.0" dir="0 0 -1"/>
    
      <geom name="terrain" pos="0 0 0" type="plane" size="5 5 1" material="matplane" condim="3"/>
    
      <body name="ball" pos="0 0 1.5">
      <freejoint />
      <geom name="ball" type="sphere" size="0.2"/>
      </body>
    
      <body pos="-0.22 0 1.0">
      <joint type="slide" axis="1 0 0" stiffness="10000.0" springref="1.0" damping="0.0"/>
      <joint type="slide" axis="0 0 1"/>
      <geom name="plane1" type="box" size="0.02 1 1" />
      </body>
    
      <body pos="0.22 0 1.0">
      <joint type="slide" axis="-1 0 0" stiffness="10000.0" springref="1.0" damping="0.0"/>
      <joint type="slide" axis="0 0 1"/>
      <geom name="plane2" type="box" size="0.02 1 1" />
      </body>
    
      </worldbody>
    
      <contact>
      <pair geom1="ball" geom2="plane1" condim="4" friction="0.03 1 0.005 0.0001 0.0001"/>
      <pair geom1="ball" geom2="plane2" condim="4" friction="0.03 1 0.005 0.0001 0.0001"/>
      </contact>
    
      <actuator>
      </actuator>
    
    </mujoco>
    
    However, this still fails to work when the object is sandwiched in between a plane and a concave surface, rather than two planes:

    Code:
    <!--
        Demonstration for keeping a ball squashed between two other objects
    -->
    <mujoco model="Squash">
    
        <compiler inertiafromgeom="true" angle="radian"/>
    
        <default>
            <joint armature="0"/>
            <geom condim="3" material="matgeom"/>
        </default>
    
        <visual>
            <quality shadowsize="2048"/>
        </visual>
    
        <asset>
            <texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0.2 0.2 0.2" width="512" height="512"/>
            <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
          
            <material name="matplane" texture="texplane" texrepeat="1 1" texuniform="true"/>
            <material name="matgeom" rgba="0.1 0.8 0.1 1"/>
        </asset>
      
        <worldbody>
            <light directional="false" diffuse="0.2 0.2 0.2" specular="0 0 0" pos="0 0 5" dir="0 0 -1" castshadow="false"/>
            <light mode="targetbodycom" target="ball" directional="false" diffuse="0.6 0.6 0.6" specular="0.3 0.3 0.3" pos="-0.5 0.5 2.0" dir="0 0 -1"/>
    
            <geom name="terrain" pos="0 0 0" type="plane" size="5 5 1" material="matplane" condim="3"/>
    
            <body name="ball" pos="0.05 0.01 1.5">
                <freejoint />
                <geom name="ball" type="ellipsoid" quat="0.707 0.707 0 0" size="0.15 0.15 0.2"/>
            </body>
    
            <body pos="-0.22 0 1.0">
                <joint type="slide" axis="1 0 0" stiffness="1000.0" springref="1.0" damping="0.0"/>
                <joint type="slide" axis="0 0 1"/>
                <joint type="slide" axis="0 1 0"/>
                <geom name="plane1" type="ellipsoid" size="0.02 0.05 0.7" quat="0.9 0 0.1 0" mass="50"/>
            </body>
    
            <body pos="0.22 0 1.0">
                <joint type="slide" axis="-1 0 0" stiffness="10000.0" springref="1.0" damping="0.0"/>
                <joint type="slide" axis="0 0 1"/>
                <geom name="plane2" type="box" size="0.02 1 1" />
            </body>
    
        </worldbody>
    
        <contact>
            <pair geom1="ball" geom2="plane1" condim="6" friction="0.03 1 0.005 0.0001 0.0001"/>
            <pair geom1="ball" geom2="plane2" condim="6" friction="0.03 1 0.005 0.0001 0.0001"/>
        </contact>
    
        <actuator>
        </actuator>
    
    </mujoco>
     
    Last edited: Jun 22, 2020
  8. Ah yes, that works nicely. I didn't know you could define contact pairs like that, that seems to be the trick.

    I can't think of anything else.