Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bugfix for cloning grabbed objects. #51

Merged
merged 1 commit into from
Feb 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/prpy/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ def __init__(self, parent_env, clone_env=None, destroy_on_exit=None,
# PrPy-annotated classes.
setattr(self.clone_env, 'clone_parent', self.clone_parent)

# Due to a bug in the OpenRAVE clone API, we need to regrab
# objects in cloned environments because they might have
# incorrectly computed 'ignore' flags.
# TODO(pkv): Remove this block once OpenRAVE cloning is fixed.
for robot in self.clone_parent.GetRobots():
# Since the new ignore lists are computed from the current
# pose, calling RegrabAll() from a pose that is in
# SelfCollision may incorrectly ignore collisions.
if robot.CheckSelfCollision():
raise CloneException(
'Unable to compute self-collisions correctly. '
'Robot {:s} was cloned while in collision.'
.format(robot.GetName())
)
cloned_robot = self.clone_env.Cloned(robot)
with self.clone_env:
cloned_robot.RegrabAll()

def __enter__(self):
if self.lock:
self.clone_env.Lock()
Expand Down