Skip to content

Commit

Permalink
Fix clone_body bug when input links contains BASE_LINK
Browse files Browse the repository at this point in the history
  • Loading branch information
yijiangh committed Mar 11, 2022
1 parent dcf57ca commit 2ae3826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Unreleased
**Changed**

**Fixed**
* Fixed `clone_body` bug when input links contains `BASE_LINK`

**Deprecated**

Expand Down
6 changes: 5 additions & 1 deletion src/pybullet_planning/interfaces/robots/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def dump_world():
print()

def clone_body(body, links=None, collision=True, visual=True, client=None):
# ! links must be in a consecutive list of integers, so no input like `[link_2, link_4]`
from pybullet_planning.utils import get_client
# TODO: names are not retained
# TODO: error with createMultiBody link poses on PR2
Expand All @@ -161,8 +162,11 @@ def clone_body(body, links=None, collision=True, visual=True, client=None):
return new_body

client = get_client(client) # client is the new client for the body
if links is None or get_num_joints(body) == 0:
if links is None:
links = get_links(body)
if BASE_LINK in links:
# ! links should not include BASE_LINK, otherwise get_joint_info will fail
links.pop(links.index(BASE_LINK))
#movable_joints = [joint for joint in links if is_movable(body, joint)]
new_from_original = {}
base_link = get_link_parent(body, links[0]) if links else BASE_LINK
Expand Down

0 comments on commit 2ae3826

Please sign in to comment.