rossimulinkxbox

Interaction XBOX Controller with Simulink Model


I'm working in a project where i have to control a Robot (I have it already as a Simulink Model) with an XBOX Controller.

Until now I couldn't find a good Example or a good Idea to let these two interact.

I want to change some variables (INPUTs) with the buttons of the XBOX Controller and then get a feedback (Example: a vibration feedback) (OUTPUT).

Is it possible to do that with ROS and Simulink? So that I can work with ros_joy, and then implement it in my Simulink model?

It'll be very helpful when I get some advises here.


Solution

  • I can't test this, but I know from ubuntu <= 16 that jstest and jstest-gtk (the nicer gui interface) can be installed via apt, to check & configure any joysticks/gamepads, and it works well. Then you will have your gamepad as a device under /dev/. (Ex: /dev/js0, /dev/input/js0). And that file handle is easy to use, with many supporting 3rd party/one-off libraries (you don't have to use all of ros if you don't want/need to).

    And I know from matlab that there are ways to hack up a solution, but their own 1st party solution is vrjoystick, which takes in a 1-based numeric id. This should mean your gamepad shows up as js0, and the id should then be 1: id = 1; joy = vrjoystick(id,'forcefeedback');.