%% Add Roads That Have Different Lane Types to Driving Scenario
% This example shows how to define lane types and simulate a driving scenario for a four-lane road that has different lane types.
% Create a driving lane object with default property values.

drivingLane = laneType('Driving')

% Create a parking lane type object. Specify the color and the strength property values.

parkingLane = laneType('Parking','Color',[1 0 0],'Strength',0.1)

% Create a three-element, heterogeneous lane type array by concatenating the driving and the parking lane type objects. The lane type array contains lane types for a four-lane road.

lt = [parkingLane drivingLane drivingLane parkingLane];

% Create lane specification for a four-lane road. Add the lane type array to the lane specification.

ls = lanespec([2 2],'Type',lt);

% Create a driving scenario object. Add the four-lane road with lane specifications ls to the driving scenario.

scenario = drivingScenario;
roadCenters = [0 0 0;40 0 0];
road(scenario,roadCenters,'Lanes',ls)

% Plot the scenario. The scenario contains the four-lane road that has two parking lanes and two driving lanes.

plot(scenario)
legend('Driving Lane','Parking Lane')

% Copyright 2019 The MathWorks, Inc.