0
$\begingroup$

Rosanswers logo

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?

Originally posted by unais on ROS Answers with karma: 313 on 2013-03-04

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 joy_teleop.py node.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2013-03-04

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by TommyP on 2013-03-04:
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.

Comment by unais on 2013-03-04:
Hi TommyP, How can you write it using pygame library - Is it there any tutorial available for this

Comment by joq on 2013-03-05:
Install the driver with sudo apt-get install ros-groovy-joystick-drivers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.