Main Content

Simulation 3D Ultrasonic Sensor

Ultrasonic sensor model in 3D simulation environment

Since R2023a

  • Simulation 3d Ultrasonic Sensor Block

Libraries:
Automated Driving Toolbox / Simulation 3D
Aerospace Blockset / Animation / Simulation 3D
UAV Toolbox / Simulation 3D
Simulink 3D Animation / Simulation 3D / Sensors

Description

Note

Simulating models with the Simulation 3D Ultrasonic Sensor block requires Simulink® 3D Animation™.

The Simulation 3D Ultrasonic Sensor block generates detections from range measurements taken by an ultrasonic sensor mounted on an ego vehicle in a 3D simulation environment rendered using the Unreal Engine® from Epic Games®. The block calculates range measurements based on the distance between the sensor and the closest point on the detected object.

If you set Sample time to -1, the block uses the sample time specified in the Simulation 3D Scene Configuration block. To use this sensor, you must include a Simulation 3D Scene Configuration block in your model.

Tip

The Simulation 3D Scene Configuration block must execute before the Simulation 3D Ultrasonic Sensor block. That way, the Unreal Engine 3D visualization environment prepares the data before the Simulation 3D Ultrasonic Sensor block receives it. To check the block execution order, right-click the blocks and then click the Properties button . On the General tab, confirm these Priority settings:

  • Simulation 3D Scene Configuration0

  • Simulation 3D Ultrasonic Sensor1

For more information about execution order, see How Unreal Engine Simulation for UAVs Works.

The Coordinate system parameter of the block specifies how the actor transformations are applied in the 3D environment. The output of the block also follows the specified coordinate system.

Ports

Output

expand all

Detectable object present in the sensor field-of-view, returned as a Boolean scalar. An object is considered detectable if its closest distance to the sensor is greater than the minimum detection-only range specified in the Detection ranges (m) parameter.

Range measurement is possible for an object present in the sensor field-of-view, returned as a Boolean scalar. For any object in the field-of-view, range measurement is possible if its closest distance to the sensor is greater than the minimum-distance range specified in the Detection ranges (m) parameter.

Distance measurement to the closest object, returned as a nonnegative scalar, in meters.

Sensor location along the X-axis, Y-axis, and Z-axis of the scene. The Translation values are returned in the coordinate system that you specified in the Coordinate system parameter.

Dependencies

To enable this port, on the Ground Truth tab, select Output location and orientation.

Data Types: double

Roll, pitch, and yaw sensor orientation about the X-axis, Y-axis, and Z-axis of the scene. The Rotation values are returned in the coordinate system that you specified in the Coordinate system parameter.

Dependencies

To enable this port, on the Ground Truth tab, select Output location and orientation.

Data Types: double

Parameters

expand all

Mounting

Specify the unique identifier of the sensor. In a multisensor system, the sensor identifier enables you to distinguish between sensors. When you add a new sensor block to your model, the Sensor identifier of that block is N + 1, where N is the highest Sensor identifier value among the existing sensor blocks in the model.

Example: 2

Specify the name of the parent to which the sensor is mounted. The block provides a list of parent actors in the model. The names that you can select correspond to the values of the Name parameters of the Simulation 3D blocks in your model. If you select Scene Origin, the block places a sensor at the scene origin. The Custom option allows you to specify the name of any actor, including child actors in the environment, as the parent actor.

Example: SimulinkVehicle1

Specify the name of custom parent. This parameter allows you to set any actor in the environment, including child actors as the parent actor to which the sensor is mounted. The name corresponds to the Name parameter of the Simulation 3D block.

Example: SimulinkVehicle1

Dependencies

To enable this parameter, set Parent name to Custom.

Specify the coordinate system that the actor uses for translation and rotation in the 3D environment.

  • Default – Unreal Editor coordinate system. Units are in m and rad.

  • MATLAB – MATLAB® coordinate system. Units are in m and rad.

  • ISO8855 – ISO 8855 standard coordinate system. Units are in m and deg.

  • AERO – SAE coordinate system. Units are in m and rad.

  • VRML – X3D ISO standard coordinate system. Units are in m and rad.

  • SAE – SAE coordinate system. Units are in m and rad.

For more details on the different coordinate systems, see Coordinate Systems for Unreal Engine Simulation in UAV Toolbox.

Example: MATLAB

