def __init__(self, env, scenename): self.env = env self.env.Reset() #self.env.StopSimulation() self.scenename = scenename self.env.Load(scenename) self.robot = self.env.GetRobots()[0] self.planning = graspplanning.GraspPlanning(self.robot, dests=[]) sceneprefix = os.path.split(self.scenename)[1] if sceneprefix.find('.') >= 0: sceneprefix = sceneprefix[0:sceneprefix.find('.')] self.dataprefix = self.getdataprefix(self.robot) + sceneprefix
def __init__(self, env, scenename): self.env = env self.env.Reset() self.env.StopSimulation() self.scenename = scenename self.env.Load(scenename) self.robot = self.env.GetRobots()[0] self.planning = graspplanning.GraspPlanning(self.robot, dests=[]) sceneprefix = os.path.split(self.scenename)[1] if sceneprefix.find('.') >= 0: sceneprefix = sceneprefix[0:sceneprefix.find('.')] self.dataprefix = self.getdataprefix(self.robot) + sceneprefix self.lsmodel = linkstatistics.LinkStatisticsModel(self.robot) if not self.lsmodel.load(): self.lsmodel.autogenerate()
def Plan(self): if self.Tgoal is None: raise ValueError('need to set goal with SetGoal()') print 'planning...' planner = graspplanning.GraspPlanning(self.robot, randomize=False, dests=None, nodestinations=True) for gmodel in self.gmodels: print 'grasping %s' % gmodel.target success = -1 while success < 0: success = planner.graspAndPlaceObject(gmodel, dests=[self.Tgoal], movehanddown=False)