Skip to content

Commit

Permalink
cache get_torque_params (#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]>
  • Loading branch information
cl0cks4fe and sshane authored May 31, 2024
1 parent f887b87 commit 8f4b00c
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 8f4b00c

Please sign in to comment.