Skip to content

Commit 5a497b5

Browse files
committed
Fixes collision check for attached objects.
Corrects collision checking logic between a robot and its attached objects. The previous logic iterated through moving links only, which could miss collisions if the attached object's link wasn't a moving link. This change iterates through all links of the robot to ensure comprehensive collision detection.
1 parent 23fc769 commit 5a497b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pybullet_planning/interfaces/robots/collision.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ def get_collision_fn(body, joints, obstacles=[],
390390
moving_links = frozenset(get_moving_links(body, joints))
391391
attached_bodies = [attachment.child for attachment in attachments]
392392
moving_bodies = [(body, moving_links)] + attached_bodies
393+
all_links = get_all_links(body)
393394
# * main body self-collision link pairs
394395
self_check_link_pairs = get_self_link_pairs(body, joints, disabled_collisions) if self_collisions else []
395396
# * main body link - attachment body pairs
@@ -403,7 +404,7 @@ def get_collision_fn(body, joints, obstacles=[],
403404
# TODO add attached object's link might not be BASE_LINK (i.e. actuated tool)
404405
# get_all_links
405406
at_check_links = []
406-
for ml in moving_links:
407+
for ml in all_links:
407408
if ml != attached.parent_link and \
408409
((body, ml), (attached.child, BASE_LINK)) not in extra_disabled_collisions and \
409410
((attached.child, BASE_LINK), (body, ml)) not in extra_disabled_collisions:

0 commit comments

Comments
 (0)