[ros-users] rospy.sleep() blocking callbacks
lazewad at go.wustl.edu
Wed Jul 7 15:07:35 UTC 2010
Running the click handler in a regular python thread seemed to do the
trick. Thanks for the help.
On Jul 7, 2010, at 1:02 AM, Geoffrey Biggs wrote:
> It's called the Global Interpreter Lock and it's what prevents Python
> executed using the standard interpreter from being truly concurrent
> (although it also massively simplified efficient interpreter
> However, a call to rospy.sleep() should be releasing this lock, and so
> shouldn't be locking up the entire interpreter. It depends on how that
> sleep call is implemented.
> To check if the GIL is the problem, try starting another thread and
> if it keeps executing during the rospy.sleep() call you're having
> problems with.
> On 07/07/10 14:47, Cedric Pradalier wrote:
>> On 07/07/2010 12:05 AM, Dan Lazewatsky wrote:
>>> I'm writing on a GUI in Python/Tk - I have a subscriber which is
>>> listening for image messages and setting a class member variable
>>> the newest image, and a GUI element that needs to use image (after
>>> sending a message to move a pan/tilt). On click I use
>>> rospy.sleep() to
>>> wait for the pan/tilt to settle down before using any images.
>>> I've noticed that once I call rospy.sleep() inside the click
>>> the callback for the image subscriber stops getting called. It was
>>> understanding that subscriber callbacks are run asynchronously in
>>> their own thread, so a sleep in a different thread should have no
>>> effect. What's going on here? What am I missing?
>>> ros-users mailing list
>>> ros-users at code.ros.org
>> Hi Dan,
>> Python is sometimes counter-intuitive with his management of threads,
>> leading sometimes to some global lock where one thread blocks
>> I'd suggest keeping your in-callback time to a minimum, maybe just
>> triggering another thread which will do the waiting (or switch to C+
>> with real threads).
> ros-users mailing list
> ros-users at code.ros.org
More information about the ros-users