Search code examples
drake

Why is Drake Collision only working for links with low weight?


I am trying to get this link (ground_mass2) to collide with the ground. At mass values lower than 5, ground_mass2 interacts with the ground, but for heavier masses, the link will pass through the ground with no collision.

Here is the URDF:

  <link name="ground">

    <visual>
      <origin xyz="0 0 -.05" rpy="0 0 0"/>
      <geometry>
        <box size="10 1 .1" />
      </geometry>
      <material name="green">
        <color rgba="0 1 0 1" />
      </material>
    </visual>
    

    <collision name="collision_ground">
      <origin xyz="0 0 -.05" rpy="0 0 0"/>
      <geometry>
        <box size="10 1 .1" />
      </geometry>
      <drake:proximity_properties>
         <drake:hunt_crossley_dissipation value="1"/>
         <drake:point_contact_stiffness value="10000"/>>
        </drake:proximity_properties>
    </collision> 

  </link>


  <link name="ground_mass2">

    <visual>
      <origin xyz="0 0 -1"/>
      <geometry>
        <sphere radius=".05"/>
      </geometry>
      <material>
        <color rgba="0 0 0 1"/>
      </material>
    </visual>

    <inertial>
      <origin xyz="0 0 -1"/>
      <mass value="5"/>
    </inertial>

    <collision name="collision_groundmass2">
      <origin xyz="0 0 -1" rpy="0 0 0"/>
      <geometry>
        <sphere radius=".01"/>
      </geometry>
      <drake:proximity_properties>
         <drake:hunt_crossley_dissipation value="1"/>
         <drake:point_contact_stiffness value="10000"/>>
        </drake:proximity_properties>
    </collision> 
   
  </link>

  <joint name="ground_mass2" type="prismatic">

    <parent link="swing_leg"/>
    <child link="ground_mass2"/>
    <axis xyz="0 0 -1"/>

  </joint>

Ground_mass2 is attached by a prismatic joint (and linear spring damper) to the leg of a rigid walker. I am trying to anchor the walker's leg to the ground, so I made ground_mass2 very heavy. Is there any reason why the collision stops working for heavier mass values?

Otherwise, is there a better way for me to implement this such that ground_mass2 is fixed to a specified point on the ground (anchor point)? Before this, I looked into adding a distance constraint (unfortunately this function is currently only working for discrete time simulations) and adding a force element between ground_mass2 and the anchor point.


Solution

  • I'm going to assume you're using point contact (although the principle is largely the same as for hydroelastic contact).

    The contact force is basically proportional to the penetration distance and the stiffness. Going deep creates more force. Making it stiff creates more force.

    You've got a very thin ground box (10 cm). That means once something penetrates deeper than 5 cm, the contact force isn't trying to push it up, it's pushing it down because that's the closest direction to "out".

    So, generally, you should make your ground objects fat so you have plenty of volume to accumulate penetration force. Also, if you're increasing the mass of the object that are going to intersect it, you might also want to increase its stiffness (so you don't have to penetrate significantly more to get an appropriate contact force).

    So, thickness and stiffness will make your ground resistant to pass through.