mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 19:33:49 +08:00
Car interface: set max lateral torque from table (#24789)
* json
* better naem
* Read from table
* formatting and default to nan
* Generate docs
* Read from table
* this should be the same
* Prius v is full
* test we always set the tunes correctly
add to release files
* Set for all cars
Set for all cars
* Revert tuning changes
Revert tuning changes
* remove that
* fixes
* update ref commit for new maxLateralAccels
Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 3066ad81a8
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
from abc import abstractmethod, ABC
|
||||
@@ -19,6 +20,7 @@ EventName = car.CarEvent.EventName
|
||||
MAX_CTRL_SPEED = (V_CRUISE_MAX + 4) * CV.KPH_TO_MS
|
||||
ACCEL_MAX = 2.0
|
||||
ACCEL_MIN = -3.5
|
||||
TORQUE_PARAMS_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data.json')
|
||||
|
||||
|
||||
# generic car and radar interfaces
|
||||
@@ -81,7 +83,7 @@ class CarInterfaceBase(ABC):
|
||||
ret.steerControlType = car.CarParams.SteerControlType.torque
|
||||
ret.minSteerSpeed = 0.
|
||||
ret.wheelSpeedFactor = 1.0
|
||||
ret.maxLateralAccel = float('nan')
|
||||
ret.maxLateralAccel = CarInterfaceBase.get_torque_params(candidate)['MAX_LAT_ACCEL_MEASURED']
|
||||
|
||||
ret.pcmCruise = True # openpilot's state is tied to the PCM's cruise state on most cars
|
||||
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
|
||||
@@ -105,6 +107,12 @@ class CarInterfaceBase(ABC):
|
||||
ret.steerLimitTimer = 1.0
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def get_torque_params(candidate, default=float('NaN')):
|
||||
with open(TORQUE_PARAMS_PATH) as f:
|
||||
data = json.load(f)
|
||||
return {key: data[key].get(candidate, default) for key in data}
|
||||
|
||||
@abstractmethod
|
||||
def _update(self, c: car.CarControl) -> car.CarState:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user