Connecting Xbox Controller to Simulink Real-Time

34 views (last 30 days)
Hi,
Im trying to add a xbox controller to my simulink Real-Time. However the only blocks I could find and use only work for normal simulink. I tried using Gamepad Simulator block and the Joystick Input block and I tested and worked only for normal Simulink. When I try to use them in Simulink Real-Time, it doesnt take the values. When I use the the JoyStick input block in simulink real-time, it gives me an error and says "Error:Unable to find S-function module 'joyinput'. S-function modules must exist as either source files or pre-compiled object files on the MATLAB path.".
Is there a way to get around this?
Thanks

Answers (2)

Ayush
Ayush on 31 Jul 2024
Edited: Ayush on 31 Jul 2024
Hello Ethan,
It seems that the error that you are getting is because the "Joystick Input" block was not able to create an S-function module properly which is crucial for Simulink Real-time applications. You can try re-building the application to check if the S-function module associated with the block is fixed or you can also try leveraging the following community file exchange that might suit your use case:
Additionally, you can also check out the documentation for "Gamepad Joystick" block for an alternative:
Hope it helps!

Diego Kuratli
Diego Kuratli on 16 Oct 2024
The gamepad and joystick blocks are not supported with Simulink Real-Time.
As a workaround, you could have a model running on the host computer with the Joystick Input block from Simulink 3D Animation, and sending the data via UDP to the Speedgoat real-time target computer. I.e., the joystick is connected to the host computer and send the data to the target computer via the host-target communication link. Here is an example of similar setup with host and target models exchanging data via UDP.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!