parkingLaneMarkingVertices

Parking lane marking vertices and faces in driving scenario

Since R2021b

Description

[plmv,plmf] = parkingLaneMarkingVertices(scenario) returns the parking lane marking vertices plmv and parking lane marking faces plmf contained in driving scenario scenario. The plmf and plmv outputs are in the world coordinates of scenario. Use parking lane marking vertices and faces to display lane markings using the laneMarkingPlotter function with a bird's-eye plot.

example

[plmv,plmf] = parkingLaneMarkingVertices(ac) returns all lane marking vertices and faces contained in the driving scenario in the coordinates of actor ac.

Examples

collapse all

Generate detections of cars parked in a parking lot, and plot the detections on a bird's-eye plot.

Create a driving scenario containing a road and parking lot.

scenario = drivingScenario;
roadcenters = [10 40; 10 -40];
vertices = [0 20; 20 20; 20 -20; 0 -20];
parkingLot(scenario,vertices,ParkingSpace=parkingSpace);

Add an ego vehicle and specify a trajectory in which the vehicle drives through the parking lot.

ego = vehicle(scenario);
waypoints = [10 35 0; 10 10 0];
speed = 5; % m/s
smoothTrajectory(ego,waypoints,speed)

Create parked cars in several parking spaces. Plot the scenario.

parkedCar1 = vehicle(scenario,Position=[15.8 12.4 0]);
parkedCar2 = vehicle(scenario,Position=[15.8 -12.4 0]);
parkedCar3 = vehicle(scenario,Position=[2 -9.7 0]);
parkedCar4 = vehicle(scenario,Position=[2 9.7 0]);
plot(scenario)

Create a vision sensor for generating the detections. By default, the sensor is mounted to the front bumper of the ego vehicle.

sensor = visionDetectionGenerator;

Create a bird's-eye plot and plotters for visualizing the target outlines, road boundaries, parking lane markings, sensor coverage area, and detections. Then, simulate the scenario and generate the detections.

bep = birdsEyePlot(XLim=[-40 40],YLim=[-30 30]);
olPlotter = outlinePlotter(bep);
lbPlotter = laneBoundaryPlotter(bep);
lmPlotter = laneMarkingPlotter(bep,DisplayName="Parking lanes");
caPlotter = coverageAreaPlotter(bep,DisplayName="Coverage area");
detPlotter = detectionPlotter(bep,DisplayName="Detections");

% Plot target outlines.
[position,yaw,length,width,originOffset,color] = targetOutlines(ego);
plotOutline(olPlotter,position,yaw,length,width)

% Plot lane boundaries of ego vehicle.
plotLaneBoundary(lbPlotter,rbEgo)

% Plot parking lane markings.
[plmv,plmf] = parkingLaneMarkingVertices(ego);
plotParkingLaneMarking(lmPlotter,plmv,plmf)

% Plot sensor coverage area.
mountPosition = sensor.SensorLocation;
range = sensor.MaxRange;
orientation = sensor.Yaw;
fieldOfView = sensor.FieldOfView(1);
plotCoverageArea(caPlotter,mountPosition,range,orientation,fieldOfView)

% Generate and plot detections.
actors = targetPoses(ego);
time = scenario.SimulationTime;
[dets,isValidTime] = sensor(actors,time);
if isValidTime
positions = cell2mat(cellfun(@(x)([x.Measurement(1) x.Measurement(2)]), ...
dets,UniformOutput=false));
plotDetection(detPlotter,positions)
end

end

Input Arguments

collapse all

Driving scenario, specified as a drivingScenario object.

Actor belonging to a drivingScenario object, specified as an Actor or Vehicle object. To create these objects, use the actor and vehicle functions, respectively.

Output Arguments

collapse all

Parking lane marking vertices, returned as a V-by-3 real-valued matrix. Each row of the matrix represents the (x, y, z) coordinates of a vertex. V is the number of vertices in the marking.

Parking lane marking faces, returned as a matrix of integers. Each row of the matrix contains the vertex connections that define a face for one lane marking. For more details, see Faces.

Algorithms

This function uses the patch function to define lane marking vertices and faces.

Version History

Introduced in R2021b