diff --git a/omnigibson/objects/dataset_object.py b/omnigibson/objects/dataset_object.py index 11b525b83..117960635 100644 --- a/omnigibson/objects/dataset_object.py +++ b/omnigibson/objects/dataset_object.py @@ -119,16 +119,6 @@ def __init__( assert len(available_models) > 0, f"No available models found for category {category}!" model = random.choice(available_models) - # If the model is in BAD_CLOTH_MODELS, raise an error for now -- this is a model that's unstable and needs to be fixed - # TODO: Remove this once the asset is fixed! - from omnigibson.utils.bddl_utils import BAD_CLOTH_MODELS - - if prim_type == PrimType.CLOTH and model in BAD_CLOTH_MODELS.get(category, dict()): - raise ValueError( - f"Cannot create cloth object category: {category}, model: {model} because it is " - f"currently broken ): This will be fixed in the next release!" - ) - self._model = model usd_path = self.get_usd_path(category=category, model=model, dataset_type=dataset_type) diff --git a/omnigibson/systems/micro_particle_system.py b/omnigibson/systems/micro_particle_system.py index a9322638a..6702f8131 100644 --- a/omnigibson/systems/micro_particle_system.py +++ b/omnigibson/systems/micro_particle_system.py @@ -32,18 +32,16 @@ # Create settings for this module m = create_module_macros(module_path=__file__) - -# TODO: Tune these default values! # TODO (eric): figure out whether one offset can fit all m.MAX_CLOTH_PARTICLES = 20000 # Comes from a limitation in physx - do not increase m.CLOTH_PARTICLE_CONTACT_OFFSET = 0.0075 m.CLOTH_REMESHING_ERROR_THRESHOLD = 0.05 -m.CLOTH_STRETCH_STIFFNESS = 10000.0 -m.CLOTH_BEND_STIFFNESS = 200.0 -m.CLOTH_SHEAR_STIFFNESS = 100.0 -m.CLOTH_DAMPING = 0.2 +m.CLOTH_STRETCH_STIFFNESS = 100.0 +m.CLOTH_BEND_STIFFNESS = 50.0 +m.CLOTH_SHEAR_STIFFNESS = 70.0 +m.CLOTH_DAMPING = 0.02 m.CLOTH_FRICTION = 0.4 -m.CLOTH_DRAG = 0.001 +m.CLOTH_DRAG = 0.02 m.CLOTH_LIFT = 0.003 m.MIN_PARTICLE_CONTACT_OFFSET = 0.005 # Minimum particle contact offset for physical micro particles m.FLUID_PARTICLE_PARTICLE_DISTANCE_SCALE = 0.8 # How much overlap expected between fluid particles at rest @@ -1716,6 +1714,25 @@ def clothify_mesh_prim(self, mesh_prim, remesh=True, particle_distance=None): ms.meshing_isotropic_explicit_remeshing( iterations=5, adaptive=True, targetlen=pymeshlab.AbsoluteValue(particle_distance) ) + # Make sure the clothes is watertight + ms.meshing_repair_non_manifold_edges() + ms.meshing_repair_non_manifold_vertices() + + # If the cloth has multiple pieces, only keep the largest one + ms.generate_splitting_by_connected_components(delete_source_mesh=True) + if len(ms) > 1: + log.warning(f"The cloth mesh has {len(ms)} disconnected pieces. To simplify, we only keep the mesh with largest face number.") + biggest_face_num = 0 + for split_mesh in ms: + face_num = split_mesh.face_number() + if face_num > biggest_face_num: + biggest_face_num = face_num + new_ms = pymeshlab.MeshSet() + for split_mesh in ms: + if split_mesh.face_number() == biggest_face_num: + new_ms.add_mesh(split_mesh) + ms = new_ms + avg_edge_percentage_mismatch = abs( 1.0 - particle_distance / ms.get_geometric_measures()["avg_edge_length"] )