Sensor mounting location. By default, the block places the sensor relative to the scene or vehicle origin, depending on the Parent name parameter.

  • When Parent name is sim3d actor name, the block mounts the sensor to the origin of the actor, which is the center of the shape. You can set the Mounting location to Origin only. During simulation, the sensor travels with the actor.

  • When Parent name is the name of a vehicle, the block mounts the sensor to one of the predefined mounting locations described in the table. During simulation, the sensor travels with the vehicle.

  • When Parent name is Scene Origin, the block mounts the sensor relative to the scene origin, and during simulation, the sensor remains stationary.

  • When Parent name is the name of a vehicle, the block mounts the sensor relative to the vehicle origin, and during simulation, the sensor travels with the vehicle.

To specify the relative position and orientation of the sensor with respect to the scene or vehicle origin, use the Relative translation [X, Y, Z] and Relative rotation [Roll, Pitch, Yaw] parameters.

The location of vehicle origin depends on the vehicle type. To select the vehicle type, specify the Type parameter of the Simulation 3D UAV Vehicle block to which you are mounting the sensor. Visit the reference page for each vehicle type for more information on the vehicle dimensions and location of the vehicle origin

Select this parameter to specify an offset from the mounting location by using the Relative translation [X, Y, Z] and Relative rotation [Roll, Pitch, Yaw] parameters.

Translation offset relative to the mounting location of the sensor, specified as a real-valued 1-by-3 vector of the form [X, Y, Z].

If you mount the sensor to a vehicle by setting Parent name to the name of that vehicle, then X, Y, and Z are relative to the vehicle origin. If you mount the sensor to the scene origin by setting Parent name to Scene Origin, then X, Y, and Z are relative to the scene origin.

Relative translations are specified in the coordinate system that you choose in the Coordinate system parameter. For more details about the vehicle and world coordinate systems, see Coordinate Systems for Unreal Engine Simulation in UAV Toolbox.

Example: [0,0,0.01]

Dependencies

To enable this parameter, select Specify offset.

Rotational offset relative to the mounting location of the sensor, specified as a real-valued 1-by-3 vector of the form [Roll, Pitch, Yaw]. Roll, pitch, and yaw are the angles of rotation about the X-, Y-, and Z-axes, respectively. The rotation order is Roll, then Pitch, then Yaw. When you update any of the three rotation values and leave others unchanged, the software reapplies all three rotations in the same order.

If you mount the sensor to a vehicle by setting Parent name to the name of that vehicle, then Roll, Pitch, and Yaw are relative to the vehicle origin. If you mount the sensor to the scene origin by setting Parent name to Scene Origin, then Roll, Pitch, and Yaw are relative to the scene origin.

Relative rotations are specified in the coordinate system that you choose in the Coordinate system parameter. For more details about the vehicle and world coordinate systems, see Coordinate Systems for Unreal Engine Simulation in UAV Toolbox.

Example: [0,0,10]

Dependencies

To enable this parameter, select Specify offset.

Sample time of the block, in seconds, specified as a positive scalar. The 3D simulation environment frame rate is the inverse of the sample time.

If you set the sample time to -1, the block inherits its sample time from the Simulation 3D Scene Configuration block.

Sensor Parameters

Detection range vector of the ultrasonic sensor, specified as a 1-by-3 nonnegative real-valued vector of the form [minDetOnlyRange minDistRange maxDistRange], where minDetOnlyRange < minDistRange < maxDistRange. Units are in meters. These values determine the detections and distance values returned by the ultrasonic sensor.

  • When the detected object is at a distance between minDistRange and maxDistRange, the sensor returns a positive distance value.

  • When the detected object is at a distance between minDetOnlyRange and minDistRange, the sensor detects the object, but cannot determine the distance and returns a value of 0.

  • When the object is at a distance below minDetOnlyRange or above maxDistRange, the sensor returns an empty cell array.

Horizontal field of view of ultrasonic sensor, specified as a positive real scalar. This field of view defines the total angular extent spanned by the sensor in the horizontal direction. You must specify the horizontal field of view horizontalFOV in the range (0, 90). Units are in degrees.

Vertical field of view of ultrasonic sensor, specified as a positive real scalar. This field of view defines the total angular extent spanned by the sensor in the vertical direction. You must specify the vertical field of view in the range (0, 90). Units are in degrees.

Ground Truth

Select this parameter to output the translation and rotation of the sensor at the Translation and Rotation ports, respectively.

Version History

Introduced in R2023a

expand all