mikepurvis / joystick_sdl

A cross-platform joystick library/node for ROS.
http://wiki.ros.org/joystick_sdl
6 stars 3 forks source link

ROS2 or Noetic support? #2

Open seanyen opened 4 years ago

seanyen commented 4 years ago

Curious about the status of this project. I think the ROS community would be much benefited by the cross-platform version of joystick driver.

mikepurvis commented 4 years ago

Hi @seanyen, thanks for stopping by!

The main thing that caused me to abandon this effort was that I couldn't figure out a way (at least with SDL APIs) to capture input while in the background. At the time I was testing on Linux and OS X, and on both of those platforms, I would only receive joystick events if I had actually spawned and focused an SDL window— this requirement made it a dealbreaker for ROS usage where you obviously want to be able to use the joystick while in a terminal, looking at rviz, whatever. And of course, if you're running the driver from a headless environment like a robot, it needs to work without relying on getting HID events from the window manager.

Now, that was of course many moons ago, on Ubuntu 14.04 with SDL 1.2 (and Mac OS with SDL 2.0.4). I haven't looked to see if there's a better story for this more recent releases. Certainly it seems like the background thing may now be overrideable, and this person says they got joystick events working sans window, but who knows if that's supported and cross-platform or just happened to work for them.

I don't have the bandwidth to pick this effort back up, but definitely feel free to hack on it if you like. I can give you write access to the repo here and if it looks like it's becoming something, I'll happily transfer it over to the ros-drivers org. Let me know.

seanyen commented 4 years ago

At the time I was testing on Linux and OS X, and on both of those platforms, I would only receive joystick events if I had actually spawned and focused an SDL window

Hmm, that's interesting. Good to know this limitation.

Just for full disclosure, I work on Edge Robotics team in Microsoft, we have a modified version of joystick_driver with SDL2 (https://github.com/ms-iot/joystick_drivers/blob/init_windows/joy/src/joy_node_win.cpp), and it works well on Windows (I need to double check the background thing though). And now I saw your project and think we may be able to extend the portability for all three platforms (Linux, OS X, and Windows).

That being said, I like the idea to transfer it to ros-drivers and I can continue the development there. Let me know anything you need from me.

mikepurvis commented 4 years ago

Oh yes, I'm well aware of your work; it's awesome what you guys have achieved— I've seen your ros_comm PRs.

Certainly my ambition was that this work would be a candidate for becoming the One True ROS joystick driver, but that would obviously have required feature parity with the Linux driver in addition to being cross-platform. Now, that said, there probably would also have been (and will still be) concerns from upstream about adding such a big heavy dependency like SDL2 just for joysticks. It would be interesting to understand how modular the SDL stuff is, and whether it would be possible to vendor in and build just the joystick portion of the source.

Anyway, regardless of all that I'm happy to see this iterated on, taken over, ripped off, whatever. Once there's a candidate (whether it's this or yours), I can work with you to get it moved into ros-drivers.

kielerrr commented 2 years ago

Just for full disclosure, I work on Edge Robotics team in Microsoft, we have a modified version of joystick_driver with SDL2 (https://github.com/ms-iot/joystick_drivers/blob/init_windows/joy/src/joy_node_win.cpp), and it works well on Windows (I need to double check the background thing though). And now I saw your project and think we may be able to extend the portability for all three platforms (Linux, OS X, and Windows).

This version installed like butter. I ran into snags with spacenav in the official ROS Joy package. I ran into sdl2 issues with joystick_sdl. The sdl issues seems to be upstream however so I can't say for sure how it builds. The repo linked by seanyen worked on the first try. It might be worth linking to it in the README. Might save someone a lot of time.

Windows 11 Noetic/Foxy