ravens/tasks/defs_cloth.py
def add_cloth(self, env, base_pos, base_orn):
        """Adding a cloth from an .obj file."""
        cloth_id = p.loadSoftBody(
                fileName=self._f_cloth,
                basePosition=base_pos,
                baseOrientation=base_orn,
                collisionMargin=self._collisionMargin,
                scale=self._cloth_scale,
                mass=self._mass,
                useNeoHookean=0,
                useBendingSprings=1,
                useMassSpring=1,
                springElasticStiffness=40,
                springDampingStiffness=0.1,
                springDampingAllDirections=0,
                useSelfCollision=1,
                frictionCoeff=1.0,
                useFaceContact=1,)

        # Only if using more recent PyBullet versions.
        p_version = pkg_resources.get_distribution('pybullet').version
        if p_version == '3.0.4':
            color = U.COLORS['yellow'] + [1]
            p.changeVisualShape(cloth_id, -1, flags=p.VISUAL_SHAPE_DOUBLE_SIDED,
                                rgbaColor=color)

        # For tracking IDs and consistency with existing ravens code.
        self._IDs[cloth_id] = 'cloth'
        self.object_points[cloth_id] = np.float32((0, 0, 0)).reshape(3, 1)
        env.objects.append(cloth_id)

        # To help environment pick-place method track all deformables.
        self.def_IDs.append(cloth_id)

        # Sanity checks.
        nb_vertices, _ = p.getMeshData(cloth_id, -1, flags=p.MESH_DATA_SIMULATION_MESH)
        assert nb_vertices == self.n_cuts * self.n_cuts
        return cloth_id
Adding a cloth from an .obj file.
Adding a cloth from an .obj file.
Adding a cloth from an . obj file .
def add_cloth(self, env, base_pos, base_orn):
        cloth_id = p.loadSoftBody(
                fileName=self._f_cloth,
                basePosition=base_pos,
                baseOrientation=base_orn,
                collisionMargin=self._collisionMargin,
                scale=self._cloth_scale,
                mass=self._mass,
                useNeoHookean=0,
                useBendingSprings=1,
                useMassSpring=1,
                springElasticStiffness=40,
                springDampingStiffness=0.1,
                springDampingAllDirections=0,
                useSelfCollision=1,
                frictionCoeff=1.0,
                useFaceContact=1,)
        p_version = pkg_resources.get_distribution('pybullet').version
        if p_version == '3.0.4':
            color = U.COLORS['yellow'] + [1]
            p.changeVisualShape(cloth_id, -1, flags=p.VISUAL_SHAPE_DOUBLE_SIDED,
                                rgbaColor=color)
        self._IDs[cloth_id] = 'cloth'
        self.object_points[cloth_id] = np.float32((0, 0, 0)).reshape(3, 1)
        env.objects.append(cloth_id)
        self.def_IDs.append(cloth_id)
        nb_vertices, _ = p.getMeshData(cloth_id, -1, flags=p.MESH_DATA_SIMULATION_MESH)
        assert nb_vertices == self.n_cuts * self.n_cuts
        return cloth_id
def add_cloth ( self , env , base_pos , base_orn ) : cloth_id = p . loadSoftBody ( fileName = self . _f_cloth , basePosition = base_pos , baseOrientation = base_orn , collisionMargin = self . _collisionMargin , scale = self . _cloth_scale , mass = self . _mass , useNeoHookean = 0 , useBendingSprings = 1 , useMassSpring = 1 , springElasticStiffness = 40 , springDampingStiffness = 0.1 , springDampingAllDirections = 0 , useSelfCollision = 1 , frictionCoeff = 1.0 , useFaceContact = 1 , ) p_version = pkg_resources . get_distribution ( 'pybullet' ) . version if p_version == '3.0.4' : color = U . COLORS [ 'yellow' ] + [ 1 ] p . changeVisualShape ( cloth_id , - 1 , flags = p . VISUAL_SHAPE_DOUBLE_SIDED , rgbaColor = color ) self . _IDs [ cloth_id ] = 'cloth' self . object_points [ cloth_id ] = np . float32 ( ( 0 , 0 , 0 ) ) . reshape ( 3 , 1 ) env . objects . append ( cloth_id ) self . def_IDs . append ( cloth_id ) nb_vertices , _ = p . getMeshData ( cloth_id , - 1 , flags = p . MESH_DATA_SIMULATION_MESH ) assert nb_vertices == self . n_cuts * self . n_cuts return cloth_id
Adding a cloth from an .obj file.
Adding a cloth from an . obj file .
"""Adding a cloth from an .obj file.""" # Only if using more recent PyBullet versions. # For tracking IDs and consistency with existing ravens code. # To help environment pick-place method track all deformables. # Sanity checks.
self
env
base_pos
base_orn