Viewer

Updated: April 19, 2023

Viewers are defined in a single array named viewer in JSON format.

Specifying viewers is optional. You may leave out specifying this in your configuration file. However, if you are specifying algorithms, here is an example:

...
"viewer": [
        {
            "type": "ADAS_VIEWER_CAMERA",
            "view": "ADAS_VIEW_FORWARD",
            "zoom_factor": 1,
            "background_color": {
               "red": 0.2,
                "green": 0.2,
                "blue": 0.2,
                "alpha": 1.0
            },
            "z_order": 0,
            "visible": true,
            "layouts" : [
                {
                    "view": "ADAS_VIEW_FORWARD",
                    "layout": "camera_layout_1"
                },
                {
                    "view": "ADAS_VIEW_DRIVER",
                    "layout": "camera_layout_1"
                },
                {
                    "view": "ADAS_VIEW_RADAR",
                    "layout": "camera_layout_1"
                },
                {
                    "view": "ADAS_VIEW_NAVIGATION",
                    "layout": "camera_layout_1"
                }
            ]
        },
        {
            "type": "ADAS_VIEWER_POINT_CLOUD",
            "input": [
                { 
                    "id": "front_lidar"
                }
            ],
            "view": "ADAS_VIEW_ISOMETRIC",
            "zoom_factor": 2,
            "z_order": 0,
            "visible": false,
            "range": {
                "x": 10000,
                "y": 5625,
                "z": 5000
            },
            "persistence": 1000,
            "position": {
                "x": -1245,
                "y": -932,
                "z": 0
            },
            "dimensions": {
                "width": 1864,
                "height": 1475,
                "depth": 4925
            }
        },
        {
            "type": "ADAS_VIEWER_OVERLAY",
            "input": [
                { 
                    "id": "primary_gps"
                },
                { 
                    "id": "primary_imu"
                }
            ],
            "view": "ADAS_VIEW_ISOMETRIC",
            "zoom_factor": 2,
            "z_order": 1,
            "visible": false,
            "enable_hud": false,
            "parent": 2,
            "layouts" : [
                {
                    "view": "ADAS_VIEW_RADAR",
                    "layout": "overlay_layout_1"
                },
                {
                    "view": "ADAS_VIEW_NAVIGATION",
                    "layout": "overlay_layout_2"
                }
            ]
        },
        {
            "type": "ADAS_VIEWER_OVERLAY",
            "input": [
                { 
                    "id": "secondary_gps"
                },
                { 
                    "id": "secondary_imu"
                }
            ],
            "view": "ADAS_VIEW_FORWARD",
            "zoom_factor": 1,
            "z_order": 1,
            "visible": true,
            "enable_hud": true,
            "parent": 1,
            "layouts" : [
                {
                    "view": "ADAS_VIEW_FORWARD",
                    "layout": "overlay_layout_3"
                },
                {
                    "view": "ADAS_VIEW_DRIVER",
                    "layout": "overlay_layout_4"
                },
                {
                    "view": "ADAS_VIEW_RADAR",
                    "layout": "overlay_layout_1"
                },
                {
                    "view": "ADAS_VIEW_NAVIGATION",
                    "layout": "overlay_layout_2"
                }
            ]
        }
    ]
...
           

Properties:

There are the properties that you can use to configure a viewer.

background_color
(Required) The color of the backbround of the viewer. The color must be specified with the following values:
  • red
  • green
  • blue
  • alpha
type
(Required) The type of viewer. Valid values for this property are:
  • ADAS_VIEWER_CAMERA
  • ADAS_VIEWER_POINT_CLOUD
  • ADAS_VIEWER_OVERLAY
See adas_viewer_type_t.
view
(Required) The view that you want to initially display. You can use the ADAS API to dynamically change the view in your application. Valid values for this property are:
  • ADAS_VIEW_BIRDSEYE
  • ADAS_VIEW_MOSAIC_2X2
  • ADAS_VIEW_ISOMETRIC
  • ADAS_VIEW_FORWARD
  • ADAS_VIEW_BACKWARD
  • ADAS_VIEW_DRIVER
  • ADAS_VIEW_RADAR
  • ADAS_VIEW_NAVIGATION
For descriptions of each of the views, see adas_view_t.
visible
(Optional) An indicator of whether the viewer is visible (true) or invisible (false). You can use the ADAS API to dynamically change the visibility in your application. If not specified, the default is false. For example:
...
            "visible": true,
...
                        
zoom_factor
(Optional) The initial zoom factor to use. If not specified, the default is 1. For example:
...
            "zoom_factor": 1,
...
                        
z_order
(Optional) The initial Z-order to use. If not specified, the default is 0. For example:
...
            "z_order": 1,
...
                        
There are type-specific properties that you need to define the viewer. You may define these following properties depending on the type that you specify:
ADAS_VIEWER_CAMERA
layouts
(Required) An array view and layout pairs. Each element in this array is defined by the following data:
  • view
  • layout
