# Lidar Sensor

**Libraries:**

Lidar Toolbox

## Description

The Lidar Sensor block generates point cloud data from the measurements recorded by a lidar sensor mounted on an ego vehicle. The generated data is in the ego vehicle coordinate system.

To generate point cloud data for a scene, you can configure the sensor and actor poses by using this block. The block also outputs the intensity and segmentation values for the generated points.

Additionally, you can use this block to

configure the lidar sensor parameters such as range, azimuth angles, and elevation angles.

add random Gaussian noise to the points in the point cloud.

simulate weather conditions such as fog and rain.

You can use the `drivingScenario`

(Automated Driving Toolbox) object to create a scenario
containing actors and trajectories, import this data into Simulink^{®} by using the Scenario Reader (Automated Driving Toolbox)
block and then generate the point cloud data for the scenario by using the Lidar Sensor
block.

## Examples

## Ports

### Input

**ActorPoses** — Actor poses

Simulink bus containing MATLAB^{®} structure

Actor poses, specified as a Simulink bus containing MATLAB structure. The structure must contain these two fields.

Target poses of the actors in the scene, specified as an

*L*- element array of structures. Each structure corresponds to an actor.*L*is the number of actors used.You can generate this structure programmatically using the

`actorPoses`

(Automated Driving Toolbox) function. You can also create these structures manually. Each structure must contain these fields.Field Description Value `ActorID`

Unique identifier for the actor. Positive scalar `Position`

Position of the actor with respect to the ego vehicle coordinate system, in meters. Three-element vector of the form [ `x y z`

]`Velocity`

Velocity ( *V*) of the actor, in meters per second, along the*x*-,*y*-, and*z*- directions.Three-element vector of the form [

]*V*_{x}*V*_{y}*V*_{z}`Roll`

Roll angle of the actor in degrees. Numeric scalar

`Pitch`

Pitch angle of the actor in degrees. Numeric scalar

`Yaw`

Yaw angle of the actor in degrees. Numeric scalar

`AngularVelocity`

Angular velocity ( *ω*) of the actor, in degrees per second, along the*x*-,*y*-, and*z*- directions.Three-element vector of the form [

]*ω*_{x}*ω*_{y}*ω*_{z}Simulation time for generating new point clouds, specified as a positive scalar.

You can output the scene actors poses from a Scenario Reader (Automated Driving Toolbox) block.

### Output

**IsValid** — Valid simulation time

`0`

| `1`

Valid simulation time, returned as a logical `0`

(`false`

) or `1`

(`true`

). This
value is `0`

for the updates requested at times between the update
interval specified by the **Required interval between sensor updates
(s)** parameter.

**Data Types: **`Boolean`

**Location** — Location values of points

*M*-by-*N*-by-3 matrix

Location values of points in the point cloud, returned as an
*M*-by-*N*-by-3 matrix. *M*,
*N* are the number of rows and columns in the organized point
cloud, respectively.

**Intensity** — Intensity values of points

*M*-by-*N* matrix

Intensity values of points in the point cloud, returned as an
*M*-by-*N* matrix. *M*,
*N* are the number of rows and columns in the organized point
cloud, respectively.

**Clusters** — Classification data of actors

*M*-by-*N*-by-2 matrix

Classification data of actors in the scene, returned as an
*M*-by-*N*-by-2 matrix. The first column contains
the `ActorID`

s and the second column contains the
`ClassID`

s of the target actors.*M*,
*N* are the number of rows and columns in the organized point
cloud, respectively.

## Parameters

### Parameters

**Sensor Identification**

**Unique identifier of sensor** — Unique sensor identifier

`1`

(default) | positive integer

Unique identifier for the sensor, specified as a positive integer. In a multisensor system, this index distinguishes different sensors from one another.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Required interval between sensor updates (s)** — Required time interval between sensor updates

`0.1`

(default) | positive scalar

Time interval between two consecutive sensor updates, specified as a positive scalar. The block generates new detections at the interval specified by this parameter. The value must be an integer multiple of the simulation time. Updates requested from the sensor in between the update intervals contain no detections. Units are in seconds.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Sensor Mounting**

**Position [X Y Height] (m)** — Sensor center position

