ETHZ-RobotX / SuperMegaBot

Main repository of the SuperMegaBot
18 stars 19 forks source link

Error when launching simulation with driving through keyboard teleop #24

Closed sopje closed 1 year ago

sopje commented 2 years ago

I get the following error when launching the simulation with driving the robot through keyboard teleop:

 roslaunch smb_gazebo sim.launch launch_gazebo_gui:=true keyboard_teleop:=true

Error:

[ERROR] [1656339353.067498, 808.423000]: bad callback: <function joyCallback at 0x7fa121ef4430>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/sophiehebe/supermegabot_ws/src/core/smb_control/src/joy_e_stop_node.py", line 20, in joyCallback
    if joyMsg.buttons[2] == 1 and eStopHasBeenCalled == False:
IndexError: tuple index out of range

The issue is that in smb_control.launch, the arg name "joystick" is set to default true:

<arg name="joystick"                   default="true"/>

So setting this to false fixes the error. However, not a nice solution if you do want to work with the joystick as we cannot set this argument through launching of sim.launch. Better fix to add this argument setting in sim.launch.

Kind Regards,

Sophie

mantelt commented 2 years ago

Hi Sophie,

this error is somewhat surprising to be honest, since using a joystick/joypad for controlling the robot in simulation so far worked rather reliably for us. What kind of joypad/joystick are you using? Does this error appear directly when running the launch file or only when pressing a button?

Best regards, Thomas

daBaret commented 2 years ago

Hi Sophie, could you please show a screenshot if the output of the following command? ls /dev/input/ Thank you, Davide

sopje commented 2 years ago

Hi,

I found the problem. I have a js0, even though there is no joystick connected (some internal laptop joystick). I have set teleop.launch to find js1 instead of js0, this worked.