"Unknown joystick" exception for teleop in MoveIT
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/topics.py", line 750, in _invoke_callback
cb(msg)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_ros_visualization/moveitjoy_module.py", 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?
Asked by nu_panda on 2019-06-12 17:10:28 UTC
Answers
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>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
<!-- Load the file you made above -->
<rosparam command="load" file="$(find ps3joy)/diagnostics.yaml" />
</node>
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):
JoyStatus.__init__(self)
# creating from sensor_msgs/Joy
if msg.buttons[0] == 1:
self.cross = True
else:
self.cross = False
if msg.buttons[1] == 1:
self.circle = True
else:
self.circle = False
if msg.buttons[2] == 1:
self.triangle = True
else:
self.triangle = False
if msg.buttons[3] == 1:
self.square = True
else:
self.square = False
if msg.buttons[4] == 1:
self.L1 = True
else:
self.L1 = False
if msg.buttons[5] == 1:
self.R1 = True
else:
self.R1 = False
if msg.buttons[6] == 1:
self.L2 = True
else:
self.L2 = False
if msg.buttons[7] == 1:
self.R2 = True
else:
self.R2 = False
if msg.buttons[8] == 1:
self.select = True
else:
self.select = False
if msg.buttons[9] == 1:
self.start = True
else:
self.start = False
if msg.buttons[10] == 1:
self.center = True
else:
self.center = 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!
Asked by Gates on 2019-07-09 07:13:26 UTC
Comments
Ok, another issue I faced about PS3 joysticks with moveitjoy_module.py. 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.
Asked by Gates on 2019-07-10 10:17:22 UTC
Comments
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.
Asked by gvdhoorn on 2019-06-13 01:18:11 UTC