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

teleop turtlebot ps3 joystick

asked 2013-03-15 04:08:49 -0600

ZoltanS gravatar image

updated 2014-04-20 14:09:32 -0600

ngrennan gravatar image

Hi! I am trying to control my turtlebot 2 with a ps3 controller under Ubuntu 12.04 and groovy. I tried to follow the ROS turtlebot teleop tutorial. The first command didn't worked: roscd ps3joy/bin as there is no ps3joy/bin directory in my installation. Then, I tried an other tutorial "PairingJoystickAndBluetoothDongle" where the rosrun ps3joy ps3joy worked, and I could pair my controller with the computer. I checked the function of the joy with the following:

$ sudo jstest /dev/input/js1

It was working, but with js0 it didn't, it must be some other unknown device. Now I am trying to control the turtlebot with:

roslaunch turtlebot_teleop ps3_teleop.launch

Unfortunately, it generates some error written in red on the console saying the process has died:

turtlebot@turtlebot-laptop:~$ roslaunch turtlebot_teleop ps3_teleop.launch 
... logging to /home/turtlebot/.ros/log/2f70c202-8fb4-11e2-9551-00216a48015a/roslaunch-turtlebot-laptop-10508.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server [deleted]


 * /rosdistro
 * /rosversion
 * /teleop_velocity_smoother/accel_lim_v
 * /teleop_velocity_smoother/accel_lim_w
 * /teleop_velocity_smoother/decel_factor
 * /teleop_velocity_smoother/frequency
 * /teleop_velocity_smoother/speed_lim_v
 * /teleop_velocity_smoother/speed_lim_w
 * /turtlebot_teleop_joystick/axis_angular
 * /turtlebot_teleop_joystick/axis_deadman
 * /turtlebot_teleop_joystick/axis_linear
 * /turtlebot_teleop_joystick/scale_angular
 * /turtlebot_teleop_joystick/scale_linear

    joystick (joy/joy_node)
    teleop_velocity_smoother (nodelet/nodelet)
    turtlebot_teleop_joystick (turtlebot_teleop/turtlebot_teleop_joy)


core service [/rosout] found
process[teleop_velocity_smoother-1]: started with pid [10549]
process[turtlebot_teleop_joystick-2]: started with pid [10605]
process[joystick-3]: started with pid [10629]
[turtlebot_teleop_joystick-2] process has died [pid 10605, exit code -11, cmd /opt/ros/groovy/stacks/turtlebot_apps/turtlebot_teleop/bin/turtlebot_teleop_joy turtlebot_teleop_joystick/cmd_vel:=cmd_vel_mux/input/teleop_raw __name:=turtlebot_teleop_joystick __log:=/home/turtlebot/.ros/log/2f70c202-8fb4-11e2-9551-00216a48015a/turtlebot_teleop_joystick-2.log].
log file: /home/turtlebot/.ros/log/2f70c202-8fb4-11e2-9551-00216a48015a/turtlebot_teleop_joystick-2*.log

I am wondering, whether it is because of the joystick is on /dev/input/js1 instead of js0. Can it be? If yes, how could I swap js0 and js1?

edit retag flag offensive close merge delete


Hi,nice to meet you!I have zhe same trouble.Do you know how to use a normal wire joystick to control a turtlebot based kobuki?I have some trouble with it .

Jie Sky gravatar image Jie Sky  ( 2014-11-25 22:59:16 -0600 )edit

I can see the correct output in the echo "rostopic echo /joy".I refer to this website:

Jie Sky gravatar image Jie Sky  ( 2014-11-25 22:59:19 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-18 03:36:38 -0600

ZoltanS gravatar image

updated 2013-03-18 08:47:20 -0600

Ok, now I found the problem and the solution that works. The problem is caused by the accelerometer of the HP laptop that is mapped as /dev/input/js0. By disabling the accelerometer the issue is gone:

  1. lsmod|grep accel --> this returns two lines in my case
  2. sudo modprobe -r hp_accel
  3. sudo modprobe -r lis3lv02d

this is probably not the best solution, since it needs to be repeated after reboot. blacklisting the modules could be better, but I haven't tested it yet.

The following steps are straightforward:

  1. install bluetooth usb key on the turtlebot laptop
  2. sudo bash
  3. in order to stop Ubuntu automatically popping up the Bluetooth pairing dialog {edit /etc/bluetooth/main.conf - add line "DisablePlugins = input"}
  4. "#rosrun ps3joy"
  5. roslaunch turtlebot_teleop ps3_teleop.launch

Previously I tried to change the joystick to /dev/input/js1 by using rosparam set ... command. It worked for the rostopic echo /joy, but the roslaunch turtlebot_teleop ps3_teleop.launch always produced error, it is somewhere hardcoded to use the js0 device.

edit flag offensive delete link more


You should have put a <param /> line to that launch file. You can see in the joy_node source that the dev param is observed.

felix k gravatar image felix k  ( 2013-03-19 07:29:18 -0600 )edit

answered 2013-03-18 01:24:56 -0600

felix k gravatar image

Maybe this helps:

The ps3joy node just "converts" the ps3 controller into a standard linux joystick, so you get the js# device.

The joy node just "converts" a linux joystick into a ROS joy message. You can tell via its parameters which joystick to choose.

That message is processed by turtlebot_teleop.

As that ps3_teleop.launch file does not include ps3joy (maybe cannot because sudo is needed) it has to be started separately.

edit flag offensive delete link more


Hi Felix, thanks for your answer. I can start the joy node with "rosrun joy joy_node". I changed joy_node using rosparam. I can see the correct output in the echo "rostopic echo /joy". Unfortunately, "roslaunch turtlebot_teleop ps3_teleop.launch" still doesn't work, no matter if I start it as root.

ZoltanS gravatar image ZoltanS  ( 2013-03-18 01:44:16 -0600 )edit

No. ps3joy needs sudo, see the wiki. Rosparam is only read while a node starts, so you have to start joy_node after setting rosparam. The joy_node included in that launch file will replace the one you started before. Set the device param in the launchfile (or wherever you effectively start joy_node)

felix k gravatar image felix k  ( 2013-03-18 04:15:04 -0600 )edit

Thanks Felix. Yes, it is clear, that it requires sudo. Unfortunately, it doesn't solve the problem. Strangely, it is working on the remote controller computer which has the exact same installation.

ZoltanS gravatar image ZoltanS  ( 2013-03-18 05:30:02 -0600 )edit

Question Tools

1 follower


Asked: 2013-03-15 04:08:49 -0600

Seen: 3,090 times

Last updated: Mar 18 '13