Skip to content

Commit 2c1dbd4

Browse files
author
Michael Koval
committed
CBiRRT and OpenRAVERetimer now use CO_ActiveOnly
1 parent ac6ebc2 commit 2c1dbd4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/prpy/planning/cbirrt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ def PlanToTSR(self, robot, tsr_chains, smoothingitrs=100, **kw_args):
186186
def Plan(self, robot, smoothingitrs=None, timelimit=None, allowlimadj=0,
187187
jointstarts=None, jointgoals=None, psample=None, tsr_chains=None,
188188
extra_args=None, **kw_args):
189+
from openravepy import CollisionOptions, CollisionOptionsStateSaver
190+
189191
self.env.LoadProblem(self.problem, robot.GetName())
190192

191193
args = [ 'RunCBiRRT' ]
@@ -252,7 +254,10 @@ def Plan(self, robot, smoothingitrs=None, timelimit=None, allowlimadj=0,
252254
args += [ 'filename', traj_path ]
253255
args_str = ' '.join(args)
254256

255-
response = self.problem.SendCommand(args_str, True)
257+
with CollisionOptionsStateSaver(self.env.GetCollisionChecker(),
258+
CollisionOptions.ActiveDOFs):
259+
response = self.problem.SendCommand(args_str, True)
260+
256261
if not response.strip().startswith('1'):
257262
raise PlanningError('Unknown error: ' + response)
258263

@@ -287,4 +292,4 @@ def serialize_dof_values(dof_values):
287292
return [ str(len(dof_values)),
288293
' '.join([ str(x) for x in dof_values]) ]
289294

290-
295+

src/prpy/planning/retimer.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __str__(self):
5757
def RetimeTrajectory(self, robot, path, options=None, **kw_args):
5858
from ..util import (CreatePlannerParametersString, CopyTrajectory,
5959
SimplifyTrajectory, HasAffineDOFs)
60+
from openravepy import CollisionOptions, CollisionOptionsStateSaver
6061
from copy import deepcopy
6162
from openravepy import Planner
6263

@@ -94,10 +95,18 @@ def RetimeTrajectory(self, robot, path, options=None, **kw_args):
9495
# not perform this check internally (e.g. ParabolicTrajectoryRetimer).
9596
output_traj = SimplifyTrajectory(input_path, robot)
9697

98+
# Only collision check the active DOFs.
99+
dof_indices, _ = cspec.ExtractUsedIndices(robot)
100+
robot.SetActiveDOFs(dof_indices)
101+
97102
# Compute the timing. This happens in-place.
98103
output_traj = SimplifyTrajectory(input_path, robot)
99104
self.planner.InitPlan(None, params_str)
100-
status = self.planner.PlanPath(output_traj, releasegil=True)
105+
106+
107+
with CollisionOptionsStateSaver(self.env.GetCollisionChecker(),
108+
CollisionOptions.ActiveDOFs):
109+
status = self.planner.PlanPath(output_traj, releasegil=True)
101110

102111
if status not in [ PlannerStatus.HasSolution,
103112
PlannerStatus.InterruptedWithSolution ]:

0 commit comments

Comments
 (0)