mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 08:16:06 +08:00
GM: separate EV/ICE gas/brake lookup tables (#25354)
* GM: separate EV/ICE gas/brake lookup tables * removed blank line * V are the same * comment better ordering comment comment * Add some delay for the laggy brakes Add some delay for the laggy brakes * move actuator to only acadia * start braking at 0 m/s/s * Revert "start braking at 0 m/s/s" This reverts commit 55c1dee733aab3dc037fb1705c9bd0ace55c849f. * add delay for escalade * revert EV changes * Update selfdrive/car/gm/carcontroller.py * comment * only ACADIA Co-authored-by: Shane Smiskol <shane@smiskol.com>
This commit is contained in:
@@ -5,7 +5,7 @@ from common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from selfdrive.car import apply_std_steer_torque_limits
|
||||
from selfdrive.car.gm import gmcan
|
||||
from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams
|
||||
from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, EV_CAR
|
||||
|
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||
NetworkLocation = car.CarParams.NetworkLocation
|
||||
@@ -68,8 +68,12 @@ class CarController:
|
||||
self.apply_gas = self.params.MAX_ACC_REGEN
|
||||
self.apply_brake = 0
|
||||
else:
|
||||
self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
|
||||
self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
|
||||
if self.CP.carFingerprint in EV_CAR:
|
||||
self.apply_gas = int(round(interp(actuators.accel, self.params.EV_GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
|
||||
self.apply_brake = int(round(interp(actuators.accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
|
||||
else:
|
||||
self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
|
||||
self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
|
||||
|
||||
idx = (self.frame // 4) % 4
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.steerRatio = 14.4 # end to end is 13.46
|
||||
ret.centerToFront = ret.wheelbase * 0.4
|
||||
ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_acadia()
|
||||
ret.longitudinalActuatorDelayUpperBound = 0.5 # large delay to initially start braking
|
||||
|
||||
elif candidate == CAR.BUICK_REGAL:
|
||||
ret.mass = 3779. * CV.LB_TO_KG + STD_CARGO_KG # (3849+3708)/2
|
||||
|
||||
@@ -39,12 +39,16 @@ class CarControllerParams:
|
||||
ACCEL_MAX = 2. # m/s^2
|
||||
ACCEL_MIN = -4. # m/s^2
|
||||
|
||||
GAS_LOOKUP_BP = [-1., 0., ACCEL_MAX]
|
||||
GAS_LOOKUP_V = [MAX_ACC_REGEN, ZERO_GAS, MAX_GAS]
|
||||
BRAKE_LOOKUP_BP = [ACCEL_MIN, -1.]
|
||||
BRAKE_LOOKUP_V = [MAX_BRAKE, 0.]
|
||||
EV_GAS_LOOKUP_BP = [-1., 0., ACCEL_MAX]
|
||||
EV_BRAKE_LOOKUP_BP = [ACCEL_MIN, -1.]
|
||||
|
||||
STEER_THRESHOLD = 1.0
|
||||
# ICE has much less engine braking force compared to regen in EVs,
|
||||
# lower threshold removes some braking deadzone
|
||||
GAS_LOOKUP_BP = [-0.1, 0., ACCEL_MAX]
|
||||
BRAKE_LOOKUP_BP = [ACCEL_MIN, -0.1]
|
||||
|
||||
GAS_LOOKUP_V = [MAX_ACC_REGEN, ZERO_GAS, MAX_GAS]
|
||||
BRAKE_LOOKUP_V = [MAX_BRAKE, 0.]
|
||||
|
||||
|
||||
class CAR:
|
||||
@@ -57,6 +61,10 @@ class CAR:
|
||||
ESCALADE_ESV = "CADILLAC ESCALADE ESV 2016"
|
||||
|
||||
|
||||
EV_CAR = {CAR.VOLT}
|
||||
STEER_THRESHOLD = 1.0
|
||||
|
||||
|
||||
class Footnote(Enum):
|
||||
OBD_II = CarFootnote(
|
||||
'Requires a <a href="https://github.com/commaai/openpilot/wiki/GM#hardware">community built ASCM harness</a>. ' +
|
||||
|
||||
Reference in New Issue
Block a user