roadrunner.hdmap.BarrierType
Description
A roadrunner.hdmap.BarrierType object enables you to define the
barrier extrusion and the type information for a barrier in a RoadRunner HD Map scene model.
Creation
Syntax
Description
creates an empty barrier type.barrierType = roadrunner.hdmap.BarrierType()
sets the properties of the barrier type using name-value pairs.barrierType = roadrunner.hdmap.BarrierType(Name=Value)
Properties
ID of the barrier type, specified as a character vector or string scalar. The
Barrier object refers to this field to describe a barrier based on
its extruded geometry.
Data Types: char | string
Relative path for extrusion asset that defines type of barrier, specified as a
roadrunner.hdmap.RelativeAssetPath (RoadRunner) object. The asset path points to the
extrusion information of this barrier type.
Examples
Create an empty RoadRunner HD Map by calling the roadrunnerHDMap object.
rrMap = roadrunnerHDMap()
rrMap =
roadrunnerHDMap with properties:
Author: ""
GeoReference: [0 0]
GeographicBoundary: []
Lanes: [0×1 roadrunner.hdmap.Lane]
SpeedLimits: [0×1 roadrunner.hdmap.SpeedLimit]
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]
StaticObjectTypes: [0×1 roadrunner.hdmap.StaticObjectType]
StaticObjects: [0×1 roadrunner.hdmap.StaticObject]
StencilMarkingTypes: [0×1 roadrunner.hdmap.StencilMarkingType]
StencilMarkings: [0×1 roadrunner.hdmap.StencilMarking]
CurveMarkingTypes: [0×1 roadrunner.hdmap.CurveMarkingType]
CurveMarkings: [0×1 roadrunner.hdmap.CurveMarking]
SignalTypes: [0×1 roadrunner.hdmap.SignalType]
Signals: [0×1 roadrunner.hdmap.Signal]
Create an extrusion path to an asset. In this example, create a relative path to a constantSlopeBarrier asset file. This path is relative to the Assets folder of your RoadRunner project.
path = roadrunner.hdmap.RelativeAssetPath(AssetPath="/Assets/Extrusions/ConstantSlopeBarrier.rrext")path =
RelativeAssetPath with properties:
AssetPath: "/Assets/Extrusions/ConstantSlopeBarrier.rrext"
Create the barrier type using the roadrunner.hdmap.BarrierType object. Specify the barrier type information for the barrier type id and the extrusion path.
rrMap.BarrierTypes = roadrunner.hdmap.BarrierType(ID="BarrierType1", ExtrusionPath=path)rrMap =
roadrunnerHDMap with properties:
Author: ""
GeoReference: [0 0]
GeographicBoundary: []
Lanes: [0×1 roadrunner.hdmap.Lane]
SpeedLimits: [0×1 roadrunner.hdmap.SpeedLimit]
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: [1×1 roadrunner.hdmap.BarrierType]
Barriers: [0×1 roadrunner.hdmap.Barrier]
SignTypes: [0×1 roadrunner.hdmap.SignType]
Signs: [0×1 roadrunner.hdmap.Sign]
StaticObjectTypes: [0×1 roadrunner.hdmap.StaticObjectType]
StaticObjects: [0×1 roadrunner.hdmap.StaticObject]
StencilMarkingTypes: [0×1 roadrunner.hdmap.StencilMarkingType]
StencilMarkings: [0×1 roadrunner.hdmap.StencilMarking]
CurveMarkingTypes: [0×1 roadrunner.hdmap.CurveMarkingType]
CurveMarkings: [0×1 roadrunner.hdmap.CurveMarking]
SignalTypes: [0×1 roadrunner.hdmap.SignalType]
Signals: [0×1 roadrunner.hdmap.Signal]
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 R2022b
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)