Softbody simulation

Hello everyone,

I have just started with Isaac Gym not too long ago. I’m trying to start by playing around with soft_bodies.py script to simulate soft bodies. It seems to me that the input mesh has a form of .tet, which is quite confusing. Thus, I would like to ask for two things:

  • Which format besides .tet is used for soft bodies? If .tet is the only acceptable format, which tool should we use to generate this format?
  • Is it possible if the developer provides primitive objects such as a cube, or a rectangular box .tet mesh? That would be really nice.
    Thanks!
    P/s: I enjoy the Isaac Gym so much so far :)
2 Likes

To follow up my question, I tried to manually generate a .tet file based on the output mesh I got from a tetrahedron mesh generation, however it keeps saying that “Degenerate or inverted tet”. Any suggestion on which software to generate good .tet file is really appreciated. Thanks!

Soft Body support is still very much in development for Isaac Gym. While it will work with the Flex physics engine, and there should be some samples up that use it in the next few weeks, we will not be able to provide significant support on the soft body APIs until we bring the Gym functionality into Omniverse and Isaac Sim.

That said, we do hope to provide some more documentation on the APIs soon, and you can use this script to generate a .tet file using a mesh generated from fTetMesh (GitHub - wildmeshing/fTetWild: Fast Tetrahedral Meshing in the Wild).

Take care,
-Gav

2 Likes

Thanks, @gstate for your reply it helps me a lot.
Just one last question regarding this. I tried to use the generate tomato model together with a Franka robot model and got the result as shown in the figure below. As you can see, the tet mesh is enormous compared to Franka robot. Looks like this is the scaling problem since the vertices of the tomato are somewhere around 1 to 3 while Franka is around 0.1. And I can’t find any rescaling param from the document. Can you give me a hint on this matter? I tried to rescaled the tomato by dividing the vertices to 10 but then the model starts to behave really bad. Thank you!

Hi @tran.nguyenle,

If you are loading in the tet mesh from an URDF model, such as how it’s done in the urdf/icosphere.urdf example used in soft_body.py, you can set a scaling parameter in the URDF file. This can be done by adding to the definition that references your tet file, e.g:

	<link name="soft">
		<fem>
			<origin rpy="0.0 0.0 0.0" xyz="0 -0.5 0"/>
			<density value="1000"/>
			<youngs value="1e5"/>
			<poissons value="0.45"/>
			<damping value="0.0"/>
			<attachDistance value="0.0"/>
			<tetmesh filename="icosphere.tet"/>
			<scale value="0.5"/>
		</fem>
	</link>
1 Like

Hi @kellyg,

Thanks for your reply regarding this matter. As a matter of fact, I tried to scale the mesh as you suggested, however, it seems like scaling the mesh actually affects the behavior of the deformation. As shown in the figure below, when running the code soft_body.py and left it running for 20 seconds or so, the default scale works as expected but with scaled mesh, the object seems like deforms itself. After awhile the shape of the ball changes completely. Should I modify anything else like density to make it work? It would be nice to get a hint to solve this. I have been stuck with it for quite some time :D. Thanks in advance!

Hi @tran.nguyenle,

This behavior could be caused by the randomization on the damping parameter in the soft_body.py script. Could you try removing this line: actor_soft_materials[j].damping = random.uniform(0.0, 0.08)**2 or modifying the randomization range to be something much smaller than 0.08 and see if that produces the expected behavior?

1 Like

Hi @kellyg,
Thanks a lot for your answer. It solved the scaling problem by playing with the damping parameter as you suggested!

Btw, I have another question regarding the contact between the robot gripper and soft bodies (I guess it would be nicer to ask it here rather than making a new post, right?) I’m trying to build a grasping environment where a Franka robot tries to grasp soft bodies. As shown in the figure below, the soft object deformed even when the finger doesn’t actually make the contact with the object. For the record, I set this param as sim_params.flex.shape_collision_distance = 0.0000000000001 to minimize the distance between the bodies but the result is still the same. Any suggestion regarding this? Thanks!

Hi, @tran.nguyenle
I am facing a similar question now.
Did you manage to work it out? If yes could you guide with some tips?

There are 2 parameters that control collision distance and should be tuned together, the 2nd parameter is thickness on the gripper.

Contact distance is the sum of thickness + shape_collision_distance, so setting a collision thickness and shape_collision_distance say to 5e-4 should solve all your issues.

1 Like

Thank you. This helps.
There is another question regarding soft bodies.
I am simulating a grasp of a soft body with Panda’s gripper.
When a soft body is grasped with a reasonable space between the fingers, then it falls down after opening the gripper(as expected).
When the soft body is squeezed between the finger, then after opening the gripper it stays ‘glued’ to the finger.
squeezed:


glued:

Could you suggest which parameters in the setup of simulation, or imported assets may have an effect on this behavior?

Can you share your simulation parameters? I can suggest trying to increase the number of substeps first, then a number of inner iterations: flex.num_inner_iterations

1 Like

Thank you for the reply.
It seems like the increase of substeps helps. Even a change from 1 to 2 has an impact.
Previously I was trying to find a balance between outer and inner iterations.

Here is my set-up now(may be you could point out some over obvious missettings):

sim_params.dt = 1.0 / 60.0
sim_params.substeps = 3
# flex
sim_params.flex.solver_type = 5
sim_params.flex.num_outer_iterations = 5
sim_params.flex.num_inner_iterations = 200
sim_params.flex.relaxation = 0.75
sim_params.flex.warm_start = 0.8
sim_params.flex.deterministic_mode = True
# flex contact 
sim_params.flex.shape_collision_distance = 5e-4
sim_params.flex.contact_regularization = 1.0e-6
sim_params.flex.shape_collision_margin = 1.0e-4
sim_params.flex.dynamic_friction = 0.7
# soft body 
asset_options.armature = 0.0
asset_options.linear_damping = 1.0 
asset_options.angular_damping = 0.0
asset_options.min_particle_mass = 1e-20
asset_options.thickness = 5e-4
# rigid body(gripper) - same but
asset_options.min_particle_mass = 1e-4
asset_options.armature = 0.01

200 could be a too big value for inner iterations, reducing this number to 50 and in some cases, even more, shouldn’t affect the convergence, but improve performance a lot. For outer iterations values from in the range, 4-6 are totally ok. As for substeps for your dt = 1/60 s 1 substep is usually too little, for a simpler simulation task 2 is often enough, but in your case 4 or even larger values would be a good choice. In the case of using more substeps, you can reduce the number of inner iterations even more and use 4 outer iterations instead of 5 - it should help with keeping the perfromance at the same level.

1 Like

Thank you for this reply. It really helps.

Hi, @gstate
hope it is fine, if I ask a question regarding soft bodies, while I understand that they are not fully supported in the current version of Isaac Gym with Flex simulation.
I’ve followed your tips about creating .mesh files and then converting them to .tet files to use them in .urdfs.
So, if I understood correctly, in the current implementation, soft bodies do not support colors or textures.
A soft body is either of a standard whitish color or is colored with a stress visualization.

  • There is no implementation of set_color or set_texture for a soft body in the API.
  • A .tet file does not support colors, as it contains only vertices and tetrahedras, which are taken from .mesh file(which also does not have colors).
  • An addition of a <material> or <visual> tags to .urdf file of a soft body with an <fem> tag does not change the appearance of a soft body
    Is it right, or am I missing smth, and is there some way to colorize a soft body in the current state of Isaac Gym?

If there is no such option, are there any plans to add it in the near future with soft bodies based on Flex simulation?

Hi all, I am facing a problem about setting the stiffness of the soft body. Is there any way to manipulate its elasticity?