`[1.5 0 1.6]`

(default) | three-element vector of form [*X*
*Y*
*Height*]

Sensor center position, specified as a three-element vector of the form
[*X*
*Y*
*Height*]. The values of *X* and
*Y* represent the location of the sensor center with respect to the
*X*- and *Y*-axes of the ego vehicle coordinate
system. *Height* is the height of the sensor above the ground. The
default value defines a lidar sensor mounted on the front edge of the roof of a sedan.
Units are in meters.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Orientation [Roll Pitch Yaw] (deg)** — Sensor orientation

`[0 0 0]`

(default) | three-element vector

Sensor orientation, specified as a three-element vector of the form,
[*Roll*
*Pitch*
*Yaw*]. These values are with respect to the ego vehicle coordinate
system. Units are in degrees.

*Roll*— The roll angle is the angle of rotation around the front-to-back axis, which is the*x*-axis of the ego vehicle coordinate system. A positive roll angle corresponds to a clockwise rotation when looking in the positive direction of the*x*-axis.*Pitch*— The pitch angle is the angle of rotation around the side-to-side axis, which is the*y*-axis of the ego vehicle coordinate system. A positive roll angle corresponds to a clockwise rotation when looking in the positive direction of the*y*-axis.*Yaw*— The yaw angle is the angle of rotation around the vertical axis,which is the*z*-axis of the ego vehicle coordinate system. A positive roll angle corresponds to a clockwise rotation when looking in the positive direction of the*z*-axis. This rotation appears counter-clockwise when viewing the vehicle from above.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Actor Profiles**

**MATLAB or Model workspace Actor profiles variable name** — Variable name for actor profiles

`actor_profiles`

(default) | valid variable name

Variable name for actor profiles, specified as the name of a MATLAB or model workspace variable containing actor profiles.

Actor profiles are the physical characteristics of the actors in the scene,
specified as a structure or as an *L*-element array of structures.
*L* is the number of actors in the scene.

If the actor profiles variable has a single structure, then all actors specified
at the **ActorPoses** input port use the same profile.

To generate an array of actor profile structures for your driving scenario `drivingScenario`

(Automated Driving Toolbox), use the `actorProfiles`

(Automated Driving Toolbox) function. You can also create these structures manually.
This table shows the valid structure fields.

Field | Description | Value | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

`ActorID` | Unique identifier for the actor. In a scene with multiple actors, this value distinguishes different actors from one another. | Positive integer | ||||||||||||||

`ClassID` | User-defined classification ID for the actor.
| Positive scalar | ||||||||||||||

`Length` | Length of the actor in meters. | Positive scalar | ||||||||||||||

`Width` | Width of the actor in meters. | Positive scalar | ||||||||||||||

`Height` | Height of the actor in meters. | Positive scalar | ||||||||||||||

`OriginOffset` | Offset of the rotational center of the actor from its geometric center. The rotational center, or origin, is located at the bottom center of the actor. For vehicles, the rotational center is the point on the ground beneath the center of the rear axle. | A three-element vector of the form | ||||||||||||||

`MeshVertices` | Vertices of the actor in mesh representation. | N-by-3 numeric matrix, where each row defines a
vertex in 3-D space. | ||||||||||||||

`MeshFaces` | Face of the actor in mesh representation. | M-by-3 integer matrix, where each row represents a
triangle defined by vertex IDs, which are the row numbers of
`MeshVertices` . | ||||||||||||||

`MeshTargetReflectances` | Material reflectance for each triangular face of the actor. | M-by-1 numeric vector, where M is
the number of triangle faces of the actor. Each value must be in the range
`[0, 1]` . |

For more information about these structure fields, see the `actor`

(Automated Driving Toolbox) and `vehicle`

(Automated Driving Toolbox) functions.

**ActorID of the host vehicle** — Actor ID of ego vehicle

`1`

(default) | positive integer

`ActorID`

value of the ego vehicle, specified as a positive
integer. `ActorID`

is the unique identifier for an actor. This
parameter must be a valid `ActorID`

specified at the
**ActorPoses** input port.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

### Sensor FOV

**Settings**

**Maximum detection range of sensor (m)** — Maximum detection range

`120`

