def parse_error(path):
    vehicles = multi_vehicle_utils.get_vehicle(path)
    pb_value = vehicle_config_pb2.VehicleConfig()
    for vehicle in vehicles:
        conf = os.path.join(path, vehicle, ConfFile)
        try:
            proto_utils.get_pb_from_text_file(conf, pb_value)
            return False
        except text_format.ParseError:
            glog.error('Error: Cannot parse %s as binary or text proto' % conf)
            return True
def missing_file(path):
    vehicles = multi_vehicle_utils.get_vehicle(path)
    glog.info("vehicles %s" % vehicles)
    for vehicle in vehicles:
        # config file
        conf = os.path.join(path, vehicle, ConfFile)
        glog.info("vehicles conf %s" % conf)
        if os.path.exists(conf) is False:
            glog.error('Missing configuration file in %s' % vehicle)
            return True
        # record file
        glog.info("list of records:" % list_records(os.path.join(path, vehicle)))
        if len(list_records(os.path.join(path, vehicle))) == 0:
            glog.error('No record files in %s' % vehicle)
            return True
    return False
def missing_field(path):
    vehicles = multi_vehicle_utils.get_vehicle(path)
    glog.info("vehicles in missing field: %s" % vehicles)
    for vehicle in vehicles:
        conf_file = os.path.join(path, vehicle, ConfFile)
        glog.info("conf_file: %s" % conf_file)
        # reset for each vehicle to avoid overwrite
        pb_value = vehicle_config_pb2.VehicleConfig()
        conf = proto_utils.get_pb_from_text_file(conf_file, pb_value)
        glog.info("vehicles conf %s" % conf)
        if not check_vehicle_id(conf):
            return True
        # required field
        fields = [conf.vehicle_param.brake_deadzone,
                  conf.vehicle_param.throttle_deadzone,
                  conf.vehicle_param.max_acceleration,
                  conf.vehicle_param.max_deceleration]
        for field in fields:
            if math.isnan(field):
                return True
    return False