Configuring the ADAS Library

Updated: October 28, 2024

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

Configuration file

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

The configuration file is a JSON-formatted text file. For more information about JSON, see www.json.org/. Keywords in this configuration file are case-sensitive. The content of this file must adhere to JSON format and define the following:
Algorithms
The algorithms that you want to run in your application. See Algorithms.
Camera layouts
The 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 applications. These sensors must correspond to the sensors in the sensor and data configuration files that the Sensor service starts with. See Inputs.
Overlay layouts
The supported overlay layouts that can be used by an 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 sequence is applied continuously, such that when the last element of the list is reached, the sequence restarts from the first element. See Viewer Sequence.

Configuration properties

Configuration example

A typical ADAS library configuration 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
    }
}
   
  翻译: