Skip to content

Fix get_link_names exception for single-link groups (#160)#465

Open
Swastik-Verma wants to merge 1 commit into
compas-dev:mainfrom
Swastik-Verma:fix/160-robot-get-link-names
Open

Fix get_link_names exception for single-link groups (#160)#465
Swastik-Verma wants to merge 1 commit into
compas-dev:mainfrom
Swastik-Verma:fix/160-robot-get-link-names

Conversation

@Swastik-Verma

Copy link
Copy Markdown

Fixes #160

Problem

RobotCell.get_link_names() raised an exception when called on a group
consisting of a single link (e.g. an end-effector group with no
configurable joints), instead of returning that link's name.

Root cause

When a group's base link and end-effector link are the same (i.e. the
group has only one link), get_link_names() would still call
iter_link_chain(), which internally tries to compute a shortest path
between two identical nodes. This returns an empty path, which was
incorrectly treated as "no chain found," raising an exception even
though the group is valid.

Fix

Added a check in get_link_names(): if the base link and end-effector
link are the same, the function returns that single link's name
directly, without going through the chain-finding logic.

Testing

Added a test case in test_get_link_names using the endeffector
group on the ur10e_gripper_one_beam fixture, which has a single link
and zero configurable joints — reproducing the original bug scenario.
Verified the fix with:

  • invoke test --doctest
  • invoke testcodeblocks

Both show the same pre-existing, unrelated baseline failures as before
this change (documented in issue discussion/PR comments if needed),
with no new failures introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Robot's get_link_names throws exception for group with one link

1 participant