manipulation.create_sdf_from_mesh

A script for creating a Drake-compatible SDFormat file for a triangle mesh.

Credits: Part of this code has been adopted from Greg Izatt (https://github.com/gizatt/convex_decomp_to_sdf).

manipulation.create_sdf_from_mesh.create_sdf_from_mesh(mesh_path, mass, scale, is_compliant, hydroelastic_modulus, hunt_crossley_dissipation, mu_dynamic, mu_static, preview_with_trimesh, use_coacd=False, coacd_kwargs=None, vhacd_kwargs=None)

Given a mesh, creates an SDFormat file in the same directory that: - Uses the mesh as its visual geometry - Performs a convex decomposition of the mesh, and uses those pieces as the collision geometry - Inserts the center of mass and moment of inertia for the object, calculated from the original mesh and a uniform density assumption. The density is computed from the mesh volume and the given mass

Parameters:
  • mesh_path (Path) – The path to the mesh.

  • mass (float) – The mass in kg of the mesh.

  • scale (float) – Scale factor to convert the specified mesh’s coordinates to

  • meters.

  • is_compliant (bool) – Whether the SDFormat file will be used for compliant

  • this (Hydroelastic simulations. The object will behave as rigid Hydroelastic if)

  • specified. (is not)

  • hydroelastic_modulus (float) – The Hydroelastic Modulus. This is only used if

  • See (is_compliant is True. The default value leads to low compliance.)

  • https – //drake.mit.edu/doxygen_cxx/group__hydroelastic__user__guide.html for how

  • value. (to pick a)

  • hunt_crossley_dissipation (Union[float, None]) – The optional Hydroelastic

  • dissipation (Hunt-Crossley)

  • https – //drake.mit.edu/doxygen_cxx/group__hydroelastic__user__guide.html for how

  • value.

  • mu_dynamic (Union[float, None]) – The coefficient of dynamic friction.

  • mu_static (Union[float, None]) – The coefficient of static friction.

  • preview_with_trimesh (bool) – Whether to open (and block on) a window to preview

  • decomposition. (the)

  • use_coacd (bool) – Whether to use CoACD instead of VHACD for convex decomposition.

  • coacd_kwargs (dict | None) – The CoACD-specific parameters.

  • vhacd_kwargs (dict | None) – The VHACD-specific parameters.

Return type:

None