mitchellspryn / UrdfSim

Other
104 stars 25 forks source link

collisions not working as expected #27

Closed huckl3b3rry87 closed 4 years ago

huckl3b3rry87 commented 4 years ago

I am trying to use the robot arm to pick up objects, but it seems that the gripper finger is able to go straight through an object, especially when I decrease the mass of the object.

Consider this sequence example A

AA

B

** the mustard bottle passes straight through the manipulator hand

I have complex collisions set for this object collisions

and, for the manipulator arms, I have added collisions the same as the visual, e.g.,

  <link name="left_manipulator">
    <visual>
      <geometry>
        <box size="0.06 0.035 0.15"/>
      </geometry>
      <material name="rubber"/>
    </visual>
    <collision>
      <geometry>
        <box size="0.06 0.035 0.15"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="10"/>
      <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
    </inertial>
  </link>

Might the behavior be expected using the physics engine that Unreal uses?

If so, is there any way to increase the fidelity of the simulation to avoid this?

Or if not, any idea what else may be going on here.

Thanks :)

mitchellspryn commented 4 years ago

You're going to want to read this. And this.

I assume you want to move the bottle. In that case, you will need to enable physics (there should be a checkbox hidden somewhere in the options). When physics is enabled, you can only use simple collision, which restricts you to convex hulls (although you can have multiple). This is a common restriction for most game engines that I'm aware of, and it's done for performance reasons.

So, I'd recommend ditching the complex collision, adding simple collision (via the 26 DOP option), and enabling physics.

huckl3b3rry87 commented 4 years ago

@mitchellspryn at first this seemed to work, but I just tested it again and can see some issues with the collisions.

As you suggested, read the links and I used a simple collision AA

and I enabled physics B

but I am still getting cases where the ridge bodies are overlapping A

If I show collisions, it is hard to see, but the box is outlining the urdf as expected A but again, there is an intersection AA

Also, note that, this seems to only happen when I change the mass from A

to a lower value (as shown above 0.1 kg -which I do because I am having difficulty picking up the object even though I set the material to NonSlippery).

Is there anything else that may be going awry?

huckl3b3rry87 commented 4 years ago

OK, I think that I got it, if I reduce the Max Physics Delta time it works as I would like

A

@mitchellspryn thanks again:)

mitchellspryn commented 4 years ago

You're also going to want to enable substepping, and substepping async if your GPU supports it (it probably does). You should also be able to adjust your coefficient of friction in the materials editor if you're having trouble picking it up, for both the mustard bottle and the arm.

huckl3b3rry87 commented 4 years ago

@mitchellspryn thank you for the suggestions!

Yeah, I ended up turned the coefficient of friction to 10,000.... I just want it picked up