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 select Properties. 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).

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

Vehicle name. Block provides a list of vehicles in the model. If you select Scene Origin, the block places a sensor at the scene origin.

Example: SimulinkVehicle1

Sensor mounting location.

  • When Vehicle 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 Vehicle 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.

Vehicle 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 for Unreal Engine Simulation in Automated Driving Toolbox (Automated Driving Toolbox))

Vehicle with sensor mounted at origin

[0, 0, 0]

Front bumper

Front center

Forward-facing sensor mounted to the front bumper

Vehicle with sensor mounted at front bumper

[0, 0, 0]

Rear bumper

Rear center

Backward-facing sensor mounted to the rear bumper

Vehicle with sensor mounted at rear bumper

[0, 0, 180]
Right mirror

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

Vehicle with sensor mounted at right side-view mirror

[0, –90, 0]
Left mirror

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

Vehicle with sensor mounted at left side-view mirror

[0, –90, 0]
Rearview mirror

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

Vehicle with sensor mounted at rearview mirror

[0, 0, 0]
Hood center

Forward-facing sensor mounted to the center of the hood

Vehicle with sensor mounted at hood center

[0, 0, 0]
Roof center

Forward-facing sensor mounted to the center of the roof

Vehicle with sensor mounted at roof center

[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 Scene Configuration block to which you are mounting. The tables show the X, Y, and Z locations of sensors in the vehicle coordinate system. In this coordinate system:

  • The X-axis points forward from the vehicle.

  • The Y-axis points to the left of the vehicle, as viewed when facing forward.

  • The Z-axis points up from the ground.

  • Roll, pitch, and yaw are clockwise-positive when looking in the positive direction of the X-axis, Y-axis, and Z-axis, respectively. When looking at a vehicle from the top down, then the yaw angle (that is, the orientation angle) is counterclockwise-positive, because you are looking in the negative direction of the axis.

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

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

Hood center

1.5801.39

Roof center

–0.5602

Example: Origin

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

Specify a translation offset from the mount location, about the vehicle coordinate system X, Y, and Z axes. Units are in meters.

  • The X-axis points forward from the vehicle.

  • The Y-axis points to the left of the vehicle, as viewed when facing forward.

  • The Z-axis points up.

Example: [0,0,0.01]

Dependencies

To enable this parameter, select Specify offset.

Specify a rotational offset from the mounting location, about the vehicle coordinate system X, Y, and Z axes. Units are in degrees.

  • Roll angle is the angle of rotation about the X-axis of the vehicle coordinate system. A positive roll angle corresponds to a clockwise rotation when looking in the positive direction of the X-axis.

  • Pitch angle is the angle of rotation about the Y-axis of the vehicle coordinate system. A positive pitch angle corresponds to a clockwise rotation when looking in the positive direction of the Y-axis.

  • Yaw angle is the angle of rotation about the Z of the vehicle coordinate system. A positive yaw angle corresponds to a clockwise rotation when looking in the positive direction of the Z-axis.

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