(default) | positive scalar

Maximum detection range of the sensor specified as a positive scalar. The sensor cannot scan for the points beyond this range. Units are in meters.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Azimuth limits (deg)** — Azimuth limits of lidar sensor

`[-180 180]`

(default) | two-element vector

Azimuth limits of the lidar sensor, specified as a two-element vector of the form
[*min*
*max*]. The values must be in the range ```
[-180,
180]
```

, *max* must be greater than *min*.
Units are in degrees.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Azimuth resolution (deg)** — Azimuthal resolution of lidar sensor

`0.16`

(default) | positive scalar

Azimuthal resolution of the lidar sensor, specified as a positive scalar. Units are in degrees.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Use custom elevation angles** — Use custom elevation angles

`off`

(default) | `on`

Select this parameter to use custom elevation angles.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Custom elevation angles (deg)** — Elevation angles of lidar sensor

*N*-element real-valued vector

Custom elevation angles of the lidar sensor, specified as an
*N*-element real-valued vector. *N* is the number of
elevation channels. The elements of the vector must be in the increasing order. Units
are in degrees.

#### Dependencies

To enable this parameter, select the **Use custom elevation
angles** parameter.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Elevation limits (deg)** — Elevation limits of lidar sensor

`[-20 20]`

(default) | two element vector of form [*min*,
*max*]

Elevation limits of the lidar sensor, specified as a two-element vector of the
form [*min*
*max*]. The values must be in the range ```
[-180,
180]
```

, *max* must be greater than *min*.
Units are in degrees.

**Note**

The block disables this parameter, when you select the **Use custom
elevation angles** parameter.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Elevation resolution (deg)** — Elevation resolution of lidar sensor

`1.25`

(default) | positive scalar

Elevation resolution of the lidar sensor, specified as a positive scalar in degrees.

**Note**

The block disables this parameter, when you select the **Use custom
elevation angles** parameter.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

### Advance Settings

**Noise Simulation**

**Add noise to measurements** — Add noise to measurements

`on`

(default) | `off`

When you select this parameter, the block adds random Gaussian noise to each point
in the point cloud using the **Range accuracy (m)** parameter as one
standard deviation. Otherwise, the data has no noise.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Range accuracy (m)** — Accuracy of sensor range measurement

`0.002`

(default) | positive scalar

Accuracy of the sensor range measurement, specified as a positive scalar. Units are in meters.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Weather Simulation**

**Fog visibility in meters** — Visible distance in fog

`1000`

(default) | positive scalar

Visible distance in fog, specified as a positive scalar, in meters. The value of
this parameter must not be greater than 1000. A higher value indicates a better
visibility and a lower fog impact. The default value of `1000`

indicates clear visibility, or no fog.

**Note**

When you specify both **Fog visibility in meters** and
**Rainrate in mm/hour** parameters, the block simulates only the
foggy weather.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

**Rainrate in mm/hour** — Rate of rainfall

`0`

(default) | positive scalar

Rate of rainfall, specified as a positive scalar in millimeter per hour. The value
of this parameter must not be greater than 200. Increasing this value increases the
impact of rain on the generated point cloud. The default value is
`0`

, indicating no rainfall.

**Note**

When you specify both **Fog visibility in meters** and
**Rainrate in mm/hour** parameters, the block simulates only the
foggy weather.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

### Output Port Settings

**Output intensity port** — Output intensity values of points

`on`

(default) | `off`

Select this parameter to enable the **Intensity** output port.

**Output clusters port** — Output segmentation values of points

`on`

(default) | `off`

Select this parameter to enable the **Clusters** output port.

## Version History

**Introduced in R2023a**

## See Also

### Apps

- Driving Scenario Designer (Automated Driving Toolbox) | Lidar Viewer | Lidar Labeler

### Blocks

- Scenario Reader (Automated Driving Toolbox) | Point Cloud Viewer

### Functions

`actorProfiles`

(Automated Driving Toolbox) |`actorPoses`

(Automated Driving Toolbox)

### Objects

`lidarSensor`

|`drivingScenario`

(Automated Driving Toolbox)

## MATLAB 命令

您点击的链接对应于以下 MATLAB 命令：

请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)