Main Content

laneMarkingPlotter

Lane marking plotter for bird's-eye plot

Description

example

lmPlotter = laneMarkingPlotter(bep) creates a LaneMarkingPlotter object that configures the display of lane markings on a bird's-eye plot. The LaneMarkingPlotter object is stored in the Plotters property of the input birdsEyePlot object, bep. To display the lane markings, use the plotLaneMarking function.

lmPlotter = laneMarkingPlotter(bep,Name,Value) sets properties using one or more Name,Value pair arguments. For example, laneMarkingPlotter(bep,'DisplayName','Lane markings') sets the display name that appears in the bird's-eye-plot legend.

Examples

collapse all

Create a driving scenario containing an ego vehicle and a target vehicle traveling along a three-lane road. Detect the lane boundaries by using a vision detection generator.

scenario = drivingScenario;

Create a three-lane road by using lane specifications.

roadCenters = [0 0 0; 60 0 0; 120 30 0];
lspc = lanespec(3);
road(scenario,roadCenters,'Lanes',lspc);

Specify that the ego vehicle follows the center lane at 30 m/s.

egovehicle = vehicle(scenario,'ClassID',1);
egopath = [1.5 0 0; 60 0 0; 111 25 0];
egospeed = 30;
trajectory(egovehicle,egopath,egospeed);

Specify that the target vehicle travels ahead of the ego vehicle at 40 m/s and changes lanes close to the ego vehicle.

targetcar = vehicle(scenario,'ClassID',1);
targetpath = [8 2; 60 -3.2; 120 33];
targetspeed = 40;
trajectory(targetcar,targetpath,targetspeed);

Display a chase plot for a 3-D view of the scenario from behind the ego vehicle.

chasePlot(egovehicle)

Create a vision detection generator that detects lanes and objects. The pitch of the sensor points one degree downward.

visionSensor = visionDetectionGenerator('Pitch',1.0);
visionSensor.DetectorOutput = 'Lanes and objects';
visionSensor.ActorProfiles = actorProfiles(scenario);

Run the simulation.

  1. Create a bird's-eye plot and the associated plotters.

  2. Display the sensor coverage area.

  3. Display the lane markings.

  4. Obtain ground truth poses of targets on the road.

  5. Obtain ideal lane boundary points up to 60 m ahead.

  6. Generate detections from the ideal target poses and lane boundaries.

  7. Display the outline of the target.

  8. Display object detections when the object detection is valid.

  9. Display the lane boundary when the lane detection is valid.

bep = birdsEyePlot('XLim',[0 60],'YLim',[-35 35]);
caPlotter = coverageAreaPlotter(bep,'DisplayName','Coverage area', ...
    'FaceColor','blue');
detPlotter = detectionPlotter(bep,'DisplayName','Object detections');
lmPlotter = laneMarkingPlotter(bep,'DisplayName','Lane markings');
lbPlotter = laneBoundaryPlotter(bep,'DisplayName', ...
    'Lane boundary detections','Color','red');
olPlotter = outlinePlotter(bep);
plotCoverageArea(caPlotter,visionSensor.SensorLocation,...
    visionSensor.MaxRange,visionSensor.Yaw, ...
    visionSensor.FieldOfView(1));
while advance(scenario)
    [lmv,lmf] = laneMarkingVertices(egovehicle);
    plotLaneMarking(lmPlotter,lmv,lmf)
    tgtpose = targetPoses(egovehicle);
    lookaheadDistance = 0:0.5:60;
    lb = laneBoundaries(egovehicle,'XDistance',lookaheadDistance,'LocationType','inner');
    [obdets,nobdets,obValid,lb_dets,nlb_dets,lbValid] = ...
        visionSensor(tgtpose,lb,scenario.SimulationTime);
    [objposition,objyaw,objlength,objwidth,objoriginOffset,color] = targetOutlines(egovehicle);
    plotOutline(olPlotter,objposition,objyaw,objlength,objwidth, ...
        'OriginOffset',objoriginOffset,'Color',color)
    if obValid
        detPos = cellfun(@(d)d.Measurement(1:2),obdets,'UniformOutput',false);
        detPos = vertcat(zeros(0,2),cell2mat(detPos')');
        plotDetection(detPlotter,detPos)
    end
    if lbValid
        plotLaneBoundary(lbPlotter,vertcat(lb_dets.LaneBoundaries))
    end
end

Input Arguments

collapse all

Bird’s-eye plot, specified as a birdsEyePlot object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: laneBoundaryPlotter('Color','red') sets the color of lane markings to red.

Plotter name to display in legend, specified as the comma-separated pair consisting of 'DisplayName' and character vector or string scalar. If you do not specify a name, the bird's-eye plot does not display a legend entry for the plotter.

Face color of lane marking patches, specified as the comma-separated pair consisting of 'FaceColor' and an RGB triplet or one of the color names listed in the table.

For a custom color, specify an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 1]; for example, [0.4 0.6 0.7]. Alternatively, you can specify some common colors by name. This table lists the named color options and the equivalent RGB triplet values.

Color NameRGB TripletAppearance
'red'[1 0 0]

'green'[0 1 0]

'blue'[0 0 1]

'cyan' [0 1 1]

'magenta'[1 0 1]

'yellow'[1 1 0]

'black'[0 0 0]

'white'[1 1 1]

Tag associated with the plotter object, specified as the comma-separated pair consisting of 'Tag' and a character vector or string scalar. The default value is 'PlotterN', where N is an integer that corresponds to the Nth plotter associated with the input birdsEyePlot object.

Output Arguments

collapse all

Lane marking plotter, returned as a LaneMarkingPlotter object. You can modify this object by changing its property values. The property names correspond to the name-value pair arguments of the laneMarkingPlotter function.

lmPlotter is stored in the Plotters property of the input birdsEyePlot object, bep. To plot the lane markings, use the plotLaneMarking function.

Introduced in R2018a