osrf/car_demo

joystick_translator

Closed this issue · 1 comments

Hi,

I was trying to get a joystick set up for this project and the project is set up outside of docker. The joystick_translator node would crush with index out of range.

[ERROR] [1506656598.132534, 1698.131000]: bad callback: <bound method Translator.callback of <__main__.Translator instance at 0x7ff6cb447ea8>> Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/febbo/catkin_ws/src/car_demo/car_demo/nodes/joystick_translator", line 43, in callback if message.axes[THROTTLE_AXIS] >= 0: IndexError: tuple index out of range

After examing with sudo jstest /dev/input/js0 and the rostopic /joy, I realize my joystick only outputs 3 axes. However, the index THROTTLE_AXIS is set to 4 in the source code. I notice someone else joystick's output also has only 3 axes #19.
I simply set THROTTLE_AXIS to 1 and it works for my joystick.

I'm not sure if the different number of axes ouptut by our joystick is because we set up the project outside of docker, we are using a different model of joystick or a bug in the code. So I just wanted to open an issue to help people who have similar problems.

I've documented this in #24 a more complete solution would be to switch to the standard teleoperation nodes like http://wiki.ros.org/teleop_twist_joy but we're not targeting development on this repo so that's not targeted for development. Though we'd be happy to review and merge a PR to that effect.