Quantcast

Python crash in 0.8.2 when calling with viewer from ROS service

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

Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
Hi everyone,

The following code is a ROS service callback that crashes at the last line. The Plan method makes a call to a planner function (the behavior is consistent with either 'birrt' or 'cbirrt'). The same code does not crash when it is called without ROS.

When the viewer is off or when the Plan method does not include a call to a planner (only setting the robot DoFs and performing IK), it works fine.

The crash always happens after the last key stroke.

The backtrace is joined after the code. Do you have an idea?

Thanks very much for you time.

-------------------------------------------------
-------------------------------------------------
CODE
-------------------------------------------------
-------------------------------------------------

    # Calls the planner to generate plans
    def PlanRequestHandler( self, req ):

        res = PlannerResponse()

        self.planner.ResetEnviroment()
        self.planner.LaunchViewer()

        for act in req.Request.Actions :

            print "******************************"
            print "PLANNING ACTION : " + str(act.ActionType) + " with objects : ",
            print act.Objects
            error_code = self.planner.Plan( act.ActionType, act.Objects )

            if error_code == "ERROR in PLANNING" :
                break      

        # self.planner.pr2_planning.ResetEnv()
        # self.planner.pr2_planning.KillOpenrave()

        res.header = Header()
        res.header.stamp = rospy.Time.now()

        res.Attributes = deepcopy( self.planner.attributes )
       
        print res

        print "Press return to exit."
        sys.stdin.readline()

        return res

-------------------------------------------------
-------------------------------------------------
TRACE
-------------------------------------------------
-------------------------------------------------

[cbirrtproblem.cpp:843] Setting default init config to current config
[cbirrt.cpp:260] numdofs: 14
[cbirrt.cpp:305] grabbed: 0
[GeneralIK.cpp:58] Initializing GeneralIK Solver
[cbirrt.cpp:314] Psample: 0.000000
[cbirrt.cpp:392] Checking for start projection...
[cbirrt.cpp:427] Start Node(s) Created
[cbirrt.cpp:747] Planning time: 0.200418s
[cbirrt.cpp:1184] Smoothing...
[cbirrt.cpp:1241] Done
RunCBiRRT answer:  1
end planning
traj call answer:  1
Press return to exit.

Start
Unhang0
header:
  seq: 0
  stamp:
    secs: 1294
    nsecs: 780000000
  frame_id: ''
Attributes:
  -
    Label:
      sourceAction: Start
      targetAction: Unhang0
      version: 0
      debug: 0
    Reliability: 1.0
    Duration:
      secs: 1
      nsecs: 0
Press return to exit.
[Thread 0x7fff8efc5700 (LWP 31601) exited]


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb3b7c700 (LWP 31596)]
0x00007fffc23af36f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007fffc23af36f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007fffc23af680 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff7bc4c83 in __nptl_deallocate_tsd () at pthread_create.c:156
#3  0x00007ffff7bc4ea8 in start_thread (arg=0x7fffb3b7c700) at pthread_create.c:315
#4  0x00007ffff699e3fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()
(gdb)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python crash in 0.8.2 when calling with viewer from ROS service

Rosen Diankov
Administrator
are you locking the environment using "with env"?


2014-04-11 6:56 GMT+09:00 jmainpri <[hidden email]>:
Hi everyone,

The following code is a ROS service callback that crashes at the last line.
The Plan method makes a call to a planner function (the behavior is
consistent with either 'birrt' or 'cbirrt'). The same code does not crash
when it is called without ROS.

When the viewer is off or when the Plan method does not include a call to a
planner (only setting the robot DoFs and performing IK), it works fine.

The crash always happens after the last key stroke.

The backtrace is joined after the code. Do you have an idea?

Thanks very much for you time.

