Main Content

uavLidarPointCloudGenerator

Generate point clouds from meshes

Description

The uavLidarPointCloudGenerator System object™ generates detections from a lidar sensor. The system object uses a statistical sensor model to simulate real 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 containing static meshes, UAV platforms and sensors, which you can create using a uavScenario object.

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

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

Generate Point Clouds from Mesh

lidar= uavLidarPointCloudGenerator(Name,Value) sets additional properties for the statistical sensor model 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 specifies the frequency at which the lidar point clouds are generated 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 scalar value. The sensor cannot 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 with units 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 the lidar, specified as a positive real scalar with units in degrees. The azimuthal resolution defines the minimum separation in azimuth angle at which the lidar can distinguish two targets.

Example: 0.6

Data Types: single | double

Elevation resolution of the lidar, 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.6

Data Types: single | double

Azimuth limits of the lidar, specified as a 1-by-2 real-valued 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 1-by-2 real-valued vector of the form [min max]. Units are in degrees.

Example: [-15 20]

Data Types: single | double

Enable adding 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 N-element array of structs, tgts, at the current 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 extendedObjectMeshrepresenting the geometry of the target object in its own coordinate frame.
PositionA 3-element vector defining the coordinate position of the target with respect to the sensor frame
OrientationA quaternion object or a 3-by-3 matrix 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 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 0 or 1. isValidTime is 0 when updates are requested at times that are between update intervals specified by 1/updateRate.

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 meshes.

Create Sensor Model

Use uavLidarPointCloudGenerator to create a statistical sensor model, lidar.

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 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); 

Visulaize

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

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

Introduced in R2020b