Skip to content

Robot control with Joystick

Ramviyas Parasuraman edited this page Feb 22, 2018 · 1 revision

Optional extension - iRobot Remote control using Joystick (Gamepad)

One can also use a joystick (e.g. Logitech Wireless Gamepad F710) to control the robot remotely. We provide a brief tutorial to inspire our readers.

Brief Introduction to Joystick

In this project, we could use Microsoft Xbox 360 Wireless Controller for Linux. Table of index number of /joy.buttons:

Index Button name on the actual controller
0 A
1 B
2 X
3 Y
4 LB
5 RB
6 back
7 start
8 power
9 Button stick left
10 Button stick right

Table of index number of /joy.axis:
Index Axis name on the actual controller
0 Left/Right Axis stick left
1 Up/Down Axis stick left
2 Left/Right Axis stick right
3 Up/Down Axis stick right
4 RT
5 LT
6 cross key left/right
7 cross key up/down

Or we can use joystick Logitech Gamepad F710, https://www.roscomponents.com/en/joysticks/171-logitech-gamepad-f710.html.

Joystick Driver Installation

Installing the joystick driver

  1. Start by installing the package

    $ sudo apt-get install ros-indigo-joy ros-indigo-teleop-twist-joy ros-indigo-teleop-tools-msgs
  2. Configuring the Joystick and make sure that the joystick is recognized by Linux working.

    $ ls /dev/input/
    $ sudo jstest /dev/input/jsX 

    If the joystick device is not configured properly and you need to

    $ sudo chmod a+rw /dev/input/jsX

Starting the Joy Node

  1. In this section we use ros-indigo-joy package. Assume the joystick driver has been isntalled, to get the joystick data published over ROS we need to start the joy node. First let's tell the joy node which joystick device to use- the default is js0.

    $ roscore
    $ rosparam set joy_node/dev "/dev/input/jsX" 
  2. Configuring the Joystick and make sure that the joystick is working.

    $ ls /dev/input/
    $ sudo jstest /dev/input/jsX 

    Now we can start the joy node

    $ rosrun joy joy_node
  3. In a new terminal you can rostopic echo the joy topic to see the data from the joystick

    $ rostopic echo joy 
  4. Then run the teleop_twist_joy node from teleop_twist_joy package with command configurations. We recommend the following launch file which launches both joy node and teleop node with right configurations.

     $ roslaunch teleop_twist_joy teleop.launch