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 55c1dee733.

* add delay for escalade

* revert EV changes

* Update selfdrive/car/gm/carcontroller.py

* comment

* only ACADIA

Co-authored-by: Shane Smiskol <shane@smiskol.com>
pull/25391/head^2
Tim Wilson 3 years ago committed by GitHub
parent 3afe7464df
commit 2a4020da60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      selfdrive/car/gm/carcontroller.py
  2. 1
      selfdrive/car/gm/interface.py
  3. 16
      selfdrive/car/gm/values.py

@ -5,7 +5,7 @@ from common.realtime import DT_CTRL
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car import apply_std_steer_torque_limits
from selfdrive.car.gm import gmcan 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 VisualAlert = car.CarControl.HUDControl.VisualAlert
NetworkLocation = car.CarParams.NetworkLocation NetworkLocation = car.CarParams.NetworkLocation
@ -68,8 +68,12 @@ class CarController:
self.apply_gas = self.params.MAX_ACC_REGEN self.apply_gas = self.params.MAX_ACC_REGEN
self.apply_brake = 0 self.apply_brake = 0
else: else:
self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) if self.CP.carFingerprint in EV_CAR:
self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) 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 idx = (self.frame // 4) % 4

@ -118,6 +118,7 @@ class CarInterface(CarInterfaceBase):
ret.steerRatio = 14.4 # end to end is 13.46 ret.steerRatio = 14.4 # end to end is 13.46
ret.centerToFront = ret.wheelbase * 0.4 ret.centerToFront = ret.wheelbase * 0.4
ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_acadia() ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_acadia()
ret.longitudinalActuatorDelayUpperBound = 0.5 # large delay to initially start braking
elif candidate == CAR.BUICK_REGAL: elif candidate == CAR.BUICK_REGAL:
ret.mass = 3779. * CV.LB_TO_KG + STD_CARGO_KG # (3849+3708)/2 ret.mass = 3779. * CV.LB_TO_KG + STD_CARGO_KG # (3849+3708)/2

@ -39,13 +39,17 @@ class CarControllerParams:
ACCEL_MAX = 2. # m/s^2 ACCEL_MAX = 2. # m/s^2
ACCEL_MIN = -4. # m/s^2 ACCEL_MIN = -4. # m/s^2
GAS_LOOKUP_BP = [-1., 0., ACCEL_MAX] EV_GAS_LOOKUP_BP = [-1., 0., ACCEL_MAX]
EV_BRAKE_LOOKUP_BP = [ACCEL_MIN, -1.]
# 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] GAS_LOOKUP_V = [MAX_ACC_REGEN, ZERO_GAS, MAX_GAS]
BRAKE_LOOKUP_BP = [ACCEL_MIN, -1.]
BRAKE_LOOKUP_V = [MAX_BRAKE, 0.] BRAKE_LOOKUP_V = [MAX_BRAKE, 0.]
STEER_THRESHOLD = 1.0
class CAR: class CAR:
HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017" HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017"
@ -57,6 +61,10 @@ class CAR:
ESCALADE_ESV = "CADILLAC ESCALADE ESV 2016" ESCALADE_ESV = "CADILLAC ESCALADE ESV 2016"
EV_CAR = {CAR.VOLT}
STEER_THRESHOLD = 1.0
class Footnote(Enum): class Footnote(Enum):
OBD_II = CarFootnote( OBD_II = CarFootnote(
'Requires a <a href="https://github.com/commaai/openpilot/wiki/GM#hardware">community built ASCM harness</a>. ' + 'Requires a <a href="https://github.com/commaai/openpilot/wiki/GM#hardware">community built ASCM harness</a>. ' +

Loading…
Cancel
Save