GM: Cleanup & format values.py (#22671)

* cleanup & format gm/values.py like toyota/values.py

* Units and notes
pull/22694/head
qadmus 4 years ago committed by GitHub
parent 7bb13acc45
commit ca476650e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      selfdrive/car/gm/values.py

@ -5,41 +5,40 @@ from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu Ecu = car.CarParams.Ecu
class CarControllerParams(): class CarControllerParams():
def __init__(self): STEER_MAX = 300 # Safety limit, not LKA max. Trucks use 600.
self.STEER_MAX = 300 STEER_STEP = 2 # control frames per command
self.STEER_STEP = 2 # how often we update the steer cmd STEER_DELTA_UP = 7
self.STEER_DELTA_UP = 7 # ~0.75s time to peak torque (255/50hz/0.75s) STEER_DELTA_DOWN = 17
self.STEER_DELTA_DOWN = 17 # ~0.3s from peak torque to zero MIN_STEER_SPEED = 3. # m/s
self.MIN_STEER_SPEED = 3. STEER_DRIVER_ALLOWANCE = 50
self.STEER_DRIVER_ALLOWANCE = 50 # allowed driver torque before start limiting STEER_DRIVER_MULTIPLIER = 4
self.STEER_DRIVER_MULTIPLIER = 4 # weight driver torque heavily STEER_DRIVER_FACTOR = 100
self.STEER_DRIVER_FACTOR = 100 # from dbc NEAR_STOP_BRAKE_PHASE = 0.5 # m/s
self.NEAR_STOP_BRAKE_PHASE = 0.5 # m/s, more aggressive braking near full stop
# Takes case of "Service Adaptive Cruise" and "Service Front Camera" # Heartbeat for dash "Service Adaptive Cruise" and "Service Front Camera"
# dashboard messages. ADAS_KEEPALIVE_STEP = 100
self.ADAS_KEEPALIVE_STEP = 100 CAMERA_KEEPALIVE_STEP = 100
self.CAMERA_KEEPALIVE_STEP = 100
# pedal lookups, only for Volt # Volt gasbrake lookups
MAX_GAS = 3072 # Only a safety limit MAX_GAS = 3072 # Safety limit, not ACC max. Stock ACC >4096 from standstill.
ZERO_GAS = 2048 ZERO_GAS = 2048 # Coasting
MAX_BRAKE = 350 # Should be around 3.5m/s^2, including regen MAX_BRAKE = 350 # ~ -3.5 m/s^2 with regen
self.ACCEL_MAX = 2.0 # m/s^2
# Allow small margin below -3.5 m/s^2 from ISO 15622:2018 since we # Allow small margin below -3.5 m/s^2 from ISO 15622:2018 since we
# perform the closed loop control, and might need some # perform the closed loop control, and might need some
# to apply some more braking if we're on a downhill slope. # to apply some more braking if we're on a downhill slope.
# Our controller should still keep the 2 second average above # Our controller should still keep the 2 second average above
# -3.5 m/s^2 as per planner limits # -3.5 m/s^2 as per planner limits
self.ACCEL_MIN = -4.0 # m/s^2 ACCEL_MAX = 2. # m/s^2
ACCEL_MIN = -4. # m/s^2
MAX_ACC_REGEN = 1404 # Max ACC regen is slightly less than max paddle regen
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.]
self.MAX_ACC_REGEN = 1404 # ACC Regen braking is slightly less powerful than max regen paddle STEER_THRESHOLD = 1.0
self.GAS_LOOKUP_BP = [-1.0, 0., self.ACCEL_MAX]
self.GAS_LOOKUP_V = [self.MAX_ACC_REGEN, ZERO_GAS, MAX_GAS]
self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, -1.0]
self.BRAKE_LOOKUP_V = [MAX_BRAKE, 0]
class CAR: class CAR:
HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017" HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017"
@ -109,8 +108,6 @@ FINGERPRINTS = {
}], }],
} }
STEER_THRESHOLD = 1.0
DBC = { DBC = {
CAR.HOLDEN_ASTRA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.HOLDEN_ASTRA: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'),
CAR.VOLT: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'), CAR.VOLT: dbc_dict('gm_global_a_powertrain', 'gm_global_a_object', chassis_dbc='gm_global_a_chassis'),

Loading…
Cancel
Save