shared_ptr error

classic Classic list List threaded Threaded
2 messages Options
ais
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

shared_ptr error

ais
Hi all,

I implemented the following simple code that repeatedly plans grasping poses.

*********************************
from numpy import *
import sys
import time
import math
from openravepy import *

def input_mug(env):
        body=env.ReadKinBodyXMLFile(filename='data/mug1.kinbody.xml')
        env.AddKinBody(body)
        body.SetTransform(eye(4))
        tran=body.GetTransform()
        xdeg=90
        rot_mat = rotationMatrixFromAxisAngle([1,0,0],float(xdeg)*pi/180.0)
        print 'AxisAngle = ',axisAngleFromRotationMatrix(rot_mat)
        tran[0:3,0:3] = dot(rot_mat, tran[0:3,0:3])
        tran[2,3]=0.001
        body.SetTransform(tran)
        return body

def repeat_plan(env,robot):
    mug=input_mug(env)
    robot.SetActiveManipulator('leftarm_torso')
    #
    ikmodel = databases.inversekinematics.InverseKinematicsModel(robot,iktype=IkParameterization.Type.Transform6D)
    if not ikmodel.load():
        ikmodel.autogenerate()
    #
    gmodel=databases.grasping.GraspingModel(robot=robot,target=mug)
    if not gmodel.load():
        gmodel.autogenerate()
    #
    validgrasps,validindices=gmodel.computeValidGrasps()
    validgrasp=validgrasps[0]
    matrices = [gmodel.getGlobalGraspTransform(validgrasp,collisionfree=True)]
    #
    gmodel.setPreshape(validgrasp)
    for i in range(10000):
        manipprob = interfaces.BaseManipulation(robot)
        print i
        try:
            traj=manipprob.MoveToHandPosition(matrices=matrices,outputtrajobj=True,execute=False)
            robot.WaitForController(0)
        except planning_error,e:
            print "try again: ",e

def run():
    env=Environment()
    env.SetViewer('qtcoin')
    env.Load('data/hironxtable.env.xml')
    robot = env.GetRobots()[0]
    return env,robot

if __name__=="__main__":
    env,robot=run()
**************************************

However, when the number of calculation was greater than 121,
the following error occurred at MoveToHandPosition().

**************************************
/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
**************************************

Does anyone know how to avoid the error?
The version of openrave is 0.8.2, linux distribution is ubuntu 12.04 (64bit).
One thing I found was that the amount of memory kept on slightly increasing
while running the above program.


Thanks,

Kimitoshi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: shared_ptr error

Bahram Maleki-Fard
Hi,

I'm not sure about the error, but I recommend trying the current version in the "master" branch first, the problem might have already been fixed.
The increased memory for example has already been reported (https://github.com/rdiankov/openrave/issues/322) and fixed (commits 0b0c5dba3126ba9ea635cf87435a6124e94c8d29 and 44df169fe0cc20a6e4710d23847beccfa6d878a1). At least I guess it's related to that issue :)

Cheers,
Bahram

2014/12/18 09:47 , ais [hidden email]:
Hi all,

I implemented the following simple code that repeatedly plans grasping poses.

*********************************
from numpy import *
import sys
import time
import math
from openravepy import *

def input_mug(env):
        body=env.ReadKinBodyXMLFile(filename='data/mug1.kinbody.xml')
        env.AddKinBody(body)
        body.SetTransform(eye(4))
        tran=body.GetTransform()
        xdeg=90
        rot_mat = rotationMatrixFromAxisAngle([1,0,0],float(xdeg)*pi/180.0)
        print 'AxisAngle = ',axisAngleFromRotationMatrix(rot_mat)
        tran[0:3,0:3] = dot(rot_mat, tran[0:3,0:3])
        tran[2,3]=0.001
        body.SetTransform(tran)
        return body

def repeat_plan(env,robot):
    mug=input_mug(env)
    robot.SetActiveManipulator('leftarm_torso')
    #
    ikmodel = databases.inversekinematics.InverseKinematicsModel(robot,iktype=IkParameterization.Type.Transform6D)
    if not ikmodel.load():
        ikmodel.autogenerate()
    #
    gmodel=databases.grasping.GraspingModel(robot=robot,target=mug)
    if not gmodel.load():
        gmodel.autogenerate()
    #
    validgrasps,validindices=gmodel.computeValidGrasps()
    validgrasp=validgrasps[0]
    matrices = [gmodel.getGlobalGraspTransform(validgrasp,collisionfree=True)]
    #
    gmodel.setPreshape(validgrasp)
    for i in range(10000):
        manipprob = interfaces.BaseManipulation(robot)
        print i
        try:
            traj=manipprob.MoveToHandPosition(matrices=matrices,outputtrajobj=True,execute=False)
            robot.WaitForController(0)
        except planning_error,e:
            print "try again: ",e

def run():
    env=Environment()
    env.SetViewer('qtcoin')
    env.Load('data/hironxtable.env.xml')
    robot = env.GetRobots()[0]
    return env,robot

if __name__=="__main__":
    env,robot=run()
**************************************

However, when the number of calculation was greater than 121,
the following error occurred at MoveToHandPosition().

**************************************
/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
**************************************

Does anyone know how to avoid the error?
The version of openrave is 0.8.2, linux distribution is ubuntu 12.04 (64bit).
One thing I found was that the amount of memory kept on slightly increasing
while running the above program.


Thanks,

Kimitoshi


View this message in context: shared_ptr error
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk


_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Loading...