-------------------------------------------------
-------------------------------------------------
CODE
-------------------------------------------------
-------------------------------------------------

    # Calls the planner to generate plans
    def PlanRequestHandler( self, req ):

        res = PlannerResponse()

        self.planner.ResetEnviroment()
        self.planner.LaunchViewer()

        for act in req.Request.Actions :

            print "******************************"
            print "PLANNING ACTION : " + str(act.ActionType) + " with
objects : ",
            print act.Objects
            error_code = self.planner.Plan( act.ActionType, act.Objects )

            if error_code == "ERROR in PLANNING" :
                break

        # self.planner.pr2_planning.ResetEnv()
        # self.planner.pr2_planning.KillOpenrave()

        res.header = Header()
        res.header.stamp = rospy.Time.now()

        res.Attributes = deepcopy( self.planner.attributes )

        print res

        print "Press return to exit."
        sys.stdin.readline()

        return res

-------------------------------------------------
-------------------------------------------------
TRACE
-------------------------------------------------
-------------------------------------------------

[cbirrtproblem.cpp:843] Setting default init config to current config
[cbirrt.cpp:260] numdofs: 14
[cbirrt.cpp:305] grabbed: 0
[GeneralIK.cpp:58] Initializing GeneralIK Solver
[cbirrt.cpp:314] Psample: 0.000000
[cbirrt.cpp:392] Checking for start projection...
[cbirrt.cpp:427] Start Node(s) Created
[cbirrt.cpp:747] Planning time: 0.200418s
[cbirrt.cpp:1184] Smoothing...
[cbirrt.cpp:1241] Done
RunCBiRRT answer:  1
end planning
traj call answer:  1
Press return to exit.

Start
Unhang0
header:
  seq: 0
  stamp:
    secs: 1294
    nsecs: 780000000
  frame_id: ''
Attributes:
  -
    Label:
      sourceAction: Start
      targetAction: Unhang0
      version: 0
      debug: 0
    Reliability: 1.0
    Duration:
      secs: 1
      nsecs: 0
Press return to exit.
[Thread 0x7fff8efc5700 (LWP 31601) exited]


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb3b7c700 (LWP 31596)]
0x00007fffc23af36f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007fffc23af36f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007fffc23af680 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff7bc4c83 in __nptl_deallocate_tsd () at pthread_create.c:156
#3  0x00007ffff7bc4ea8 in start_thread (arg=0x7fffb3b7c700) at
pthread_create.c:315
#4  0x00007ffff699e3fd in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()
(gdb)




--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/Python-crash-in-0-8-2-when-calling-with-viewer-from-ROS-service-tp4026955.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
I have but it does not solve the issue...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
This post was updated on .
I have taken everything out of my code and still have that problem. However, I found that it seems to only happen with the pr2 robot models...

robots/pr2-beta-static.zae
robots/willowgarage-pr2.zae
etc.

and not with simple robot arms models.

I would like to try with a simpler kinematic model of the pr2 (that does not include sensor models) but could not find one.

This issue only happens if I make a call to a planner and it seems to be thread related. I am thinking that when using the pr2 model the sensor simulation spawns a new thread when planning.

I guess the next step is to compile OpenRAVE from source with debug options to get a better backtrace. I have no other idea...

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

Re: Python crash in 0.8.2 when calling with viewer from ROS service

Rosen Diankov
Administrator
i have my suspicious that it is COLLADA related. can you try the packages in the openrave/testing PPA? Or even better compile from the master branch sources.

best,



2014-05-27 11:29 GMT+09:00 jmainpri <[hidden email]>:
I have taken everything out of my code and still have that problem. However,
I found that it seems to only happen with the pr2 robot models...

robots/pr2-beta-static.zae
robots/willowgarage-pr2.zae
etc.

and not with very simple robot arms models.

I would like to try it with a kinematic pr2 robot model (that does not
include sensor models) but could not find one.

This issue only happens if I make a call to a planner and it seems to be a
thread related. I am thinking that when using the pr2 model the sensor
simulation spawns new a thread in the planners.

