ravens/gripper.py
def detect_contact_def(self, gripper_position, defId):
        """Detect contact, when dealing with deformables.

        We may want to speed this up if it is a bottleneck. Returns a binary
        signal of whether there exists _any_ vertex within the threshold.
        Note with collisionMargin=0.004, I am getting most cloth vertices
        (for ClothFlat) to settle at ~0.004m high.
        """
        _, vert_pos_l = p.getMeshData(defId, -1, flags=p.MESH_DATA_SIMULATION_MESH)

        # Vectorized.
        distances_np = gripper_position - np.array(vert_pos_l)
        assert len(distances_np.shape) == 2, distances_np.shape
        distances_L2 = np.linalg.norm(distances_np, axis=1)
        return np.min(distances_L2) < self.def_threshold

        # Older way
        #distances = []
        #for v_position in vert_pos_l:
        #    d = gripper_position - np.float32(v_position)
        #    distances.append(np.linalg.norm(d))
        #return np.min(distances) < self.def_threshold
Detect contact, when dealing with deformables.

        We may want to speed this up if it is a bottleneck. Returns a binary
        signal of whether there exists _any_ vertex within the threshold.
        Note with collisionMargin=0.004, I am getting most cloth vertices
        (for ClothFlat) to settle at ~0.004m high.
        
Detect contact, when dealing with deformables.
We may want to speed this up if it is a bottleneck. Returns a binary
signal of whether there exists _any_ vertex within the threshold.
Note with collisionMargin=0.004, I am getting most cloth vertices
(for ClothFlat) to settle at ~0.004m high.
Detect contact when dealing with deformables . We may want to speed this up if it is a bottleneck . Returns a binary signal of whether there exists _any_ vertex within the threshold . Note with collisionMargin = 0 . 004 I am getting most cloth vertices ( for ClothFlat ) to settle at ~0 . 004m high .
def detect_contact_def(self, gripper_position, defId):
        _, vert_pos_l = p.getMeshData(defId, -1, flags=p.MESH_DATA_SIMULATION_MESH)
        distances_np = gripper_position - np.array(vert_pos_l)
        assert len(distances_np.shape) == 2, distances_np.shape
        distances_L2 = np.linalg.norm(distances_np, axis=1)
        return np.min(distances_L2) < self.def_threshold
def detect_contact_def ( self , gripper_position , defId ) : _ , vert_pos_l = p . getMeshData ( defId , - 1 , flags = p . MESH_DATA_SIMULATION_MESH ) distances_np = gripper_position - np . array ( vert_pos_l ) assert len ( distances_np . shape ) == 2 , distances_np . shape distances_L2 = np . linalg . norm ( distances_np , axis = 1 ) return np . min ( distances_L2 ) < self . def_threshold
Detect contact, when dealing with deformables.
Detect contact when dealing with deformables .
"""Detect contact, when dealing with deformables.

        We may want to speed this up if it is a bottleneck. Returns a binary
        signal of whether there exists _any_ vertex within the threshold.
        Note with collisionMargin=0.004, I am getting most cloth vertices
        (for ClothFlat) to settle at ~0.004m high.
        """ # Vectorized. # Older way #distances = [] #for v_position in vert_pos_l: #    d = gripper_position - np.float32(v_position) #    distances.append(np.linalg.norm(d)) #return np.min(distances) < self.def_threshold
self
gripper_position
defId