Main Content

targetOutlines

Outlines of targets viewed by actor

Description

example

[position,yaw,length,width,originOffset,color] = targetOutlines(ac)returns the oriented rectangular outlines of all non-ego and non-barrier target actors in a driving scenario. The outlines are as viewed from a designated ego vehicle actor,ac. SeeEgo Vehicle and Targetsfor more details.

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 theposition,yaw,length,width,originOffset, andcoloroutput arguments.

You can use the returned outlines as input arguments to the outline plotter of abirdsEyePlot. First, call theoutlinePlotterfunction to create the plotter object. Then, use theplotOutlinefunction to plot the outlines of all the actors in a bird's-eye plot.

[position,yaw,length,width,originOffset,color,numBarrierSegments] = targetOutlines(ac,'Barriers')returns only the oriented rectangular outlines of all barriers in a driving scenario. The additional output argumentnumBarrierSegmentscontains the number of segments present in each barrier.

You can use the retuned barrier outlines as input arguments to the outline plotter of abirdsEyePlot. First, call theoutlinePlotterfunction to create the plotter object. Then, use theplotBarrierOutlinefunction to plot the outlines of all the barriers in a bird's-eye plot.

Examples

collapse all

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 with jersey barriers along both its edges, 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); road1 = road(scenario,[-10 0 0; 45 -20 0]); road2 = road(scenario,[-10 -10 0; 35 10 0]); barrier(scenario,road1) barrier(scenario,road1,'RoadEdge','left') 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; smoothTrajectory(ped,[15 -3 0; 15 3 0],pedspeed); smoothTrajectory(car,[-10 -10 0; 35 10 0],carspeed);

Create an ego-centric chase plot for the vehicle.

chasePlot(car,'Centerline','on')

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')whileadvance(scenario) rb = roadBoundaries(car); [position,yaw,length,width,originOffset,color] = targetOutlines(car); [bposition,byaw,blength,bwidth,boriginOffset,bcolor,barrierSegments] = targetOutlines(car,'Barriers'); plotLaneBoundary(laneplotter,rb) plotOutline(outlineplotter,position,yaw,length,width,...'OriginOffset',originOffset,'Color',color) plotBarrierOutline(outlineplotter,barrierSegments,bposition,byaw,blength,bwidth,...'OriginOffset',boriginOffset,'Color',bcolor) pause(0.01)end

Figure contains an axes object. The axes object is empty.

Input Arguments

collapse all

Actor belonging to adrivingScenarioobject, specified as anActororVehicleobject. To create these objects, use theactorandvehiclefunctions, respectively.

Output Arguments

collapse all

Rotational centers of targets, returned as a real-valuedN-by-2 matrix.N是the number of targets. Each row contains thex- andy-coordinates of the rotational center of a target. Units are in meters.

偏航角旋转中心的目标,returned as a real-valuedN-element vector.N是the number of targets. Yaw angles are measured in the counterclockwise direction, as seen from above. Units are in degrees.

Lengths of rectangular outlines of targets, returned as a positive, real-valuedN-element vector.N是the number of targets. Units are in meters.

Widths of rectangular outline of targets, returned as a positive, real-valuedN-element vector.N是the number of targets. Units are in meters.

Offset of the rotational centers of targets from their geometric centers, returned as a real-valuedN-by-2 matrix.N是the number of targets. Each row contains thex- andy-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.

RGB representation of target colors, returned as a nonnegative, real-valuedN3矩阵.N是the number of target actors.

Number of barrier segments in each barrier, returned as a nonnegative, real-valuedN1的向量.N是the number of barriers in the scenario. This argument is returned only when the'Barriers'flag is provided as input.

More About

collapse all

Ego Vehicle and Targets

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 theego actoror, more specifically, theego vehicle. From the perspective of the ego vehicle, all other actors (such as vehicles and pedestrians) are the observed actors, calledtargets. Ego vehicle coordinates are centered and oriented with reference to the ego vehicle. The coordinates of the driving scenario are world coordinates.

Version History

Introduced in R2017a