Configuring ADAS Library

Configuration file

The configuration file must reside where it can be accessible to the ADAS library on your target.

Unless your target system allows for it, modify the configuration file on your host, and then build it into your image. When you call adas_initialize() from your ADAS application, the ADAS library processes the configuration file.

The ADAS library configuration file is a text-based file whose content is in JSON format. For more inforamtion, see www.json.org/. Keywords in the file are case-sensitive. The content of this file must adhere to JSON format to define the following:

Algorithms
The algorithms that you want to run in your application.

See “Algorithm.”

Camera layouts
Supported camera layouts that can be used by a camera viewer.

See “Camera Layout.”

Display
The display to use.

See “Display.”

Inputs
The sensors that are available to your ADAS application. These sensors must correspond to the sensors that have are in the sensor and data configuration files that the sensor service starts with.

See “Input.”

Overlay layouts
Supported overlay layouts that can be used by a overlay viewer.

See “Overlay Layout.”

Viewers
The viewers that the application uses.

See “Viewer.”

Viewer sequences
A list of modifications for the viewers to apply sequentially with an optional delay between each list entry. For example, you can switch the view, visibility and zoom of viewers to demonstrate different options without the need for user intervention. The viewer sequnece is applied continuously such that when the last entry of the list is reached, the sequence restarts from the first entry again.

See “Viewer Sequence.”

Configuration attributes

Within each of the entries of your configuration file, you specify the corresponding attributes. For reference purposes, the complete list of attributes by configuration entry is as follows:

Algorithm:
Camera layout:
Display:
Input:
Overlay layout:
Viewer:
Viewer Sequence:

Configuration example

A typical ADAS library file may look something like this:

{
    "input": [
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_1",
            "id": "forward_camera"
        },
        {
            "source": "sensor",
            "name": "vlp-16",
            "id": "front_lidar"
        },
        {
            "source": "sensor",
            "type": "radar",
            "id": "front_radar"
        },
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_4",
            "id": "side_lidar"
        },
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_5",
            "id": "primary_gps"
        },
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_6",
            "id": "primary_imu"
        },
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_7",
            "id": "secondary_gps"
        },
        {
            "source": "sensor",
            "instance": "SENSOR_UNIT_8",
            "id": "secondary_imu"
        }
    ],
    "camera_layout_1": [
        {
            "input": "forward_camera",
            "theta": 100,
            "rotation": {
                "yaw": 0,
                "pitch": 0,
                "roll": 0
            },
            "source_type": "texture",
            "destination_type": "full_screen"
        }
    ],
    "overlay_layout_1": [
        {
            "type": "widget",
            "path": "/usr/share/images/car.png",
            "width": 18000,
            "length": 45000,
            "height": 15000
       }
    ],
    "overlay_layout_2": [
        {
            "type": "widget",
            "path": "/usr/share/images/car.png",
            "width": 18000,
            "length": 45000,
            "height": 15000
       }
    ],
    "overlay_layout_3": [
        {
            "type": "rectangle",
            "corner_radius": 10,
            "line_width": 5,
            "line_color": {
                "red": 0.8,
                "green": 0.8,
                "blue": 0.8,
                "alpha": 1.0
            },
            "fill_color": {
                "red": 0.3,
                "green": 0.3,
                "blue": 0.3,
                "alpha": 1.0
            },
            "x": 0.37,
            "y": 0.02,
            "width": 0.26,
            "height": 0.08
        },
        {
            "type": "label",
            "string": "Front",
            "font_size": 40,
            "bold": true,
            "text_color": {
                "red": 1.0,
                "green": 1.0,
                "blue": 1.0,
                "alpha": 1.0
            },
            "x": 0.46,
            "y": 0.08,
            "width": 0.25,
            "height": 0.2
        }
    ],
    "overlay_layout_4": [
        {
            "type": "rectangle",
            "corner_radius": 10,
            "line_width": 5,
            "line_color": {
                "red": 0.8,
                "green": 0.8,
                "blue": 0.8,
                "alpha": 1.0
            },
            "fill_color": {
                "red": 0.3,
                "green": 0.3,
                "blue": 0.3,
                "alpha": 1.0
            },
            "x": 0.37,
            "y": 0.02,
            "width": 0.26,
            "height": 0.08
        },
        {
            "type": "label",
            "string": "Driver",
            "font_size": 40,
            "bold": true,
            "text_color": {
                "red": 1.0,
                "green": 1.0,
                "blue": 1.0,
                "alpha": 1.0
            },
            "x": 0.46,
            "y": 0.08,
            "width": 0.25,
            "height": 0.2
        }
    ],
    "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,
            "avatar_position": {
                "x": -1245,
                "y": -932,
                "z": 0
            },
            "avatar_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"
                }
            ]
        }
    ],
    "algorithm": [
        {
            "id": "ADAS_ALGO_MOTION_DETECTION",
            "input": [
                {
                    "id": "forward_camera"
                }
            ],
            "output": [
                {
                    "type": "viewer",
                    "instance": 4
                }
            ]
        },
        {
            "id": "ADAS_ALGO_LIDAR_GROUPING",
            "input": [
                {
                    "id": "side_lidar"
                }
            ],
            "output": [
                {
                    "type": "viewer",
                    "instance": 3
                }
            ]
        },
        {
            "id": "ADAS_ALGO_RADAR_GROUPING",
            "input": [
                {
                    "id": "front_radar"
                }
            ],
            "output": [
                {
                    "type": "viewer",
                    "instance": 2
                }
            ]
        }
    ],
    "viewer_sequence_1": [
        {
            "instance": 1,
            "visible": false
        },
        {
            "instance": 4,
            "visible": false
        },
        {
            "instance": 2,
            "view": "ADAS_VIEW_ISOMETRIC",
            "zoom_factor": 2
        },
        {
            "instance": 2,
            "visible": true
        },
        {
            "instance": 3,
            "visible": true,
            "sleep_ms": 10000
        },
        {
            "instance": 2,
            "view": "ADAS_VIEW_ISOMETRIC",
            "zoom_factor": 4,
            "sleep_ms": 6000
        },
        {
            "instance": 2,
            "view": "ADAS_VIEW_BIRDSEYE",
            "zoom_factor": 2,
            "sleep_ms": 6000
        },
        {
            "instance": 2,
            "view": "ADAS_VIEW_BIRDSEYE",
            "zoom_factor": 1,
            "sleep_ms": 6000
        },
        {
            "instance": 2,
            "visible": false
        },
        {
            "instance": 3,
            "visible": false
        },
        {
            "instance": 1,
            "view": "ADAS_VIEW_FORWARD",
            "zoom_factor": 1
        },
        {
            "instance": 1,
            "visible": true
        },
        {
            "instance": 4,
            "visible": true,
            "sleep_ms": 15000
        },
        {
            "instance": 1,
            "view": "ADAS_VIEW_RADAR",
            "zoom_factor": 1,
            "sleep_ms": 6000
        },
        {
            "instance": 1,
            "view": "ADAS_VIEW_NAVIGATION",
            "zoom_factor": 2,
            "sleep_ms": 6000
        }
    ],
    "display" : {
        "instance": 0
    }
}