24 from openravepy
import *
50 gmodel = databases.grasping.GraspingModel(robot=self.
robot,target=self.
target)
51 print 'check if model can be loaded'
53 print 'need to autogenerate model'
66 while not robot.GetController().IsDone():
82 self.
taskmanip = interfaces.TaskManipulation(self.
robot,graspername=gmodel.grasper.plannername)
86 target = gmodel.target
88 while istartgrasp < len(gmodel.grasps):
89 goals,graspindex,searchtime,trajdata = self.taskmanip.GraspPlanning(graspindices=gmodel.graspindices,grasps=gmodel.grasps[istartgrasp:],
90 target=target,approachoffset=approachoffset,destposes=dests,
91 seedgrasps = 3,seeddests=8,seedik=1,maxiter=1000,
92 randomgrasps=
True,randomdests=
True,outputtraj=
True,execute=
False)
93 istartgrasp = graspindex+1
96 Tglobalgrasp = gmodel.getGlobalGraspTransform(gmodel.grasps[graspindex],collisionfree=
True)
98 print 'grasp %d initial planning time: %f'%(graspindex,searchtime)
106 robot.ReleaseAllGrabbed()
118 def runGrasp(envId, robotName, targetName):
119 env = RaveGetEnvironment(envId)
120 robot = env.GetRobot(robotName)
121 target = env.GetKinBody(targetName)
125 print 'grasping object %s'%self.target.GetName()
127 self.robot.ReleaseAllGrabbed()
129 print 'success: ',success
131 except planning_error, e:
132 print 'failed to grasp object %s'%self.target.GetName()