%% Add Barriers Along Road Edges in Driving Scenario
% Create a driving scenario and add a curved road.

scenario = drivingScenario;
roadCenters = [-14.1 -4.3; 9 -10; 37 -8; 60 3.9; 81.2 29.4; 83.4 57.9];
road1 = road(scenario,roadCenters);

% Add a barrier along the right edge of the road.

barrier(scenario,road1)

% Add another barrier along the left edge of the road with a lateral offset of 1 m from the edge. Specify a gap of 1 m between individual barrier segments.

barrier(scenario,road1,'RoadEdge',"left",'SegmentGap',1,'RoadEdgeOffset',1)

% Plot the scenario.

plot(scenario)

% Copyright 2020 The MathWorks, Inc.