def __init__(self,robot,collider=None): AdaptiveCSpace.__init__(self) self.robot = robot self.bound = zip(*robot.getJointLimits()) self.collider = collider #set this to false to turn off the adaptive tester, which may #have some overhead self.adaptive = True #adaptive tests self.addFeasibleTest(lambda(x): self.inJointLimits(x),"joint limits") #TODO explode these into individual self collision / env collision #tests self.addFeasibleTest(lambda(x): not self.selfCollision(),"self collision") self.addFeasibleTest(lambda(x): not self.envCollision(),"env collision")
def __init__(self, robot, collider=None): AdaptiveCSpace.__init__(self) self.robot = robot self.bound = zip(*robot.getJointLimits()) self.collider = collider #set this to false to turn off the adaptive tester, which may #have some overhead self.adaptive = True #adaptive tests self.addFeasibleTest(lambda (x): self.inJointLimits(x), "joint limits") #TODO explode these into individual self collision / env collision #tests self.addFeasibleTest(lambda (x): not self.selfCollision(), "self collision") self.addFeasibleTest(lambda (x): not self.envCollision(), "env collision")
def feasible(self, x): if self.adaptive: #Use the adaptive tester robot.setConfig(x) return AdaptiveCSpace.feasible(self, x) if not self.inJointLimits(x): return False robot.setConfig(x) if not self.closedLoop(): return False if self.selfCollision(): return False if self.envCollision(): return False return True
def feasible(self,x): if self.adaptive: #Use the adaptive tester robot.setConfig(x) return AdaptiveCSpace.feasible(self,x) if not self.inJointLimits(x): return False robot.setConfig(x) if not self.closedLoop(): return False; if self.selfCollision(): return False if self.envCollision(): return False return True
def feasible(self, x): if self.adaptive: #Use the adaptive tester self.robot.setConfig(x) return AdaptiveCSpace.feasible(self, x) #Use the regular tester if not self.inJointLimits(x): return False #check collisions if self.collider: self.robot.setConfig(x) if self.selfCollision(): return False if self.envCollision(): return False return True
def feasible(self,x): if self.adaptive: #Use the adaptive tester self.robot.setConfig(x) return AdaptiveCSpace.feasible(self,x) #Use the regular tester if not self.inJointLimits(x): return False #check collisions if self.collider: self.robot.setConfig(x) if self.selfCollision(): return False if self.envCollision(): return False return True
def feasible(self,x): """Feasibility test. If self.adaptive=True, uses the adaptive feasibility tester which may speed up collision testing.""" if self.adaptive: #Use the adaptive tester self.robot.setConfig(x) return AdaptiveCSpace.feasible(self,x) #Use the regular tester if not self.inJointLimits(x): return False #check collisions if self.collider: self.robot.setConfig(x) if self.selfCollision(): return False if self.envCollision(): return False return True
def sample(self): """Overload this to implement custom sampling strategies or to handle non-standard joints""" return AdaptiveCSpace.sample(self)