Is it posibble to import a simulink model into Unreal Engine simulation ?

5 views (last 30 days)
Hi,
I'm trying to create a simulation of a self-driving car in Unreal Engine with Simulink modeling the dynamics and control logic. It is easy to use UE scenes in Simulink, but I'm wondering if it's possible to compile the Simulink model into the Unreal Engine project. The simulation would be developed in Unreal Engine, and I need the logic from Simulink to be imported into the UE project.
Is there any easy way to do this, except for compiling the Simulink model into C++ and incorporating it by hand into UE project?
Thanks for the help.

Accepted Answer

Nishan Nekoo
Nishan Nekoo on 12 Jul 2024
Hi Jakub,
There currently isn't a very easy way to do this unfortunately beyond the method you have mentioned. Can you tell me a little more about your use case for doing this? Is it due to the co-simulation performance or are there any other reasons?
Nishan
  2 Comments
Jakub Wiech
Jakub Wiech on 12 Jul 2024
Hi Nishan,
I'm planning to develop a standalone application. At some point, I will need to import the code from Simulink into an Unreal Engine project. The Simulink model is used only for modeling the elementary behaviors of the vehicle and its dynamics. Whole scenarios, infrastructure, etc., basically 80% of the code, are on the UE side.
I'm just looking for different methods of combining both codes. If there is no other way except for painstaking code generation and copy-pasting everything into the UE project, please let me know.
Nishan Nekoo
Nishan Nekoo on 12 Jul 2024
Hi Jakub,
I just wanted to note that Simulation 3D blocks currently do not support code generation to begin with (link to doc), so you wouldn't be able to generate code or a standalone application for your Simulink model if you are using Simulation 3D blocks. The development team is aware of this limitation and may consider improving this in a future product release.
If you aren't using Simulation 3D blocks, then integrating is possible but this will likely be a tricky process as you have mentioned. For one, the generated Simulink code would need to be recompiled which requires dealing with any dependencies needed. You will likely also need to write some C++ code to expose the functions to blueprints etc if that is what you are using.
I apologize that there isn't a more straightforward approach for now... but we are aware of how useful this workflow can be!
Nishan

Sign in to comment.

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 10 Jul 2024

Products

Community Treasure Hunt

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

Start Hunting!