How do I start cosimulation between the Unreal Engine Editor and Simulink Vehicle Dynamics Blockset?

17 views (last 30 days)
I am trying to start co-simulation between Simulink's Vehicle Dynamics Blockset and the Unreal Engine Editor. I have already run simulations with the shipped reference applications that use the Unreal engine, but would like to customize the scene somewhat and simulate with the Editor. How do i start cosimulation?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Apr 2020
Edited: MathWorks Support Team on 13 Apr 2020
First, you need to install the Vehicle Dynamics Blockset Interface for Unreal Engine 4 Projects support package:
Instructions for setting up for Editor co-simulation are included in the 'AVE_README.pdf' in the support package, which you can open from the MATLAB Command Window using this command:
open('AVE_README.pdf')
Please note that you need to install the Unreal Engine Editor on your machine and have Unreal Engine 4.19 installed prior to running the scripts in the PDF.
Once these are installed, follow the instructions for Method B in the PDF. This script will place the MathWorks Plugin in the Unreal Engine Plugins folder and start the Unreal Engine Editor. You must start the engine from this MATLAB command, or the Unreal Engine may crash when attempting to simulate.
Once the Unreal Engine Editor is open, you can co-simulate with Simulink using the following steps:
1. Ensure that the Scene Config block is set to "Editor" mode.
2. Start simulation in Simulink.
3. Once the Simulink model reaches the initialization stage (displayed at the bottom left of the window) it will begin searching for a running instance of the unreal engine editor. Prior to or during the initialization stage, you must press the "Play" button in the Unreal Engine Editor to enter the game state.
4. If the Unreal Engine Editor does not enter the simulating/game state in time, the Simulink model will error out with this error message:
3D Simulation engine interface writer setup error. Is the 3D Simulation engine running?
You should see the Unreal Engine Editor enter the playing state as cosimulation starts.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!