Can I interact with a Speedgoat real-time simulation from Python?

58 views (last 30 days)
I would like to interact from our host computer with our Speedgoat machine to observe signals and update tunable parameters during runtime.
The goal is to be able to do this via a Python script or GUI. What would be the best way to accomplish this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Feb 2024
Edited: MathWorks Support Team on 2 Feb 2024
The MATLAB Engine API provides a package for Python to call MATLAB as a computational engine. An overview of this feature can be found at the following link:
To use the MATLAB Engine API for Speedgoat target computer & real-time simulation interaction, a full installation of MATLAB and Simulink Real-Time (including licenses) is required. With that, you will have full access to MATLAB's Simulink Real-Time features from Python.
 
For details on how to interact with a Speedgoat target machine and real-time simulation from Python, refer to the following example:
Note that the example above was designed to work with release R2020b or later. If you are working with R2020a or older, you will need to modify the code with the functions that are supported with your current release, such as the SimulinkRealTime.target object.
Tip: One thing to suggest while developing the Python interface is using the "-desktop" startup option when creating the engine. This will make the MATLAB instance visible, and will be useful in testing how the MATLAB Engine API interacts with the MATLAB instance for debugging and development purposes:Start MATLAB Engine for Python - MATLAB matlab.engine.start_matlab (mathworks.com)
Alternatives to Python: 
The recommended method for interacting with a Speedgoat target machine is through a GUI created with MATLAB's App Designer as shown in the following link:
The App Designer workflow also supports the standalone operation of the GUI (without any MATLAB installation or license).
For a complete overview of available interfaces that don't require the full Simulink Real-Time license suite, refer to the MATLAB Answer posts below:

More Answers (1)

Pablo Romero
Pablo Romero on 19 Nov 2021

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!