Outlines of targets viewed by actor
returns the oriented rectangular outlines of all non-ego target actors in a driving
scenario. The outlines are as viewed from a designated ego vehicle actor,
color] = targetOutlines(
ac. See Ego Vehicle and Targets for more
A target outline is the projection of the target actor cuboid into the
(x,y) plane of the local coordinate system
of the ego vehicle. The target outline components are the
You can use the returned outlines as input arguments to the outline plotter of a
birdsEyePlot. First, call the
outlinePlotter function to create the plotter object. Then, use the
plotOutline function to plot the outlines of all the actors in a
Create a driving scenario and show how target outlines change as the simulation advances.
Create a driving scenario consisting of two intersecting straight roads. The first road segment is 45 meters long. The second straight road is 32 meters long and intersects the first road. A car traveling at 12.0 meters per second along the first road approaches a running pedestrian crossing the intersection at 2.0 meters per second.
scenario = drivingScenario('SampleTime',0.1,'StopTime',1); road(scenario,[-10 0 0; 45 -20 0]); road(scenario,[-10 -10 0; 35 10 0]); ped = actor(scenario,'ClassID',4,'Length',0.4,'Width',0.6,'Height',1.7); car = vehicle(scenario,'ClassID',1); pedspeed = 2.0; carspeed = 12.0; trajectory(ped,[15 -3 0; 15 3 0],pedspeed); trajectory(car,[-10 -10 0; 35 10 0],carspeed);
Create an ego-centric chase plot for the vehicle.
Create an empty bird's-eye plot and add an outline plotter and lane boundary plotter. Then, run the simulation. At each simulation step:
Update the chase plot to display the road boundaries and target outlines.
Update the bird's-eye plot to display the updated road boundaries and target outlines. The plot perspective is always with respect to the ego vehicle.
bepPlot = birdsEyePlot('XLim',[-50 50],'YLim',[-40 40]); outlineplotter = outlinePlotter(bepPlot); laneplotter = laneBoundaryPlotter(bepPlot); legend('off') while advance(scenario) rb = roadBoundaries(car); [position,yaw,length,width,originOffset,color] = targetOutlines(car); plotLaneBoundary(laneplotter,rb) plotOutline(outlineplotter,position,yaw,length,width, ... 'OriginOffset',originOffset,'Color',color) pause(0.01) end
position— Rotational centers of targets
Rotational centers of targets, returned as a real-valued N-by-2 matrix. N is the number of targets. Each row contains the x- and y-coordinates of the rotational center of a target. Units are in meters.
yaw— Yaw angles of targets
Yaw angles of targets about the rotational center, returned as a real-valued N-element vector. N is the number of targets. Yaw angles are measured in the counterclockwise direction, as seen from above. Units are in degrees.
length— Lengths of rectangular outlines of targets
Lengths of rectangular outlines of targets, returned as a positive, real-valued N-element vector. N is the number of targets. Units are in meters.
width— Widths of rectangular outlines of targets
Widths of rectangular outline of targets, returned as a positive, real-valued N-element vector. N is the number of targets. Units are in meters.
originOffset— Offsets of rotational centers from geometric centers
Offset of the rotational centers of targets from their geometric centers, returned as a real-valued N-by-2 matrix. N is the number of targets. Each row contains the x- and y-coordinates defining this offset. In vehicle targets, the rotational center, or origin, is located on the ground, directly beneath the center of the rear axle. Units are in meters.
color— RGB representation of target colors
RGB representation of target colors, returned as a nonnegative, real-valued N-by-3 matrix. N is the number of target actors.
In a driving scenario, you can specify one actor as the observer of all other actors, similar to how the driver of a car observes all other cars. The observer actor is called the ego actor or, more specifically, the ego vehicle. From the perspective of the ego vehicle, all other actors (such as vehicles and pedestrians) are the observed actors, called targets. Ego vehicle coordinates are centered and oriented with reference to the ego vehicle. The coordinates of the driving scenario are world coordinates.