dinsdag 7 april 2015

Use XBox controller with Turtlebot on ROS

Remote control (teleoperation) of the Turtlebot robot is very helpful. It is possible to use an XBox 360 controller for this purpose. This page will get you started. 

Software:
I used ROS Indigo.

Hardware:
Microsoft XBox 360 controller for Windows
(contains a Microsoft XBox 360 wireless receiver for Windows and a wireless controller)

Step 1: install hardware

  • Connect the USB adapter and switch on the XBox controller
  • Press the button on the adapter (light starts flashing)
  • Press, and keep pressed the connect button on the back of the XBox controller : it looks like O)))
  • Now the adapter and XBox controller are connected. Note that the lights on the XBox controller continue blinking.

to see all joystick devices connected run:
ls /dev/input/js* 

test which joystick it is connected to: in my case js0
sudo jstest /dev/input/js0

Make sure it is read/writeable for all:
sudo chmod a+rw /dev/input/js0


Step 2: basics on ROS
make sure ROS is running or start it via roscore

rosparam set joy_node/dev "/dev/input/js1"
rosrun joy joy_node

to see the response when you use the controller execute this statement in another terminal window
rostopic echo joy

Step 3: testing with turtlebot teleop
First bringup the turtlebot (on the turtlebot)
roslaunch turtlebot_bringup minimal.launch

Launch the joy node (on your workstation if you connected the adapter there)
rosparam set joy_node/dev "/dev/input/js0"
rosrun joy joy_node

Now start the teleop controls (on your workstation if you connected the adapter there)

rosparam set /joystick/dev "/dev/input/js0"
roslaunch turtlebot_teleop xbox360_teleop.launch

Important note: You need to press and hold the LB button on the XBox controller to use the joystick!

Note: I was expecting to need to install xboxdrv and joy but on my standard Indigo installation this was not needed.

Geen opmerkingen:

Een reactie posten