Open surface 3D environment
The Open Surface scene contains a 3D environment of an open, black road surface. The scene is rendered using the Unreal Engine® from Epic Games®.
To simulate a driving algorithm in this scene:
Add a Simulation 3D Scene Configuration block to your Simulink® model.
In this block, set the Scene source parameter to
Default Scenes
.
Set the enabled Scene name parameter to
Open surface
.
Explore the 3D Open Surface scene and inspect its dimensions by using a corresponding 2D top-view image of the scene.
You can use this image to inspect the scene before simulation and choose starting coordinates for vehicles. For details on using these images to select waypoints for path-following applications, see the Select Waypoints for Unreal Engine Simulation example.
Load the 2D spatial referencing object that corresponds to the scene. This imref2d
(Image Processing Toolbox) object describes the relationship between the pixels in the image and the world coordinates of the scene.
data = load('sim3d_SpatialReferences.mat');
spatialRef = data.spatialReference.OpenSurface
spatialRef = imref2d with properties: XWorldLimits: [-130.5500 894.4500] YWorldLimits: [-567.2500 457.7500] ImageSize: [4845 4845] PixelExtentInWorldX: 0.2116 PixelExtentInWorldY: 0.2116 ImageExtentInWorldX: 1025 ImageExtentInWorldY: 1025 XIntrinsicLimits: [0.5000 4.8455e+03] YIntrinsicLimits: [0.5000 4.8455e+03]
Display the image corresponding to the scene. Use the spatial referencing object to display the axes in the world coordinates of the scene. Units are in meters.
By default, the imshow
function displays Y-axis values that increase from top to bottom. To align with the Automated Driving Toolbox™ world coordinate system, set the Y-direction to 'normal'
so that Y-axis values increase from bottom to top.
Place a marker at the origin of the scene.
figure fileName = 'sim3d_OpenSurface.jpg'; I = imshow(fileName,spatialRef); set(gca,'YDir','normal') xlabel('X (m)') ylabel('Y (m)') hold on plot(0,0,'o','MarkerFaceColor','r','MarkerEdgeColor','k','MarkerSize',8) offset = 10; % px text(offset,offset,'(0,0)','Color','w','FontWeight','bold','FontSize',12) hold off
If you have the
Automated Driving Toolbox™ Interface for Unreal Engine 4 Projects support package, then you can modify this scene. In
the Unreal Engine project file that comes with the support package, this scene is
named BlackLake
.
For more details on customizing scenes, see Customize Unreal Engine Scenes for Automated Driving.
Curved Road | Double Lane Change | Large Parking Lot | Parking Lot | Straight Road | US City Block | US Highway | Virtual Mcity