About MoveToHandPosition method

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

About MoveToHandPosition method

Yusuke
Hi,all.

I am new at using OpenRave, and I want some of trajecotry data. So, I repeated  the foiiowing program in while loop.
"robot" means hironx.

def planning(robot=robot,name="target"):
        gmodel=databases.grasping.GraspingModel(robot=robot,target=env.GetKinBody(name))
        if not gmodel.load():
            gmodel.autogenerate()

        validgrasps,validindices=gmodel.computeValidGrasps()
        if validgrasps==[]:
            return None
        trajs=[]
        for i in range(len(validgrasps)):
            validgrasp=validgrasps[i]
            print validgrasp
            try:
                gmodel.setPreshape(validgrasp)          #手を開いて目標物に近づくために必要らしい
                matrices = [gmodel.getGlobalGraspTransform(validgrasp,collisionfree=True)]
                print matrices
                traj=manipprob.MoveToHandPosition(matrices=matrices,outputtrajobj=True,execute=False)
                robot.WaitForController(0)
                robot.SetDOFValues(traj.GetWaypoint(-1)[0:7],array([ 0, 13, 14, 15, 16, 17, 18], dtype=int32))
                hand_position=robot.GetActiveManipulator().GetTransform()
                reset_pose()
                trajs.append([validindices[i],traj,hand_position])
            except planning_error,e:
                print "try again: ",e

        return trajs


then I got following error.


/usr/lib/python2.7/dist-packages/openravepy/_openravepy_/interfaces/BaseManipulation.py in MoveToHandPosition(self, matrices, affinedofs, maxiter, maxtries, translation, rotation, seedik, constraintfreedoms, constraintmatrix, constrainterrorthresh, execute, outputtraj, steplength, goalsamples, ikparam, ikparams, jitter, minimumgoalpaths, outputtrajobj, postprocessing, jittergoal, constrainttaskmatrix, constrainttaskpose, goalsampleprob, goalmaxsamples, goalmaxtries)
    186         if goalmaxtries is not None:
    187             cmd += 'goalmaxtries %d '%goalmaxtries
--> 188         res = self.prob.SendCommand(cmd)
    189         if res is None:
    190             raise planning_error('MoveToHandPosition')

openrave_exception: openrave (Assert): [/usr/include/boost/smart_ptr/shared_ptr.hpp:418] -> T* boost::shared_ptr<T>::operator->() const [with T = OpenRAVE::RobotBase], expr: px != 0


First, I thought something was wrong in my source. However, it seems that the error is occored by MoveToHandPosition method. Now I put appropriate values in "matrices", and I tried the next source code a few times.


for i in range(100):
    manipprob.MoveToHandPosition(matrices=matrices,outputtrajobj=True,execute=False)


There were times when this code ran normally.But, sometimes it caused the error which I mentioned above.
Why I fall into this situation !?

I would like to get some advice about this problems.
Thank you for your attention.


Yusuke
Loading...