Xingyu-Lin/softgym

Unrealistic contact between cloth and box faces

Barbany opened this issue · 2 comments

Hi! I'm trying to simulate contact between clothes and rigid boxes. To do that, I adapted the DropCloth environment and added two boxes with the following method:

def create_boxes(quat):
    pyflex.add_box([0.2, 0.6, 0.04], [0, 0, 0], quat)
    pyflex.add_box([0.2, 0.2, 0.3], [0, 0, -0.16], quat)

Boxes flat on the ground:

If setting boxes aligned with the world axis, i.e., using quat = quatFromAxisAngle([1, 0, 0], 0.0), I get the following unrealistic contact (same movement, front and top views):
Gif
Gif

Note that when the cloth interacts with the box, it sticks and gets infinitely stretched. It looks like there's an infinite friction.

Boxes tilted w.r.t ground:

Instead, when setting tilted boxes, concretely with quat = quatFromAxisAngle([1, 0, 0], 0.4), we get:
Gif
Gif

Now, we can see that the cloth experiments a realistic friction with most of the box but with the edge, in which we can slightly see the "sticking" effect above. However, once enough force is applied to pull the cloth, it gets detached from the surface of the box.

Question:

Is there any way I can recreate a realistic friction between a box flat on the ground and a cloth? The simulation obtained in the tilted case seems reasonable enough, but it looks like a similar effect should be obtained in both cases.

The cloth is modeled as a grid of particles connected by springs. If the corner of the table is sharp and the particles on different sides of the corner move in different directions, the solver might not find the correct next positions. I think a simple solution might be making a round corner by adding a cylinder

I added a small cylinder on the edge of the box as suggested and it works:
Gif

@Xingyu-Lin Thanks a lot for the answer and for sharing the SoftGym project!

If someone comes with the same issue, the code to do that is:

quat = quatFromAxisAngle([1, 0, 0], 0.0)
pyflex.add_capsule([radius, halfheight], [pose_x, pose_y, pose_z], quat)

and I selected radius as the particle radius, halfheight the length of the upper box along axis x, pose_y the pose_y for the upper box + its height, pose_z the pose_zof the upper box - its length in the z axis.