Contenido principal

hasFrame

Check if point cloud frame is available to read

Since R2025a

Description

tf = hasFrame(pcExtractor) returns a logical 1 (true) if there is a point cloud frame available to read from the input ego point cloud extractor object pcExtractor. Otherwise, it returns a logical 0 (false).

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package and Lidar Toolbox™. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Examples

collapse all

Load recorded point cloud data into the workspace.

ptCloud = pcread("USGS_LPC_CA_NoCAL_3DEP_Supp_Funding_2018_D18_w2276n1958_Cropped_geoReferenced.pcd");

Display the point cloud object.

pcshow(ptCloud)

Specify the xyz-coordinates of waypoints to create a trajectory. The trajectory coordinates must be within the spatial range of the loaded point cloud data.

egoTraj = [-122.8437 12.1113 39.8113;
            -21.3297 32.1351 33.9599;
             80.4809 49.1138 32.9193];

Specify timestamps for the waypoints of the trajectory.

timestamps = (1:3)'; 

Create a trajectory object by using the specified xyz-coordinates and timestamps.

traj = recordedSensorData("trajectory",timestamps,egoTraj);

Plot the trajectory object.

plot(traj,HeadingStep=1,ShowHeading=true)

Create an ego point cloud extractor object using the point cloud and trajectory information.

pcExtractor = egoPointCloudExtractor(ptCloud,traj)
pcExtractor = 
  egoPointCloudExtractor with properties:

              Height: 1.6000
            MaxRange: 120
    SensorParameters: []
          PointCloud: [1×1 pointCloud]
          Trajectory: [1×1 scenariobuilder.Trajectory]
      NumPointClouds: 3

Extract and display point cloud frames from the ego point cloud extractor object until it has no new frames to extract.

figure
frame = 0;
while(hasFrame(pcExtractor))
    pcFrame = extractFrame(pcExtractor);
    frame = frame + 1;
    subplot(1,3,frame)
    pcshow(pcFrame)
end

Reset the ego point cloud extractor object.

reset(pcExtractor)

Input Arguments

collapse all

Ego point cloud extractor, specified as an egoPointCloudExtractor object.

Version History

Introduced in R2025a