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

Creating flight joystick node with libusb

asked 2012-05-08 04:49:13 -0500

cheour gravatar image

updated 2014-01-28 17:12:15 -0500

ngrennan gravatar image

I'm trying to get standart usb hid joystick values. Actually I already get the data through libusb and standart C compiler in Eclipse (linux platform). But I wanted to integrate it to ROS and make it a node(joystick_publisher). But I failed.

When I try to merge my existing and working usb code and basic node example in ROS tutorials to create a simple node, I got couple of errors that tells me it didn't realize libusb functions. I already set ros dependency in manifest.xml for libusb-dev but I think rosdep is not able to find it. Rosdep not able to find libusb even in command line.

According to your request I can share the necessery data. If there are other ways to do this job it would be appriciated. Thanks for all helps.

edit retag flag offensive close merge delete



Why do you believe that rosdep cannot find libusb-dev? Do you receive errors during compilation? If so, what are they?

Dustin gravatar image Dustin  ( 2012-05-08 06:21:02 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2012-05-08 05:05:39 -0500

ROS already has the ability to interact with joysticks through the joystick_drivers stack. Specifically, check out the joy package.

edit flag offensive delete link more

answered 2012-05-08 13:22:20 -0500

cheour gravatar image

Well it seems like joy package does my job very well anyway. But when I tried to "rosdep install joy" I got the message "Failed to find rosdep joystick for package joy" which means it couldn't find the joystick library in the operating system.

But I'm 100% sure that I have joystick library as I have libusb-dev. Both I have in operating system but rosdep is not able to find libraries. My idea is something should go with CMakeLists.txt because it seems cmake does not include these libraries. But I'm not yet experienced to solve that deeply. According to tutorials I could have easily write "rosdep install joy" and everything should have gone well, but it is not.

edit flag offensive delete link more

answered 2012-05-09 16:25:46 -0500

cheour gravatar image

Well after a while go on with problem I managed it with rosdep.yaml. For libusb in rosdep.yaml I should have something like:


ubuntu: libusb-dev

But this is not enough. I should have also set the true linker for compile. So I went to CMakeLists.txt and add

target_link_libraries(joystick_talker usb-1.0) // joystick_talker is my node name

and my node started to compile very well with libusb.

With standart joy node, rosdep.yaml created for "joystick" library. But the main problem was here to set it to write permitted directory which is "ros_workspace", after I moved it to ros_workspace and try to rosmake everything gone well.

edit flag offensive delete link more

Question Tools


Asked: 2012-05-08 04:49:13 -0500

Seen: 1,445 times

Last updated: May 09 '12