Main Content

Simulation 3D Camera Get

Camera image

Since R2022b

  • Simulation 3D Camera Get block

Libraries:
Vehicle Dynamics Blockset / Vehicle Scenarios / Sim3D / Sim3D Core
Aerospace Blockset / Animation / Simulation 3D
Simulink 3D Animation / Simulation 3D / Utilities

Description

The Simulation 3D Camera Get block provides an interface to an ideal camera in the 3D visualization environment. The image output is a red, green, and blue (RGB) array.

If you set the sample time to -1, the block uses the sample time specified in the Simulation 3D Scene Configuration block. To use this sensor, ensure that the Simulation 3D Scene Configuration block is in your model.

Tip

Verify that the Simulation 3D Scene Configuration block executes before the Simulation 3D Camera Get block. That way, the Unreal Engine® 3D visualization environment prepares the data before the Simulation 3D Camera Get 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 Camera Get1

For more information about execution order, see Control and Display Execution Order (Simulink).

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.

Examples

Ports

Output

expand all

3D output camera image, returned as an m-by-n-by-3 array of RGB triplet values. m is the vertical resolution of the image, and n is the horizontal resolution of the image.

Data Types: int8 | uint8

Parameters

expand all

Mounting

Unique sensor identifier, specified as a positive integer. This number is used to identify a specific sensor. The sensor identifier distinguishes between sensors in a multi-sensor system.

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 – World 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 in Simulink 3D Animation.

Example: MATLAB

Sensor mounting location.

  • When Parent name is Scene Origin, the block mounts the sensor to the origin of the scene, and Mounting location can be set to Origin only. During simulation, the sensor remains stationary.

  • 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 (for example, SimulinkVehicle1) the block mounts the sensor to one of the predefined mounting locations described in the table. During simulation, the sensor travels with the vehicle. For example, the table provides the mounting locations in the ISO 8855 standard coordinate system.

Mounting LocationDescriptionOrientation Relative to Vehicle Origin [Roll, Pitch, Yaw] (deg)
Origin

Forward-facing sensor mounted to the vehicle origin, which is on the ground and at the geometric center of the vehicle (see Coordinate Systems in Simulink 3D Animation)

[0, 0, 0]

Front bumper

Front center

Forward-facing sensor mounted to the front bumper

[0, 0, 0]

Rear bumper

Rear center

Backward-facing sensor mounted to the rear bumper

[0, 0, 180]
Right mirror

Downward-facing sensor mounted to the right side-view mirror

[0, –90, 0]
Left mirror

Downward-facing sensor mounted to the left side-view mirror

[0, –90, 0]
Rearview mirror

Forward-facing sensor mounted to the rearview mirror, inside the vehicle

[0, 0, 0]
Hood center

Forward-facing sensor mounted to the center of the hood

[0, 0, 0]
Roof center

Forward-facing sensor mounted to the center of the roof

[0, 0, 0]

The (X, Y, Z) location of the sensor relative to the vehicle depends on the vehicle type. To specify the vehicle type, use the Type parameter of the Simulation 3D Vehicle with Ground Following block to which you are mounting.

For example, the tables show the X, Y, and Z locations of sensors in the ISO 8855 standard coordinate system.

Box Truck — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper5.1000.60
Rear bumper–500.60

Right mirror

2.901.602.10

Left mirror

2.90–1.602.10

Rearview mirror

2.600.202.60

Hood center

3.8002.10

Roof center

1.3004.20

Hatchback — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper1.9300.51
Rear bumper–1.9300.51

Right mirror

0.43–0.841.01

Left mirror

0.430.841.01

Rearview mirror

0.3201.27

Hood center

1.4401.01

Roof center

001.57

Muscle Car — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper2.4700.45
Rear bumper–2.4700.45

Right mirror

0.43–1.081.01

Left mirror

0.431.081.01

Rearview mirror

0.32701.19

Hood center

1.2801.14

Roof center

–0.2501.58

Sedan — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper2.4200.51
Rear bumper–2.4200.51

Right mirror

0.59–0.941.09

Left mirror

0.590.941.09

Rearview mirror

0.4301.31

Hood center

1.4601.11

Roof center

–0.4501.69

Small Pickup Truck — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper3.0700.51
Rear bumper–3.0700.51

Right mirror

1.10–1.131.52

Left mirror

1.101.131.52

Rearview mirror

0.8501.77

Hood center

2.2201.59

Roof center

002.27

Sport Utility Vehicle — Sensor Locations Relative to Vehicle Origin

Mounting LocationX (m)Y (m)Z (m)
Front bumper2.4200.51
Rear bumper–2.4200.51

Right mirror

0.60–11.35

Left mirror

0.6011.35

Rearview mirror

0.39301.54

Hood center

1.5801.39

Roof center

–0.5602

Example: Origin

Select this parameter to specify an offset from the mounting location.

Translation offset from mounting location of the sensor, specified as a real-valued 1-by-3 vector of the form [X, Y, Z], in meters. The X, Y, and Z coordinates are defined in the coordinate system specified by the Coordinate system parameter.

Example: [0,0,0.01]

Dependencies

To enable this parameter, select Specify offset.

Rotational offset from 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 X, Y, and Z coordinates are defined in the coordinate system specified by the Coordinate system parameter. 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.

Example: [0,0,10]

Dependencies

To enable this parameter, select Specify offset.

Sample time of the block in seconds. The 3D simulation environment frame rate is the inverse of the sample time.

If you set the sample time to -1, the block uses the sample time specified in the Simulation 3D Scene Configuration block.

Parameter

Horizontal image resolution, in pixels.

Vertical image resolution, in pixels.

Horizontal field of view (FOV), in deg.

Tips

Version History

Introduced in R2022b

expand all