[ros-users] handling multiple topics in Python

James Bowman jamesb at willowgarage.com
Thu Apr 15 16:53:50 UTC 2010


Yes, code would be nice.
I often use Python's Queue module

http://docs.python.org/library/queue.html

when doing this sort of thing, as well as the ROS message filters:

http://www.ros.org/doc/api/message_filters/html/python/

camera_calibration uses a message_filters.TimeSynchronizer to listen to left
and right camera topics.

On Thu, Apr 15, 2010 at 9:04 AM, Blaise Gassend <blaise at willowgarage.com>wrote:

> Hi Pat,
>
> You could have a look at the pr2_dashboard_aggregator. It has many
> inputs and a single output and needs no locking at all.
>
> We would have to see your code to get an idea of what is causing your
> specific problems.
>
> Blaise
>
> On Thu, 2010-04-15 at 00:31 -0700, Patrick Bouffard wrote:
> > Could anyone point out a good example using rospy of how to properly
> > listen to more than one subscribed topic (the inputs), as well as
> > publish one or more topics (the outputs) that are somehow dependent on
> > the inputs? In particular, one of the input topics is a joystick
> > message. I imagine this will involve threading, and I have made some
> > attempts using threading.Thread, with Events, Locks, etc., with
> > limited success.
> >
> > Some of the things I'm seeing include:
> > - the joystick apparently not sending messages for a few seconds at a
> > time (when it should be sending them at around 20 Hz),
> > - Ctrl+C not being caught (when run with roslaunch, it eventually has
> > to escalate to SIGKILL every time which I think means that I'm doing
> > something wrong),
> > - Locks and Events not behaving as they should (at least as far as I
> > understand them; I've done very little threaded Python before)
> >
> > A good example of the Right Way would be very helpful, or even just
> > some general advice.
> >
> > Thanks,
> > Pat
> > _______________________________________________
> > ros-users mailing list
> > ros-users at code.ros.org
> > https://code.ros.org/mailman/listinfo/ros-users
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100415/b87295f3/attachment-0003.html>


More information about the ros-users mailing list