[ros-users] handling multiple topics in Python

Patrick Bouffard patrick.m.bouffard at gmail.com
Fri Apr 16 05:49:18 UTC 2010


Hi Blaise,

Usually I would start it from a launch file, with:

        <param name="joy_node/dev" value="/dev/input/js0" type="str" />
        <param name="joy_node/autorepeat_rate" value="20" type="double" />
        <node pkg="joy" name="joy_node" type="joy_node" />

.. however for most of the troubleshooting I was just starting it by
hand, with something like

rosparam set joy_node/autorepeat_rate 20
rosrun joy joy_node


Pat

On Thu, Apr 15, 2010 at 9:34 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
> Patrick,
>
> Can you copy and paste the exact line you were using to run it?
>
> Thanks,
> Blaise
>
> On Thu, 2010-04-15 at 20:56 -0700, Patrick Bouffard wrote:
>> Hi Blaise,
>>
>> I had autorepeat_rate set to various values, usually between 20 and 80
>> (I really only need something closer to 20 but was experimenting to
>> see if that would help the issues). Also dev was set to
>> /dev/input/js0.
>>
>> Cheers,
>> Pat
>>
>> On Thu, Apr 15, 2010 at 8:35 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
>> > Hi Patrick,
>> >
>> > Adding a timestamp to the joy message seems like a good idea, which I
>> > have ticketed myself to add in a future version of joystick_drivers.
>> > However, adding it just to your own node will make it unable to work
>> > with any of the other nodes that use joysticks which is unfortunate...
>> >
>> > Could you send me the parameters you were using with joy_node? In
>> > particular, I want to know if you have it set to autorepeat.
>> >
>> > Thanks,
>> > Blaise
>> >
>> > On Thu, 2010-04-15 at 19:48 -0700, Patrick Bouffard wrote:
>> >> Hi Blaise,
>> >>
>> >> It seems to be difficult to reproduce. I tried your command and let it
>> >> run for several minutes and it didn't crop up. Then I tried without -w
>> >> 10 and it happened almost immediately. Then I tried both ways (with
>> >> and without -w 10) a number of times and didn't see it again. Perhaps
>> >> it's a hardware issue? Then again, if it is, it doesn't affect my own
>> >> pygame based node, or at least it hasn't so far.
>> >>
>> >> The joystick is a Logitech Extreme3D Pro. If you have any other
>> >> suggestions for troubleshooting let me know, but I'm fine with using
>> >> the Python node, and actually prefer it as it's easier to tweak (for
>> >> example, I added a timestamp to the message). I'm happy to contribute
>> >> that code if anyone is interested.
>> >>
>> >> Cheers,
>> >> Pat
>> >>
>> >> On Thu, Apr 15, 2010 at 7:26 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
>> >> > Can you redo the rostopic hz like this:
>> >> > rostopic hz /joy -w 10
>> >> >
>> >> > It will make the results easier to interpret.
>> >> >
>> >> > Could you also let me know what kind of joystick you are using, and how
>> >> > exactly you are running the joy_node (exact command line arguments or
>> >> > launch file). Have you also verified whether the node is outputting any
>> >> > messages?
>> >> >
>> >> > Failure to repeat is an annoyance for any users of the node so I want to
>> >> > track this one down (it also seems like a better option than having you
>> >> > write your own node).
>> >> >
>> >> > Thanks,
>> >> > Blaise
>> >> >
>> >> > On Thu, 2010-04-15 at 16:55 -0700, Patrick Bouffard wrote:
>> >> >> I was just now in the process of doing that.. The biggest I've seen is
>> >> >> about 3 seconds. They tend to be relatively infrequent but frequent
>> >> >> enough that they will be troublesome for my application. Here's an
>> >> >> example output, this is with autorepeat_rate set to 5 Hz:
>> >> >> http://pastebin.org/152943
>> >> >>
>> >> >> I may take a quick try at writing a pure python node for the joystick
>> >> >> using pygame as I'm familiar with that and had no issues with it using
>> >> >> the same hardware. I'll let everyone know how that goes.
>> >> >>
>> >> >> Pat
>> >> >>
>> >> >> On Thu, Apr 15, 2010 at 4:43 PM, Blaise Gassend <blaise at willowgarage.com> wrote:
>> >> >> > Try rostopic hz or rostopic echo to see if you are getting any gaps on
>> >> >> > the /joy topic. How big are the gaps you are seeing?
>> >> >> >
>> >> >> > On Thu, 2010-04-15 at 12:12 -0700, Patrick Bouffard wrote:
>> >> >> >> Thanks all for the responses, that gives me a few things to try.
>> >> >> >>
>> >> >> >> Regarding the joystick: I'm using joy_node from the joy package, and
>> >> >> >> setting the autorepeat_rate parameter, so I should be getting a steady
>> >> >> >> stream of joy messages, which I mostly do but sometimes there is a
>> >> >> >> long gap. My suspicion is that it's my code that is to blame for that
>> >> >> >> though.
>> >> >> >>
>> >> >> >> I'll hack on this a bit more and report back..
>> >> >> >>
>> >> >> >> Cheers,
>> >> >> >> Pat
>> >> >> >>
>> >> >> >> On Thu, Apr 15, 2010 at 10:59 AM, Blaise Gassend
>> >> >> >> <blaise at willowgarage.com> wrote:
>> >> >> >> >> Rospy replaces the signal handler for SIGINT.  A running loop in your
>> >> >> >> >> main thread will no longer be interrupted with a KeyboardInterrupt.
>> >> >> >> >> Instead you should check rospy.is_shutdown() as a condition of your
>> >> >> >> >> loop.
>> >> >> >> >
>> >> >> >> > Also, if you are using threads, SIGINT will only kill one of them even
>> >> >> >> > without rospy. You have to make sure that each thread exits after a
>> >> >> >> > KeyboardInterrupt (or after rospy.is_shutdown() goes true in the case of
>> >> >> >> > rospy).
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > _______________________________________________
>> >> >> >> > 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
>> >> >> >
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > 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
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > 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
>> >
>> >
>> > _______________________________________________
>> > 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
>
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list