I guess the next step is to compile OpenRAVE from source with debug options
to get a better backtrace. I have no other idea...

-- Jim



--
View this message in context: http://openrave-users-list.185357.n3.nabble.com/Python-crash-in-0-8-2-when-calling-with-viewer-from-ROS-service-tp4026955p4026997.html
Sent from the OpenRAVE Users List mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users


------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
This post was updated on .
Thanks again for the quick reply.

I am compiling commit :

commit 1cf37102dc5e9cf2a8da6c325664d4a8ddf4e269
Author: rdiankov <rosen.diankov@gmail.com>
Date:   Fri May 9 18:43:43 2014 +0900
add GetMilliTime64

From the master branch of the github repository. Is there a particular version of assimp I should use?

with version 3.0.1270 it fails (BTW on Ubuntu 12.04, ROS and OpenRAVE use two different assimp packages identifiers, so that you need to install ROS first and then OpenRAVE).

Best,

[ 42%] Building CXX object src/libopenrave-core/CMakeFiles/libopenrave-core.dir/xmlreaders-core.cpp.o
/home/jmainpri/workspace/openrave/src/libopenrave-core/xmlreaders-core.cpp: In function ‘void OpenRAVEXMLParser::__SetAssimpLog()’:
/home/jmainpri/workspace/openrave/src/libopenrave-core/xmlreaders-core.cpp:98:35: error: ‘DEBUGGING’ is not a member of ‘Assimp::Logger’
/home/jmainpri/workspace/openrave/src/libopenrave-core/xmlreaders-core.cpp:98:53: error: ‘INFO’ is not a member of ‘Assimp::Logger’
/home/jmainpri/workspace/openrave/src/libopenrave-core/xmlreaders-core.cpp:98:66: error: ‘WARN’ is not a member of ‘Assimp::Logger’
/home/jmainpri/workspace/openrave/src/libopenrave-core/xmlreaders-core.cpp:98:79: error: ‘ERR’ is not a member of ‘Assimp::Logger’

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

Re: Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
Hi Rosen,

Just managed to install the master branch (0.9.0) and it works fine with this one.
However my plugins do not work with this version...
Do you think I could find an older version which would contain the fix but still be compatible with plugins developed for 0.8.2?

I linked with version 2.0.863 of assimp btw, it is the one shipped with Ubuntu 12.04.

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

Re: Python crash in 0.8.2 when calling with viewer from ROS service

jmainpri
This post was updated on .
Hi Rosen,

We found a workaround that works with 0.8.

It seams that with the pr2 model, planners can not be called from another thread than the one in which the environment was created without crashing when the new thread ends.

So the workaround consists of waiting in the main thread for the service call.

Best,

Here is an example code:

#-------------------------------------------------------------------------------

class PlannerInterface:

    def __init__(self):

        self.execute = False
        self.planner = Pr2OpenRaveTestPlanner()

        rospy.loginfo("Starting attributive planner interface...")
        self.service = rospy.Service("heres_how_planner/PlanningQuery", AttributivePlan, self.PlanRequestHandler)
        rospy.loginfo("Service host loaded, motion-planner interface running")
        self.WaitForCall()

    # Waits for service call to start rrt planner
    def WaitForCall(self):

        while True:
            time.sleep(.1)
            if self.execute:
                self.planner.TestFunction()
                self.execute = False

    # Callback from service
    def PlanRequestHandler(self, req):

        print "starting planner request"

        self.execute = True

        while self.execute:
            time.sleep(.1)

        res = PlannerResponse()
        res.header = Header()
        res.header.stamp = rospy.Time.now()

        print "return response", res.header.stamp
        return res

#-------------------------------------------------------------------------------

if __name__ == '__main__':

    rospy.init_node("heres_how_planner_interface")
    planner = PlannerInterface()

    print "Robot ready to plan, waiting for a request..."
    rospy.spin()
Loading...