Using a joystick with ros

4,069 views
Skip to first unread message

Lee McLaren

unread,
Mar 5, 2017, 5:14:53 AM3/5/17
to LINOROBOT
I don't have a lot of room on my laptop screen, to save a bit of space and make it easier to drive, is it possible to use a joystick?

I have teleop_twist_joy installed but I suspect I am missing the magic in the middle

thanks

Lee

Juan Miguel Jimeno

unread,
Mar 5, 2017, 5:31:46 AM3/5/17
to LINOROBOT
You might be missing joy package (http://wiki.ros.org/joy). If you look at teleop_twist_joy package, it's subscribed to joy topic which is published by joy package. 

teleop_twist_joy just translates the hardware inputs into geometry/Twist messages (linear velocities and angular velocities) to control your robot. You need a hardware driver (joy package) to detect your hardware inputs. 

Lee McLaren

unread,
Mar 5, 2017, 6:38:29 AM3/5/17
to LINOROBOT
I will give it another try

katta Srinivas

unread,
Jun 17, 2017, 9:17:21 PM6/17/17
to LINOROBOT
Hi Juan,

I finished my build for the 2wd version. It is working fine with Teleop keyboard.


I bought PS4 controller and I installed ROS Joy package and I am following the instruction here - https://github.com/chrippa/ds4drv and http://wiki.ros.org/joy/Tutorials/ConfiguringALinuxJoystick


“rostopic echo /joy" works well...but Robot doesn't move..and "rostopic echo /cmd_vel" are blank when I push the joystick buttons.



vas@base:~$ rostopic list
/cmd_vel
/diagnostics 
/imu/data
/imu/data_raw
/imu/mag
/imu/magnetic_field
/imu_filter_madgwick/
/imu_filter_madgwick/
/joy
/odom
/pid
/raw_imu
/raw_vel
/rosout
/rosout_agg
/tf
vas@base:~$


I am new to ROS, can you please suggest something?  Your time and help would greatly be appreciated.


Thank you.

Vas.

Rqt.jpg

Juan Miguel Jimeno

unread,
Jun 17, 2017, 9:51:36 PM6/17/17
to LINOROBOT
Hi Vas,

I don't see http://wiki.ros.org/teleop_twist_joy on your nodes. joy package is just the joystick driver, you need something to translate the button presses into velocity commands, hence teleop_twist_joy pacakge.

Let me know how this go. Thanks! Happy Building.

vas

unread,
Jun 20, 2017, 1:09:26 AM6/20/17
to LINOROBOT
Hi Juan,

I installed teleop_twist_joy pacakge but i am getting below error and not sure what to update for PS4 controller
vas@base:~/catkin_ws/src/teleop_twist_joy/config$ ls -ltr,
total 24
-rwxrwxr-x 1 plexy plexy 225 Jun 19 21:41 xd3.config.yaml
-rwxrwxr-x 1 plexy plexy 241 Jun 19 21:41 xbox.config.yaml
-rwxrwxr-x 1 plexy plexy 179 Jun 19 21:41 ps3.config.yaml
-rwxrwxr-x 1 plexy plexy 149 Jun 19 21:41 ps3-holonomic.config.yaml
-rwxrwxr-x 1 plexy plexy 223 Jun 19 21:41 atk3.config.yaml
-rwxrwxr-x 1 plexy plexy 179 Jun 19 21:57 ps4.config.yaml  <--- i created it from ps3.config.yaml file
vas@base:~/catkin_ws/src/teleop_twist_joy/config$ rosrun joy_teleop joy_teleop.py
[FATAL] [WallTime: 1497934694.293182] no configuration was found, taking node down
vas@base:~/catkin_ws/src/teleop_twist_joy/config$
Your help highly appreciated.
Big Thanks,
Vas.

Juan Miguel Jimeno

unread,
Jun 24, 2017, 12:41:43 PM6/24/17
to LINOROBOT
Hi Vas,

May I know if you're running the PS4 controller wired or through Bluetooth connection? If so, this might help : http://answers.ros.org/question/240210/jackal-robot-ps4-remote-cannot-pair-using-bluetooth-with-the-robot/.

I believe PS4 controller should be supported. Please take note that joy ( http://wiki.ros.org/joy ) package must be run in parallel with teleop_twist_keyboard ( http://wiki.ros.org/teleop_twist_joy ) as it is subscribed to 'joy' topic.

Aalex

unread,
Jul 3, 2017, 2:51:43 AM7/3/17
to LINOROBOT
Hi, 

I would like to share my solution to the joystick control of linorobot problem. 

The trick is to simply install the turtlebot package and use the turtlebot xbox360 teleop node to control. I found no issues whatsoever and have applied  this method to two robots that I built following the linorobot build. If you are using a standard PS3/4 controller or a xbox 360 controller or a logitech controller, it should work out of box. For other controllers you can map the keys by copying the launch file from the turtlebot teleop package and follow along. Hope this helps to those who are struggling. 

Alex

vas

unread,
Jul 18, 2017, 4:06:43 PM7/18/17
to LINOROBOT
Hi Juan, 

It is connected through Bluetooth and i can see controller readings in ROS but motors not moving.I will follow your steps and update you.
Have a good day.

Thank you.
Vas

vas

unread,
Jul 18, 2017, 4:09:02 PM7/18/17
to LINOROBOT
Thank you Aalex for your solution.

Vas.

Wu Jiang

unread,
Jul 19, 2017, 10:37:16 AM7/19/17
to LINOROBOT
Vas, did it work for you by running roslaunch turtlebot_teleop xbox360_teleop.launch --screen?

Nothing was published to cmd_vel when I ran that command.

Wu Jiang

unread,
Jul 19, 2017, 1:15:49 PM7/19/17
to LINOROBOT
Looks like if I press the right bumper on xbox 360's controller, it works. So only turbo mode works.

EDDIE CHIA

unread,
Jul 31, 2017, 12:02:48 AM7/31/17
to LINOROBOT
Wu Jiang.
I am using xbox 360 controller too, but  when I "roslaunch turtlebot_teleop xbox360_teleop.launch" , when move the joystick, there don't seen to have any motion on the motor. As I see you posted that is work, May I know how you done it, I been try for few days, it don't seen to be working at all. Thanks in advance. attached is the snapshot of the screen of the launch.
Thanks
Eddie
Auto Generated Inline Image 1

Wu Jiang

unread,
Jul 31, 2017, 10:45:31 AM7/31/17
to LINOROBOT
I didn't use turtlebot_teleop. I'm using teleop_twist_joy directly by changing launch/teleop.launch to xbox (default is ps3)

<launch>
  <arg name="joy_config" default="xbox" />
  <arg name="joy_dev" default="/dev/input/js0" />
  <arg name="config_filepath" default="$(find teleop_twist_joy)/config/$(arg joy_config).config.yaml" />

  <node pkg="joy" type="joy_node" name="joy_node">
    <param name="dev" value="$(arg joy_dev)" />
    <param name="deadzone" value="0.3" />
    <param name="autorepeat_rate" value="20" />
  </node>

  <node pkg="teleop_twist_joy" name="teleop_twist_joy" type="teleop_node">
    <rosparam command="load" file="$(arg config_filepath)" />
  </node>
</launch>

This way, I can customize the speed by changing config/xbox.config.yaml, i.e:

axis_linear: 1  # Left thumb stick vertical
scale_linear: 0.5
scale_linear_turbo: 0.85

axis_angular: 0  # Left thumb stick horizontal
scale_angular: 0.4

enable_button: 2  # Left trigger button
enable_turbo_button: 5  # Right trigger button


Attached is photo of the enabled buttons on xbox 360 joystick.



EDDIE CHIA

unread,
Jul 31, 2017, 9:04:51 PM7/31/17
to LINOROBOT
Hi Wu Jiang,
Thanks for the solution, I got it run. Thanks a lot, save my day..

Eddie
Reply all
Reply to author
Forward
0 new messages