Skip to content

Commit

Permalink
cache get_torque_params (commaai#32560)
Browse files Browse the repository at this point in the history
* cache get_torque_params

* switch to cache

* Update selfdrive/car/interfaces.py

---------

Co-authored-by: Shane Smiskol <[email protected]>
old-commit-hash: 8f4b00c
  • Loading branch information
cl0cks4fe and sshane authored May 31, 2024
1 parent ab16c70 commit e77b75d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions selfdrive/car/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e77b75d

Please sign in to comment.