Main Content

outlinePlotter

Outline plotter for bird's-eye plot

Description

olPlotter = outlinePlotter(bep) creates an OutlinePlotter object that configures the display of object outlines on a bird's-eye plot. The OutlinePlotter object is stored in the Plotters property of the birdsEyePlot object, bep. To display the outlines of actors that are in a driving scenario, first use targetOutlines to get the dimensions of the actors and barriers. Then, after creating an outline plotter object, use the plotOutline and plotBarrierOutline functions to display the outlines of all the actors and barriers in the bird's-eye plot, respectively.

olPlotter = outlinePlotter(bep,Name,Value) sets properties using one or more Name,Value pair arguments. For example, outlinePlotter(bep,'FaceAlpha',0) sets the areas within each outline to be fully transparent.

example

Examples

collapse all

Create a driving scenario. Create a 25 m road segment with a barrier on its left edge. Add a pedestrian that crosses the road at 1 m/s, and a vehicle that drives along the road at 10 m/s.

scenario = drivingScenario;

r = road(scenario,[0 0 0; 25 0 0]);
barrier(scenario,r,'RoadEdge','left')

p = actor(scenario,'ClassID',4,'Length',0.2,'Width',0.4,'Height',1.7);
v = vehicle(scenario,'ClassID',1);

smoothTrajectory(p,[15 -3 0; 15 3 0],1)
smoothTrajectory(v,[v.RearOverhang 0 0; 25-v.Length+v.RearOverhang 0 0],10)

Use a chase plot to display the scenario from the perspective of the vehicle.

chasePlot(v,'Centerline','on')

Figure contains an axes object. The hidden axes object with xlabel X (m), ylabel Y (m) contains 18 objects of type patch, line.

Create a bird's-eye plot, outline plotter, and lane boundary plotter.

bep = birdsEyePlot('XLim',[-25 25],'YLim',[-10 10]);
olPlotter = outlinePlotter(bep);
lbPlotter = laneBoundaryPlotter(bep);

Figure contains an axes object. The axes object with xlabel X (m), ylabel Y (m) is empty.

legend('off')

Run the simulation loop. Update the plotter with outlines for the targets.

while advance(scenario)
   % Obtain the road boundaries and rectangular outlines.
   rb = roadBoundaries(v);
   [position,yaw,length,width,originOffset,color] = targetOutlines(v);
   [bposition,byaw,blength,bwidth,boriginOffset,bcolor,numBarrierSegments] = targetOutlines(v,'Barriers');

   % Update the bird's-eye plotters with the road, actors and barriers.
   plotLaneBoundary(lbPlotter,rb);
   plotOutline(olPlotter,position,yaw,length,width, ...
               'OriginOffset',originOffset,'Color',color);
   plotBarrierOutline(olPlotter,numBarrierSegments,bposition,byaw,blength,bwidth, ...
               'OriginOffset',boriginOffset,'Color',bcolor); 
   % Allow time for plot to update.
   pause(0.01)
end

Figure contains an axes object. The hidden axes object with xlabel X (m), ylabel Y (m) contains 18 objects of type patch, line.

Figure contains an axes object. The axes object with xlabel X (m), ylabel Y (m) is empty.

Input Arguments

collapse all

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: outlinePlotter('FaceAlpha',1) sets the areas within each outline to be fully opaque.

Transparency of the area within each outline, specified as the comma-separated pair consisting of 'FaceAlpha' and a real scalar in the range [0, 1]. A value of 0 makes the areas fully transparent. A value of 1 makes the areas fully opaque.

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

Outline plotter, returned as an OutlinePlotter object. You can modify this object by changing its property values. The property names correspond to the name-value pair arguments of the outlinePlotter function.

olPlotter is stored in the Plotters property of a birdsEyePlot object. To plot the outlines of actors that are in a driving scenario, first use targetOutlines to get the dimensions of the actors and barriers. Then, after calling outlinePlotter to create a plotter object, use plotOutline and plotBarrierOutline to plot the outlines of all the actors and barriers in a bird's-eye plot, respectively.

Version History

Introduced in R2017b