roadrunner.hdmap.Barrier
Description
A roadrunner.hdmap.Barrier object enables you to define the
structure for representing barriers in a RoadRunner HD Map scene model.
Creation
Description
creates
an empty barrier.barrier = roadrunner.hdmap.Barrier()
sets the properties of the barrier using name-value pairs. barrier = roadrunner.hdmap.Barrier(Name=Value)
Properties
ID of the barrier element, specified as a character vector or string scalar.
Example: rrMap.Barriers=
roadrunner.hdmap.Barrier(ID="Barrier1")
creates a barrier with id Lane1 in a RoadRunner HD Map.
Data Types: char | string
Base of barrier that extrusion is repeated over, specified as a three element vector, with double precision values.
Data Types: double
Type of barrier, specified as a roadrunner.hdmap.Reference (RoadRunner) object.
Set flip barrier orientation, specified as logical 0 (false) or
logical 1 (true). Set this field to logical 1
(true) to flip the orientation of barrier along the lateral direction. Use
this field to flip the primary face of the extrusion geometry, such as the guard rails
shown in these images.
User-defined ancillary data, specified as a
roadrunner.hdmap.Metadata object or a vector of
roadrunner.hdmap.Metadata objects. Use a vector of
roadrunner.hdmap.Metadata objects to assign multiple user-defined
parameters to a barrier.
Examples
Create an empty RoadRunner HD Map by calling the roadrunnerHDMap object.
rrMap = roadrunnerHDMap()
rrMap =
roadrunnerHDMap with properties:
Author: ""
Projection: ""
GeographicBoundary: [0×3 double]
Lanes: [0×1 roadrunner.hdmap.Lane]
LaneBoundaries: [0×1 roadrunner.hdmap.LaneBoundary]
LaneGroups: [0×1 roadrunner.hdmap.LaneGroup]
LaneMarkings: [0×1 roadrunner.hdmap.LaneMarking]
Junctions: [0×1 roadrunner.hdmap.Junction]
BarrierTypes: [0×1 roadrunner.hdmap.BarrierType]
Barriers: [0×1 roadrunner.hdmap.Barrier]
SignTypes: [0×1 roadrunner.hdmap.SignType]
Signs: [0×1 roadrunner.hdmap.Sign]
Create the barrier using the roadrunner.hdmap.Barrier object. Specify the barrier information for the barrier id.
rrMap.Barriers = roadrunner.hdmap.Barrier(ID="Barrier1")rrMap =
roadrunnerHDMap with properties:
Author: ""
Projection: ""
GeographicBoundary: [0×3 double]
Lanes: [0×1 roadrunner.hdmap.Lane]
LaneBoundaries: [0×1 roadrunner.hdmap.LaneBoundary]
LaneGroups: [0×1 roadrunner.hdmap.LaneGroup]
LaneMarkings: [0×1 roadrunner.hdmap.LaneMarking]
Junctions: [0×1 roadrunner.hdmap.Junction]
BarrierTypes: [0×1 roadrunner.hdmap.BarrierType]
Barriers: [1×1 roadrunner.hdmap.Barrier]
SignTypes: [0×1 roadrunner.hdmap.SignType]
Signs: [0×1 roadrunner.hdmap.Sign]
Add a barrier such as road fences, to a RoadRunner HD Map and build a RoadRunner scene using the HD Map.
Create an empty RoadRunner HD Map by using the roadrunnerHDMap object.
rrMap = roadrunnerHDMap;
Create a road lane 50 meters in length using the roadrunner.hdmap.Lane object. Specify the lane ID, coordinates defining the lane geometry, driving direction, and lane type.
rrMap.Lanes(1) = roadrunner.hdmap.Lane(ID="Lane",Geometry=[0 0; 0 50],TravelDirection="Forward",LaneType="Driving");
Create the lane boundaries of the road using the roadrunner.hdmap.LaneBoundary object. Specify the lane ID and the coordinates that define the points of the lane boundary.
rrMap.LaneBoundaries(1) = roadrunner.hdmap.LaneBoundary(ID="Left",Geometry=[-6 0; -6 50]); rrMap.LaneBoundaries(2) = roadrunner.hdmap.LaneBoundary(ID="Right",Geometry=[6 0; 6 50]);
Link the lane boundaries to the lane. Define the left and the right lane boundaries for the lane, and specify the alignment between the lane and lane boundaries.
leftBoundary(rrMap.Lanes(1),"Left",Alignment="Forward"); rightBoundary(rrMap.Lanes(1),"Right",Alignment="Forward");
To add a barrier to the HD Map, first extract the corresponding extrusion asset by using the roadrunner.hdmap.RelativeAssetPath object. For more information about these assets, see RoadRunner Asset Types (RoadRunner). Extract the asset for a highway fence barrier to add it to the borders of the road.
pathBarrier = roadrunner.hdmap.RelativeAssetPath(AssetPath="Assets/Extrusions/HighwayFence01.rrext");Now, create a barrier type element that refers to the extracted extrusion asset by using the roadrunner.hdmap.BarrierType object. Specify the barrier ID and the path to the highway fence asset.
rrMap.BarrierTypes(1) = roadrunner.hdmap.BarrierType(ID="BarrierType1",ExtrusionPath=pathBarrier);Create a reference for the barrier using the roadrunner.hdmap.Reference object.
barrierRef = roadrunner.hdmap.Reference(ID="BarrierType1");Add the highway fence barriers to the left and right boundaries of the road in the HD Map.
rrMap.Barriers(1) = roadrunner.hdmap.Barrier(ID="rightFence",Geometry=[-6 0 0; -6 50 0],BarrierTypeReference=barrierRef); rrMap.Barriers(2) = roadrunner.hdmap.Barrier(ID="leftFence",Geometry=[6 0 0; 6 50 0],BarrierTypeReference=barrierRef,FlipLaterally=true);
Plot the lane centers, lane boundaries, and barriers to preview them before importing into RoadRunner.
plot(rrMap,ShowBarriers=true);

Write the modified HD Map to a binary file.
filename = "MyMap.rrhd";
write(rrMap,filename)To open RoadRunner using MATLAB®, first specify the path to your RoadRunner project. This code shows the path for a sample project folder location in Windows®. If you are using RoadRunner for the first time, you must install RoadRunner and activate your RoadRunner license. For more information, see Install and Activate RoadRunner (RoadRunner).
rrProjectPath = "C:\RR\MyProject";Specify the path to your local RoadRunner installation folder. This code shows the path for the default installation location in Windows.
rrAppPath = "C:\Program Files\RoadRunner R2025b\bin\win64";Open RoadRunner using the roadrunner object from the MATLAB command line. Alternatively, you can start the RoadRunner application interactively, using the roadrunnerSetup (RoadRunner) function. This function opens a dialog box to specify the project folder and installation folder to use when opening RoadRunner.
rrApp = roadrunner(rrProjectPath,InstallationFolder=rrAppPath);
Import the RoadRunner HD Map file MyMap.rrhd into your RoadRunner scene, and build the RoadRunner HD Map data. Before you build the scene, you must activate your RoadRunner Scene Builder license. RoadRunner Scene Builder is an add-on product that requires an addition to your RoadRunner license. For more details, see RoadRunner Scene Builder.
file = fullfile(pwd,"MyMap.rrhd"); importScene(rrApp,file,"RoadRunner HD Map");
This figure shows the built scene in the RoadRunner canvas.

Version History
Introduced in R2022bThe roadrunner.hdmap.Barrier now has the Metadata
property, which enables you to add user-defined metadata for barriers to a RoadRunner HD Map scene model.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)