Time Delay in Real-time Simulation with Vehicle Dynamics Blockset Interface for Unreal Engine 4

7 views (last 30 days)
I build a setup similar to this video. In my first try, instead of a steering wheel, I run a predefined maneuver over 20 seconds. The Problem is, that the visualisation in UE4 runs much slower and stutters. The result is, that after the simulation on the target is already finished, the visualisation shows the last ~4 sec of the simulation which appear with a lot less stutter.
This is not getting better by increasing the sample time or lowering the graphics.
The time delay gets better when the sample time of the UDP send is greater (e.g. 0.05) then the sample time of the visualisation (e.g. 0.025), and gets worse the other way around.
I explain it for me like this: The target sends the position data of the vehicle for each time step. The visualisation then renders each time step. When the visualisation isnt able to render the image before the next position data is received, the visualisation appears slowed down. Is there a way to tell the visualisation to only render the last received position data instead of the next subsequent position data?
Many thanks!

Answers (2)

Abhi Shankar Abhinav
Abhi Shankar Abhinav on 20 Feb 2020
I suspect a hardware issue (GPU/ UDP) that is causing the drift between the real-time platform and game to be large. Is your setup identical to the one described in the video (Real-time target platform like Speedgoat and UDP for communicating vehicle data)?
Two things to troubleshoot:
  • Does a desktop sim with one of shipping examples cause any rendering issues? (GPU perfomrance)
  • May need to troubleshoot UDP and check how it was configured.
If it is GPU performance then you can reduce the frame rate, and the sample rate of the data coming in & out of unreal. A better solution if you not require an immediate rendering is recording data and then playback.
  2 Comments
Ingomar Schröder
Ingomar Schröder on 9 Mar 2020
Thanks for the response. I only answer now, because I got a new computer with a RTX 2080 Ti and wanted to give it a try. The problem still persists.
My setup is almost identical. I use a desktop Real-time target with Simulink Real-Time OS via NetworkBoot. For communication I use the UDP Send/ Receive Blocks from Simulink Real-Time/ Real-Time UDP with "Use host-target connection". For visualization i use the Ground Following Block.
I also tried working with the UDP Receive Block from the Instrument Control Toolbox where you can specify FIFO/ LIFO and with the Real-Time Synchronization Block.
  • Does a desktop sim with one of shipping examples cause any rendering issues? (GPU perfomrance)
Not anymore.
  • May need to troubleshoot UDP and check how it was configured.
I'm unsure what the optimal configuration is. I tried different sample times for UDP Send/ Receive and the visualization. I also dont know what configuration for the "solver" of the Simulink model with the visualization is needed. The vehicle model on the real-time target is running with 1 ms. Is Simulation Pacing required? Is it possible to get a minimal example where such things are preconfigured?
Abhi Shankar Abhinav
Abhi Shankar Abhinav on 9 Mar 2020
By design in this configuration the Unreal rendering and vehicle model on Speedgoat (real-time target) are not in lockstep/ synchronized. But, as shown in the webinar the performance visually should not be as limited if UDP is configured approprotely. My reccommendation would be to use a dedicated etherent link instead of host-target link and initially make it a one-way communication from Speedgoat to Desktop (use constant ground height in environment subsystem). I have used the host target link as well to get satifactory performance. Here are the sample settings for solver and UDP:
  • Model running on Speegoat
Solver step size:1e-3 (ode 8/ode4). UDP Send sample time 1e-3 s
  • Model running on Host
Solver step size:1e-3 (ode 8). UDP Recieve sample time 1e-3s and Frame Rate 0.02s

Sign in to comment.


james garcia
james garcia on 9 Nov 2022
I'm trying to run the example of 'Double Lane Change Reference Application' but when I go to load the application to run it in real time on my performance machine, the attached error always appears in the attached file, and when I deactivate the "minimize algebraic loop occurrences" for the file 'driveline', 'model14dof' and 'siMappedenginev' the following error occurs "for the model referenced by it contains a block that updates persistent or state variables while computing outputs and is not supported in an algebraic loop. It is in an algebraic loop with the following blocks." Could you help me?
Version matlab 2021a

Community Treasure Hunt

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

Start Hunting!