ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

"Unknown joystick" exception for teleop in MoveIT

asked 2019-06-12 17:10:28 -0600

nu_panda gravatar image

updated 2019-06-12 18:05:11 -0600

jayess gravatar image

I'm trying to run the teleop mode from moveit

I have this running in one terminal:

roslaunch panda_moveit_config demo.launch

And this in the second one:

roslaunch panda_moveit_config joystick_control.launch dev:=/dev/input/js0

but I get this error:

[ERROR] [1560376798.477129]: bad callback: <bound method MoveitJoy.joyCB of <moveit_ros_visualization.moveitjoy_module.MoveitJoy instance at 0x7f998c14dcf8>>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/", line 750, in _invoke_callback
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_ros_visualization/", line 475, in joyCB
    raise Exception("Unknown joystick")
Exception: Unknown joystick

If I run jstsest /dev/input/js0, I get the correct output. And all my joystick drivers are up to date. I'm using a Sony PS3 controller, which should be supported. Any ideas?

edit retag flag offensive close merge delete


Just a note to make you aware of it: the joystick interface to moveit is not a regular "jogging" interface as you would know from industrial robots. The joystick only controls the interactive marker used for configuring the goal state, which is then turned into a planning request.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-13 01:18:11 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-09 07:15:15 -0600

Gates gravatar image

updated 2019-07-10 10:20:40 -0600

Probably you have some missing parameters in your launch file while you are running the joy node. Those parameters are introduced under <(!)-- Launch joy node --> comment. What you may fastly do here, just delete the whole node section and try this one instead:

<node pkg="joy" type="joy_node" name="ps3_joy" output="screen" >
  <param name="dev" type="string" value="/dev/input/js0" />
  <param name="deadzone" value="0.12" />

<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
  <!-- Load the file you made above -->
  <rosparam command="load" file="$(find ps3joy)/diagnostics.yaml" />

just be careful that you directed your joystick path in value="/dev/input/js0". - you already mentioned that works, though.

Edit for the class:

class PS3Status(JoyStatus):
    def __init__(self, msg):
        # creating from sensor_msgs/Joy
        if msg.buttons[0] == 1:
            self.cross = True
            self.cross = False
        if msg.buttons[1] == 1:
   = True
   = False
        if msg.buttons[2] == 1:
            self.triangle = True
            self.triangle = False
        if msg.buttons[3] == 1:
            self.square = True
            self.square = False
        if msg.buttons[4] == 1:
            self.L1 = True
            self.L1 = False
        if msg.buttons[5] == 1:
            self.R1 = True
            self.R1 = False
        if msg.buttons[6] == 1:
            self.L2 = True
            self.L2 = False
        if msg.buttons[7] == 1:
            self.R2 = True
            self.R2 = False
        if msg.buttons[8] == 1:
   = True
   = False
        if msg.buttons[9] == 1:
            self.start = True
            self.start = False
        if msg.buttons[10] == 1:
   = True
   = False
        self.left_analog_x = msg.axes[0]
        self.left_analog_y = msg.axes[1]
        self.right_analog_x = msg.axes[3]
        self.right_analog_y = msg.axes[4]

        self.orig_msg = msg

Also, do not forget to change in the if statement where the module decides which joystick is it:

#elif len(msg.axes) == 20 and len(msg.buttons) == 17: -- this goes
elif len(msg.axes) == 6 and len(msg.buttons) == 17: #and this comes!
edit flag offensive delete link more


Ok, another issue I faced about PS3 joysticks with I don't know why but the DUALSHOCK3 PS3 joystick has different type of message. That's why, when the module was checking the joystick type, it was comparing message lenght. In default, it was len(msg.axes) == 20 and len(msg.buttons) == 17: in the module however when I checked my message by rostopic echo /joy, I had only 6 elements in axes attibute.

Then I editted the PS3 Joystick class like I shared in the comment. Maybe it solves your problem, too.

Gates gravatar image Gates  ( 2019-07-10 10:17:22 -0600 )edit

Question Tools

1 follower


Asked: 2019-06-12 17:10:28 -0600

Seen: 792 times

Last updated: Jul 10 '19