Skip to content

Commit d6d60b7

Browse files
committed
Check arm collision.
1 parent ff9ba7e commit d6d60b7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pyrep/robots/arms/arm.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,14 @@ def get_jacobian(self):
467467
jacobian, (rows, cols) = sim.simGetIkGroupMatrix(self._ik_group, 0)
468468
jacobian = np.array(jacobian).reshape((rows, cols), order='F')
469469
return jacobian
470+
471+
def check_arm_collision(self, obj: 'Object' = None) -> bool:
472+
"""Checks whether two entities are colliding.
473+
474+
:param obj: The other collidable object to check collision against,
475+
or None to check against all collidable objects. Note that objects
476+
must be marked as collidable!
477+
:return: If the object is colliding.
478+
"""
479+
handle = sim.sim_handle_all if obj is None else obj.get_handle()
480+
return sim.simCheckCollision(self._collision_collection, handle) == 1

0 commit comments

Comments
 (0)