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

joystick control/navigation using python in ros

asked 2013-03-04 16:53:01 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello Hackers,

I'm a beginner in ros. I want to get some data from joystick. I'm a python fan - don't much know the cpp.

I would like to connect my joystick in a usb port, and want to create a node(/package) that gives the datas from joystick ,so that I can directly use it to control my robot.

My Doubts

  1. How I can link the joystick motion control into my robot?
  2. Is it any additional drivers/installation needed to sopport my joystick?
  3. Is it I can able to imperilment it using python?
  4. Is it any additional requirements/specifications needed for the joystick?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-04 19:39:13 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

That's actually a good demonstration of the advantages of ROS supporting multiple languages. There is a C++ joystick node ready to use that should work with nearly all joysticks/gamepads out of the box: joy.

Provided you have a roscore running, it's very likely that starting

rosrun joy joy_node

in one terminal and running

rostopic echo joy

in another will print out the joystick state. If that's not the case look at the Configuring and Using a Linux-Supported Joystick with ROS tutorial.

Using the joystick data in your python node is just a matter of subscribing to it and performing some processing based on it. A example of doing that is this node.

edit flag offensive delete link more



Is that really working in groovy? "rosdep install joy" does not install anything for me. Otherwise pygame supports juystick and it is easy to write a Python node that uses that.

TommyP gravatar image TommyP  ( 2013-03-04 21:55:12 -0600 )edit

Hi TommyP, How can you write it using pygame library - Is it there any tutorial available for this

unais gravatar image unais  ( 2013-03-04 22:31:20 -0600 )edit

Install the driver with sudo apt-get install ros-groovy-joystick-drivers.

joq gravatar image joq  ( 2013-03-05 14:34:59 -0600 )edit

Question Tools



Asked: 2013-03-04 16:53:01 -0600

Seen: 2,581 times

Last updated: Mar 04 '13