[ros-users] handling multiple topics in Python

Patrick Bouffard patrick.m.bouffard at gmail.com
Thu Apr 15 07:31:17 UTC 2010

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.


More information about the ros-users mailing list