plotLaneMarking
Display lane markings on bird’s-eye plot
Description
plotLaneMarking(
displays lane marking vertices, lmPlotter
,lmv
,lmf
)lmv
, and lane marking
faces, lmf
, on a bird's-eye plot. The lane marking plotter,
lmPlotter
, is associated with a birdsEyePlot
object and
configures the display of the specified lane markings.
To remove all lane markings associated with the lane marking plotter
lmPlotter
, call the clearData
function and specify lmPlotter
as
the input argument.
Examples
Display Lane Markings in Car and Pedestrian Scenario
Create a driving scenario containing a car and pedestrian on a straight road. Then, create and display the lane markings of the road on a bird's-eye plot.
Create an empty driving scenario.
scenario = drivingScenario;
Create a straight, 25-meter road segment with two travel lanes in one direction.
lm = [laneMarking('Solid') laneMarking('Dashed','Length',2,'Space',4) laneMarking('Solid')]; l = lanespec(2,'Marking',lm); road(scenario,[0 0 0; 25 0 0],'Lanes',l);
Add to the driving scenario a pedestrian crossing the road at 1 meter per second and a car following the road at 10 meters per second.
ped = actor(scenario,'ClassID',4,'Length',0.2,'Width',0.4,'Height',1.7); car = vehicle(scenario,'ClassID',1); smoothTrajectory(ped,[15 -3 0; 15 3 0],1); smoothTrajectory(car,[car.RearOverhang 0 0; 25-car.Length+car.RearOverhang 0 0],10);
Display the scenario and corresponding chase plot.
plot(scenario)
chasePlot(car)
Run the simulation.
Create a bird's-eye plot.
Create an outline plotter, lane boundary plotter, and lane marking plotter for the bird's-eye plot.
Obtain the road boundaries and target outlines.
Obtain the lane marking vertices and faces.
Display the lane boundaries and lane markers.
Run the simulation loop.
bep = birdsEyePlot('XLim',[-25 25],'YLim',[-10 10]); olPlotter = outlinePlotter(bep); lbPlotter = laneBoundaryPlotter(bep); lmPlotter = laneMarkingPlotter(bep,'DisplayName','Lanes'); legend('off'); while advance(scenario) rb = roadBoundaries(car); [position,yaw,length,width,originOffset,color] = targetOutlines(car); [lmv,lmf] = laneMarkingVertices(car); plotLaneBoundary(lbPlotter,rb); plotLaneMarking(lmPlotter,lmv,lmf); plotOutline(olPlotter,position,yaw,length,width, ... 'OriginOffset',originOffset,'Color',color); end
Input Arguments
lmPlotter
— Lane marking plotter
LaneMarkingPlotter
object
Lane marking plotter, specified as a LaneMarkingPlotter
object. This object is stored in the Plotters
property
of a birdsEyePlot
object and
configures the display of the specified lane markings in the bird's-eye
plot. To create this object, use the laneMarkingPlotter
function.
lmv
— Lane marking vertices
V-by-3 real-valued matrix
Lane marking vertices, specified as a V-by-3
real-valued matrix. Each row of lmv
represents the
x, y, and z
coordinates of one vertex in the lane marking. The plotter uses only the
x and y coordinates.
V is the number of vertices in the marking.
To obtain lane marking vertices and faces from a driving scenario, use the
laneMarkingVertices
function.
lmf
— Lane marking faces
integer-valued matrix
Lane marking faces, specified as an integer-valued matrix. Each row of
lmf
is a face that defines the connection between
vertices for one lane marking.
To obtain lane marking vertices and faces from a driving scenario, use the
laneMarkingVertices
function.
Version History
Introduced in R2018a
See Also
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
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)