mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-18 23:32:10 +08:00
cache get_torque_params (#32560)
* cache get_torque_params
* switch to cache
* Update selfdrive/car/interfaces.py
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 8f4b00c263
This commit is contained in:
@@ -6,6 +6,7 @@ from abc import abstractmethod, ABC
|
||||
from enum import StrEnum
|
||||
from typing import Any, NamedTuple
|
||||
from collections.abc import Callable
|
||||
from functools import cache
|
||||
|
||||
from cereal import car
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
@@ -43,6 +44,7 @@ class LatControlInputs(NamedTuple):
|
||||
TorqueFromLateralAccelCallbackType = Callable[[LatControlInputs, car.CarParams.LateralTorqueTuning, float, float, bool, bool], float]
|
||||
|
||||
|
||||
@cache
|
||||
def get_torque_params(candidate):
|
||||
with open(TORQUE_SUBSTITUTE_PATH, 'rb') as f:
|
||||
sub = tomllib.load(f)
|
||||
|
||||
Reference in New Issue
Block a user