diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index e99d61e4c1..5ffe043734 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -27,12 +27,17 @@ def load_interfaces(brand_names): for brand_name in brand_names: path = ('selfdrive.car.%s' % brand_name) CarInterface = __import__(path + '.interface', fromlist=['CarInterface']).CarInterface + + if os.path.exists(BASEDIR + '/' + path.replace('.', '/') + '/carstate.py'): + CarState = __import__(path + '.carstate', fromlist=['CarState']).CarState + else: + CarState = None + if os.path.exists(BASEDIR + '/' + path.replace('.', '/') + '/carcontroller.py'): CarController = __import__(path + '.carcontroller', fromlist=['CarController']).CarController - CarState = __import__(path + '.carstate', fromlist=['CarState']).CarState else: CarController = None - CarState = None + for model_name in brand_names[brand_name]: ret[model_name] = (CarInterface, CarController, CarState) return ret