Main Content

uavLidarPointCloudGenerator

Generate point clouds from meshes

Since R2020b

Description

The uavLidarPointCloudGenerator System object™ generates detections from a statistical simulated lidar sensor. The system object uses a statistical sensor model to simulate lidar detections with added random noise. All detections are with respect to the coordinate frame of the vehicle-mounted sensor. You can use the uavLidarPointCloudGenerator object in a scenario, created using a uavSensor, containing static meshes, UAV platforms, and sensors.

To generate lidar point clouds:

  1. Create the uavLidarPointCloudGenerator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

lidar = uavLidarPointCloudGenerator creates a statistical sensor model to generate point cloud for a lidar. This sensor model will have default properties.

lidar = uavLidarPointCloudGenerator(Name,Value) sets properties using one or more name-value pairs. For example, uavLidarPointCloudGenerator('UpdateRate',100,'HasNoise',0) creates a lidar point cloud generator that reports detections at an update rate of 100 Hz without noise.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Update rate of the lidar sensor, specified as a positive real scalar in Hz. This property sets the frequency at which new detections happen.

Example: 20

Data Types: double

Maximum detection range of the sensor, specified as a positive real scalar. The sensor does not detect objects beyond this range. The units are in meters.

Example: 120

Data Types: double

Accuracy of the range measurements, specified as a positive real scalar in meters. This property sets the one-standard-deviation accuracy of the sensor range measurements.

Example: 0.001

Data Types: single | double

Azimuthal resolution of lidar sensor, specified as a positive real scalar in degrees. The azimuthal resolution defines the minimum separation in azimuth angle at which the lidar sensor can distinguish two targets.

Example: 0.6000

Data Types: single | double

Elevation resolution of lidar sensor, specified as a positive real scalar with units in degrees. The elevation resolution defines the minimum separation in elevation angle at which the lidar can distinguish two targets.

Example: 0.6000

Data Types: single | double

Azimuth limits of the lidar, specified as a two-element vector of the form [min max]. Units are in degrees.

Example: [-60 100]

Data Types: single | double

Elevation limits of the lidar, specified as a two-element vector of the form [min max]. Units are in degrees.

Example: [-60 100]

Data Types: single | double

Add noise to lidar sensor measurements, specified as true or false. Set this property to true to add noise to the sensor measurements. Otherwise, the measurements have no noise.

Example: false

Data Types: logical

Output generated data as organized point cloud, specified as true or false. Set this property to true to output an organized point cloud. Otherwise, the output is unorganized.

Example: false

Data Types: logical

Usage

Description

ptCloud = lidar(tgts,simTime) generates a lidar point cloud object ptCloud from the specified target object, tgts, at the specified simulation time simTime.

[ptCloud,isValidTime] = lidar(tgts,simTime) additionally returns isValidTime which specifies if the specified simTime is a multiple of the sensor's update interval (1/UpdateRate).

Input Arguments

expand all

Target object data, specified as a structure or structure array. Each structure corresponds to a mesh. The table shows the properties that the object uses to generate detections.

Target Object Data

FieldDescription
MeshAn extendedObjectMesh object representing the geometry of the target object in its own coordinate frame.
PositionA three-element vector defining the coordinate position of the target with respect to the sensor frame.
OrientationA quaternion object or a 3-by-3 matrix, containing Euler angles, defining the orientation of the target with respect to the sensor frame.

Current simulation time, specified as a positive real scalar. The lidar object calls the lidar point cloud generator at regular intervals to generate new point clouds at a frequency defined by the updateRate property. The value of the UpdateRate property must be an integer multiple of the simulation time interval. Updates requested from the sensor between update intervals do not generate a point cloud. Units are in seconds.

Output Arguments

expand all

Point cloud data, returned as a pointCloud object.

Valid time to generate point cloud, returned as logical 0 (false) or 1 (false). isValidTime is 0 when the requested update time is not a multiple of the updateRate property value.

Data Types: logical

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

This example shows how to use a statistical lidar sensor model to generate point clouds from a mesh.

Create Sensor Model

Create a statistical sensor model, lidar, using the uavLidarPointCloudGenerator System object.

lidar = uavLidarPointCloudGenerator('HasOrganizedOutput',false);

Create Floor

Use the extendedObjectMesh object to create mesh for the target object.

tgts.Mesh = scale(extendedObjectMesh('cuboid'),[100 100 2]); 

Define the position of the target object with respect to the sensor frame.

tgts.Position = [0 0 -10];

Define the orientation of the target with respect to the sensor frame.

 tgts.Orientation = quaternion([1 0 0 0]);

Generate Point Clouds from Floor

 ptCloud = lidar(tgts,0); 

Visualize

Use the translate function to translate the object mesh to its specified location and use the show function to visualize it. Use the scatter3 function to plot the point clouds stored in ptCloud.

figure
show(translate(tgts.Mesh,tgts.Position));
hold on
scatter3(ptCloud.Location(:,1),ptCloud.Location(:,2), ...
       ptCloud.Location(:,3));

Figure contains an axes object. The axes object contains 2 objects of type patch, scatter.

Version History

Introduced in R2020b