laneMarkingPlotter
Lane marking plotter for bird's-eye plot
Description
creates a lmPlotter
= laneMarkingPlotter(bep
)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.
sets properties using one or more lmPlotter
= laneMarkingPlotter(bep
,Name,Value
)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
Generate Object and Lane Boundary Detections
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;
smoothTrajectory(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;
smoothTrajectory(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.
Create a bird's-eye plot and the associated plotters.
Display the sensor coverage area.
Display the lane markings.
Obtain ground truth poses of targets on the road.
Obtain ideal lane boundary points up to 60 m ahead.
Generate detections from the ideal target poses and lane boundaries.
Display the outline of the target.
Display object detections when the object detection is valid.
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
bep
— Bird’s-eye plot
birdsEyePlot
object
Bird’s-eye plot, specified as a birdsEyePlot
object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: laneBoundaryPlotter('Color','red')
sets the color of lane
markings to red.
DisplayName
— Plotter name to display in legend
''
(default) | character vector | string scalar
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.
FaceColor
— Face color of lane marking patches
[0.6 0.6 0.6]
(gray) (default) | RGB triplet | color name
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 Name | RGB Triplet | Appearance |
---|---|---|
'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
— Tag associated with plotter object
'PlotterN
'
(default) | character vector | string scalar
N
'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 'Plotter
, where
N
'N
is an integer that corresponds to the
N
th plotter associated with the input birdsEyePlot
object.
Output Arguments
lmPlotter
— Lane marking plotter
LaneMarkingPlotter
object
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.
Version History
Introduced in R2018a
See Also
birdsEyePlot
| plotLaneMarking
| plotParkingLaneMarking
| findPlotter
| clearData
| clearPlotterData
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)