Main Content


Display generated point cloud on bird's-eye plot

Since R2020a



plotPointCloud(pcPlotter,pcObject) displays a point cloud generated from a point cloud data object, pcObject. The point cloud plotter, pcPlotter, is associated with a birdsEyePlot object and configures the display of the specified point cloud.

To remove the point cloud associated with the point cloud plotter, use the clearData function with pcPlotter specified as the input argument.

plotPointCloud(pcPlotter,pointCloudMatrix) specifies the point cloud data as a matrix of 2-D or 3-D points, pointCloudMatrix.


collapse all

Generate lidar point cloud data for a driving scenario with multiple actors by using the lidarPointCloudGenerator System object. Create the driving scenario by using drivingScenario object. It contains an ego-vehicle, pedestrian and two other vehicles.

Create and plot a driving scenario with multiple vehicles

Create a driving scenario.

scenario = drivingScenario;

Add a straight road to the driving scenario. The road has one lane in each direction.

roadCenters = [0 0 0; 70 0 0];
laneSpecification = lanespec([1 1]);

Add an ego vehicle to the driving scenario.

egoVehicle = vehicle(scenario,'ClassID',1,'Mesh',driving.scenario.carMesh);
waypoints = [1 -2 0; 35 -2 0];

Add a truck, pedestrian, and bicycle to the driving scenario and plot the scenario.

truck = vehicle(scenario,'ClassID',2,'Length', 8.2,'Width',2.5,'Height',3.5, ...
waypoints = [70 1.7 0; 20 1.9 0];

pedestrian = actor(scenario,'ClassID',4,'Length',0.24,'Width',0.45,'Height',1.7, ...
waypoints = [23 -4 0; 10.4 -4 0];

bicycle = actor(scenario,'ClassID',3,'Length',1.7,'Width',0.45,'Height',1.7, ...
waypoints = [12.7 -3.3 0; 49.3 -3.3 0];


Generate and plot lidar point cloud data

Create a lidarPointCloudGenerator System object.

lidar = lidarPointCloudGenerator;

Add actor profiles and the ego vehicle actor ID from the driving scenario to the System object.

lidar.ActorProfiles = actorProfiles(scenario);
lidar.EgoVehicleActorID = egoVehicle.ActorID;

Plot the point cloud data.

bep = birdsEyePlot('Xlimits',[0 70],'YLimits',[-30 30]);
plotter = pointCloudPlotter(bep);
while advance(scenario)
    tgts = targetPoses(egoVehicle);
    rdmesh = roadMesh(egoVehicle);
    [ptCloud,isValidTime] = lidar(tgts,rdmesh,scenario.SimulationTime);
    if isValidTime

Input Arguments

collapse all

Point cloud plotter, specified as a pointCloudPlotter object. This object is stored in the Plotters property of a birdsEyePlot object and configures the display of the specified point cloud in the bird's-eye plot. The property names correspond to the name-value pair arguments of the pointCloudPlotter function.

Point cloud data object, specified as a pointCloud object.

Point cloud data matrix, specified as a N-by-2 or N-by-3 real-valued matrix. Each element in the first column of the matrix corresponds to the x- coordinates of a point in the point cloud. The elements in the second and third columns correspond to y- and z- coordinates.

Data Types: single | double

Version History

Introduced in R2020a