Can I interact with a Speedgoat real-time simulation from Python?
43 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2018-10-31
编辑: MathWorks Support Team
2024-2-2
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?
采纳的回答
MathWorks Support Team
2024-2-2
编辑:MathWorks Support Team
2024-2-2
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:
0 个评论
更多回答(1 个)
Pablo Romero
2021-11-19
Please find a complete example at Run Real-Time Application by Using Python Script - MATLAB & Simulink (mathworks.com).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!