US highway 3D environment
The US Highway scene is a 3D environment of a US highway that contains barriers, cones, and traffic signs. The scene is rendered using the Unreal Engine® from Epic Games®.
To simulate a driving algorithm within this scene:
Add a Simulation 3D Scene Configuration block to your Simulink® model.
In this block, set the Scene description parameter to
Explore the 3D US Highway 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 3D Simulation example.
Load the 2D spatial referencing object that corresponds to the scene. This
imref2d 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.USHighway
spatialRef = imref2d with properties: XWorldLimits: [2.8218e+03 5.0868e+03] YWorldLimits: [-3.7469e+03 -1.4820e+03] ImageSize: [5585 5585] PixelExtentInWorldX: 0.4055 PixelExtentInWorldY: 0.4055 ImageExtentInWorldX: 2.2649e+03 ImageExtentInWorldY: 2.2649e+03 XIntrinsicLimits: [0.5000 5.5855e+03] YIntrinsicLimits: [0.5000 5.5855e+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.
The image displays only the area of the scene containing the highway. The full scene has a length and width of 10,160 meters. The origin of the scene is outside the range of the displayed image.
figure fileName = 'sim3d_USHighway.jpg'; I = imshow(fileName,spatialRef); set(gca,'YDir','normal') xlabel('X (m)') ylabel('Y (m)')