Skip to content

Commit 23057b3

Browse files
committed
Merge pull request #240 from personalrobotics/bugfix/greedy_ik_exceptions
Added missing robot state saver to GreedyIK.
2 parents 82c0fa5 + adfc664 commit 23057b3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/prpy/planning/workspace.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def PlanWorkspacePath(self, robot, traj, timelimit=5.0,
161161
JointLimitError)
162162
from openravepy import CollisionReport
163163
from numpy import linalg as LA
164-
164+
p = openravepy.KinBody.SaveParameters
165165

166166
with robot:
167167
manip = robot.GetActiveManipulator()
@@ -214,14 +214,15 @@ def PlanWorkspacePath(self, robot, traj, timelimit=5.0,
214214
)
215215

216216
# update collision_error to contain collision info.
217-
for q in ik_solutions:
218-
robot.SetActiveDOFValues(q)
219-
report = CollisionReport()
220-
if self.env.CheckCollision(robot, report=report):
221-
collision_error = CollisionPlanningError.FromReport(report)
222-
elif robot.CheckSelfCollision(report=report):
223-
collision_error = SelfCollisionPlanningError.FromReport(report)
224-
217+
with robot.CreateRobotStateSaver(p.LinkTransformation):
218+
for q in ik_solutions:
219+
robot.SetActiveDOFValues(q)
220+
report = CollisionReport()
221+
if self.env.CheckCollision(robot, report=report):
222+
collision_error = CollisionPlanningError.FromReport(report)
223+
elif robot.CheckSelfCollision(report=report):
224+
collision_error = SelfCollisionPlanningError.FromReport(report)
225+
225226
# Check if the step was within joint DOF resolution.
226227
infeasible_step = True
227228
if qnew is not None:

0 commit comments

Comments
 (0)