Outline plotter for bird's-eye plot
olPlotter = outlinePlotter(
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
bep. To display the outlines of
actors that are in a driving scenario, first use
targetOutlines to get the dimensions of the actors. Then, after creating an
outline plotter object, use the
function to display the outlines of all the actors in the bird's-eye plot.
Create a driving scenario. Create a 25 m road segment, add a pedestrian and a vehicle, and specify their trajectories to follow. The pedestrian crosses the road at 1 m/s. The vehicle drives along the road at 10 m/s.
scenario = drivingScenario; road(scenario,[0 0 0; 25 0 0]); p = actor(scenario,'ClassID',4,'Length',0.2,'Width',0.4,'Height',1.7); v = vehicle(scenario,'ClassID',1); trajectory(p,[15 -3 0; 15 3 0],1); trajectory(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.
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); 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); % Update the bird's-eye plotters with the road and actors. plotLaneBoundary(lbPlotter,rb); plotOutline(olPlotter,position,yaw,length,width, ... 'OriginOffset',originOffset,'Color',color); % Allow time for plot to update. pause(0.01) end
comma-separated pairs of
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
outlinePlotter('FaceAlpha',1)sets the areas within each outline to be fully opaque.
'FaceAlpha'— Transparency of area within each outline
0.75(default) | real scalar
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'— Tag associated with plotter object
'Plotter(default) | character vector | string scalar
Tag associated with the plotter object, specified as the comma-separated pair
'Tag' and a character vector or string scalar. The
default value is
N is an integer that corresponds to the
Nth plotter associated with the input
olPlotter— Outline plotter
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
olPlotter is stored in the
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. Then, after calling
outlinePlotter to create a plotter object, use
plotOutline to plot the outlines of all the actors in a bird's-eye