def load_lidar_configuration()

in deepracer_systems_pkg/deepracer_systems_pkg/model_loader_module/model_metadata_file_utils.py [0:0]


def load_lidar_configuration(sensors, model_metadata):
    """Helper method to load the LiDAR configuration based on type of
       preprocessing done on the LiDAR data duringthe model training.

    Args:
        sensors (list): List of integers corresponding to the sensor enum values
                        for the trained model.
        model_metadata (dict): JSON object with contents of the model metadata file.

    Returns:
        tuple: Tuple of (error_code, error_message, dictionary with model lidar configuration
               corresponding the preprocessing done on LiDAR data during model training).
    """
    try:
        # Set default values in case the 'lidar configuration' is not defined in model_metadata.json
        model_lidar_config = constants.DEFAULT_LIDAR_CONFIG
        # Set default values for SECTOR_LIDAR if this sensor is used
        if constants.SensorInputKeys.SECTOR_LIDAR in sensors:
            model_lidar_config = constants.DEFAULT_SECTOR_LIDAR_CONFIG
        model_lidar_config[
            constants.ModelMetadataKeys.USE_LIDAR
        ] = sensors and (constants.SensorInputKeys.LIDAR in sensors
                         or constants.SensorInputKeys.SECTOR_LIDAR in sensors)
        # Load the lidar configuration if the model uses lidar and has custom lidar configurations
        if model_lidar_config[constants.ModelMetadataKeys.USE_LIDAR] \
           and constants.ModelMetadataKeys.LIDAR_CONFIG in model_metadata:
            lidar_config = model_metadata[constants.ModelMetadataKeys.LIDAR_CONFIG]
            model_lidar_config[
                constants.ModelMetadataKeys.NUM_LIDAR_SECTORS
            ] = lidar_config[constants.ModelMetadataKeys.NUM_LIDAR_SECTORS]
        return 0, "", model_lidar_config
    except Exception as exc:
        return 1, f"Unable to connect to device with current LiDAR configuration: {exc}", {}