where view is one of adas_view_t, and layout is the name of a camera or overlay layout that's defined in your configuration file. For example, if in your configuration file you have this entry:
...
    "camera_layout_1": [
        {
            "input": "forward_camera",
            "theta": 100,
            "rotation": {
                "yaw": 0,
                "pitch": 0,
                "roll": 0
            },
            "source_type": "texture",
            "destination_type": "full_screen"
        }
    ],
...
                                    
then you can specify camera_layout_1 (the name of the camera layout) as the layout property in an entry of your layouts array for your viewer. For example:
...
            "layouts" : [
                {
                    "view": "ADAS_VIEW_FORWARD",
                    "layout": "camera_layout_1"
                },
                ...
            ]
...
                                    
ADAS_VIEWER_OVERLAY
enable_hud
(Optional) An indicator to enable (true) or disable (false) the heads-up display (e.g., extra information that's overlaid based on track such as distance and speed for radar). For example:
...
            "enable_hud": true,
...
                                    
input
(Required) An array of one or more inputs to associate with this viewer. Each element in this array is defined by the id data. What you specify as the id must correspond to the id of one of the entries in your input array. For example, if in your input array, you have this element:
...
    "input": [
        ...
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_5",            
            "id": "primary_gps"
        },
        ...
     ]
...
                                    
then you can specify primary_gps as the id property in an element of your input array for your viewer. For example:
...
        {
            "type": "ADAS_VIEWER_OVERLAY",
            "input": [
                { 
                    "id": "primary_gps"
                },
                { 
                    "id": "primary_imu"
                }
            ],
...
                                    
Note: Overlay viewers support only GPS or IMU inputs.
layouts
(Required) An array view and layout pairs. Each element in this array is defined by the following data:
  • view
  • layout
where view is one of adas_view_t, and layout is the name of a camera or overlay layout that's defined in your configuration file. For example, if in your configuration file you have this element:
...
    "overlay_layout_1": [
        {
            "type": "widget",
            "path": "/usr/share/images/car.png",
            "width": 18000,
            "length": 45000,
            "height": 15000
       }
    ],
...
                                    
then you can specify camera_layout_1 (the name of the camera layout) as the layout property in an element of your layouts array for your viewer. For example:
...
            "layouts" : [
                {
                    "view": "ADAS_VIEW_RADAR",
                    "layout": "overlay_layout_1"
                },
                ...
            ]
...
                                    
parent
(Required) The viewer on which to apply this overlay. The value is the index of the viewer that's configured in the viewer array in your configuration file. The index is in range [1..n] where n is the total number of viewers in your viewer array. For example, if in your viewer array, you have these entries:
...
    "viewer": [
        {
            "type": "ADAS_VIEWER_CAMERA",
            ...
        },
        {
            "type": "ADAS_VIEWER_POINT_CLOUD",
            ...
        },
        {
            "type": "ADAS_VIEWER_OVERLAY",
            ...
        },
        {
            "type": "ADAS_VIEWER_OVERLAY",
            ...
    ],
...
                                    
then you can specify 2 (the viewer whose type is ADAS_VIEWER_OVERLAY) as the instance property in an element of your output array for your algorithm. For example:
...
        {
            "type": "ADAS_VIEWER_OVERLAY",
            ...
            "parent": 2,
            ...
        },
...
                        
ADAS_VIEWER_POINT_CLOUD
position
(Required) The position in the 3D-coordinate system. The position must be specified with the following data:
  • x
  • y
  • z
For example:
...
            "position": {
                "x": -1245,
                "y": -932,
                "z": 0
            },
...
                                    
dimensions
(Required) The dimension of the viewer. The dimension must be specified with the following data:
  • width
  • height
  • depth
For example:
...
            "dimensions": {
                "width": 1864,
                "height": 1475,
                "depth": 4925
            }
...
                                    
input
(Required) An array of one or more inputs to associate with this viewer. Each entry in this list is defined by the id data. What you specify as the id must correspond to the id of one of the entries in your input array. For example, if in your input array, you have this entry:
...
    "input": [
        ...
        {
            "source": "sensor",            
            "name": "vlp-16",
            "id": "front_lidar"
        },
        ...
     ]
...
                                    
then you can specify front_lidar as the id property in an entry of your input array for your viewer. For example:
...
        {
            "type": "ADAS_VIEWER_POINT_CLOUD",
            "input": [
                { 
                    "id": "front_lidar"
                }
            ],
...
                                    
Note: Point cloud viewers support only 3D lidar inputs.
persistence
(Optional) An indicator of how long (in milliseconds) to persist the points that are drawn on the display. If not specified, the default is 1000 milliseconds.
range
(Required) The range of data to display in the 3D-coordinate system (assuming a zoome_factor of 1). The range must be specified with the following data:
  • x
  • y
  • z
For example:
...
            "range": {
                "x": 10000,
                "y": 5625,
                "z": 5000
            },
...