diff --git a/AUTHORS.md b/AUTHORS.md index 29b1952b6..932f754c1 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -17,3 +17,4 @@ - Edvard Bruun <> [@ebruun](https://github.com/ebruun) - Victor Pok Yin Leung <> [@yck011522](https://github.com/yck011522) - Begüm Saral <> [@begums](https://github.com/begums) +- Swastik Verma <> [@Swastik-Verma](https://github.com/Swastik-Verma) \ No newline at end of file diff --git a/src/compas_fab/robots/robot_cell.py b/src/compas_fab/robots/robot_cell.py index 353c8fdae..0c08adfc6 100644 --- a/src/compas_fab/robots/robot_cell.py +++ b/src/compas_fab/robots/robot_cell.py @@ -450,8 +450,11 @@ def get_link_names(self, group: Optional[str] = None) -> list[str]: base_link_name = self.get_base_link_name(group) end_effector_link_name = self.get_end_effector_link_name(group) link_names = [] - for link in self.robot_model.iter_link_chain(base_link_name, end_effector_link_name): - link_names.append(link.name) + if base_link_name is not None and base_link_name == end_effector_link_name: + link_names.append(base_link_name) + else: + for link in self.robot_model.iter_link_chain(base_link_name, end_effector_link_name): + link_names.append(link.name) return link_names def get_link_names_with_collision_geometry(self) -> list[str]: diff --git a/tests/robots/test_robot_cell.py b/tests/robots/test_robot_cell.py index ede6b11e0..e585ea7ca 100644 --- a/tests/robots/test_robot_cell.py +++ b/tests/robots/test_robot_cell.py @@ -178,6 +178,9 @@ def _test(rc: RobotCell, rcs: RobotCellState): _test(*rfl) _test(*ur10e_gripper_one_beam) _test(*abb_irb4600_40_255_gripper_one_beam) + robot_cell, robot_cell_state = ur10e_gripper_one_beam + link_names = robot_cell.get_link_names("endeffector") + assert link_names == ["tool0"] def test_default_touch_links_returns_first_geometry_bearing_link():