Specifiying a trajectory for the ego vehicle for Unreal engine 3d simulation.

6 views (last 30 days)
I am trying to create a custom scene in unreal editor to test a simulunk ADAS model.
Currently I have been able to setup co-simatuion for ue4 and simulink.
A custom map has been made in the unreal editor and have followed https://www.mathworks.com/help/driving/ug/create-top-down-map-of-unreal-engine-scene.html to get a 2d image of the map to set a trajecotry for the ego vehicle to follow, However my waypoints dont match up in the simulation. I assume this has got something to do with specifiying the X-axis and Y-axis limits of the scene in world coordinates. Where can I find these coordinates?
for reference refer to the mathworks documentation I have linked above under Convert Screenshot to Map.
sceneImage = imread('myScene.png');
imageSize = size(sceneImage);
xlims = [-80 60]; % these are the limits im having trouble specifying
ylims = [-75 65]; % these are the limits im having trouble specifying
sceneRef = imref2d(imageSize,xlims,ylims);
Thank you.
  3 Comments
Sanvir Sahib
Sanvir Sahib on 24 Feb 2021
Thank you for the reply, how am I able to obtain the values of the world coordinate system in unreal engine?
Helen Liao
Helen Liao on 26 Feb 2021
Hi Sanvir,
If you are using the simulation 3d vehicle with ground following as you ego vehicle or other vehicle, you can turn on the ground truth - output location(m) and orientation(rad) to get the converted position of the vehicle from Unreal Eungine coordinate. If you inverted it, you will get the coordinate in Unreal Editor, which you have to flip the sign of the Y-axis and pitch angle. You can also observe those values in UE Editor when you are runing co-simulation in UE Editor. Please be aware of the unit is also different in UE Editor(cm) and Simulink(m).
For example, when I use the simulation 3d vehicle with ground following in my Simulink model and run co-simulation in UE Editor, there will be a actor called - sim3dPassVeh in the World outliner. Click on it, and look at the Tranlation in Detail, which will change during the simulation and it is the coordinate of the vehicle in the UE Editor.
Here is the doc page for the Simulation 3d vehicle with ground following for your reference. blockhttps://www.mathworks.com/help/driving/ref/simulation3dvehiclewithgroundfollowing.html
Thanks,
Helen

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!