mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 06:22:06 +08:00
VW MQB: Cleanup and prep for gateway integration (#21667)
* cleanup and scoping fixes * static analysis feels sad without this * remove extra read of clutch switch signal * don't check Motor_14 unless it's needed * collect short CP/CS aliases together
This commit is contained in:
@@ -76,15 +76,8 @@ class CarState(CarStateBase):
|
||||
# We use the speed preference for OP.
|
||||
self.displayMetricUnits = not pt_cp.vl["Einheiten_01"]["KBI_MFA_v_Einheit_02"]
|
||||
|
||||
# Consume blind-spot monitoring info/warning LED states, if available. The
|
||||
# info signal (LED on) is enabled whenever a vehicle is detected in the
|
||||
# driver's blind spot. The warning signal (LED flashing) is enabled if the
|
||||
# driver shows possibly hazardous intent toward a BSM detected vehicle, by
|
||||
# setting the turn signal in that direction, or (for cars with factory Lane
|
||||
# Assist) approaches the lane boundary in that direction. Size of the BSM
|
||||
# detection box is dynamic based on speed and road curvature.
|
||||
# Refer to VW Self Study Program 890253: Volkswagen Driver Assist Systems,
|
||||
# pages 32-35.
|
||||
# Consume blind-spot monitoring info/warning LED states, if available.
|
||||
# Infostufe: BSM LED on, Warnung: BSM LED flashing
|
||||
if self.CP.enableBsm:
|
||||
ret.leftBlindspot = bool(pt_cp.vl["SWA_01"]["SWA_Infostufe_SWA_li"]) or bool(pt_cp.vl["SWA_01"]["SWA_Warnung_SWA_li"])
|
||||
ret.rightBlindspot = bool(pt_cp.vl["SWA_01"]["SWA_Infostufe_SWA_re"]) or bool(pt_cp.vl["SWA_01"]["SWA_Warnung_SWA_re"])
|
||||
@@ -180,7 +173,6 @@ class CarState(CarStateBase):
|
||||
("ESP_Fahrer_bremst", "ESP_05", 0), # Brake pedal pressed
|
||||
("ESP_Bremsdruck", "ESP_05", 0), # Brake pressure applied
|
||||
("MO_Fahrpedalrohwert_01", "Motor_20", 0), # Accelerator pedal value
|
||||
("MO_Kuppl_schalter", "Motor_14", 0), # Clutch switch
|
||||
("EPS_Lenkmoment", "LH_EPS_03", 0), # Absolute driver torque input
|
||||
("EPS_VZ_Lenkmoment", "LH_EPS_03", 0), # Driver torque input sign
|
||||
("EPS_HCA_Status", "LH_EPS_03", 3), # EPS HCA control status
|
||||
@@ -213,7 +205,6 @@ class CarState(CarStateBase):
|
||||
("ESP_02", 50), # From J104 ABS/ESP controller
|
||||
("GRA_ACC_01", 33), # From J533 CAN gateway (via LIN from steering wheel controls)
|
||||
("Gateway_72", 10), # From J533 CAN gateway (aggregated data)
|
||||
("Motor_14", 10), # From J623 Engine control module
|
||||
("Airbag_02", 5), # From J234 Airbag control module
|
||||
("Kombi_01", 2), # From J285 Instrument cluster
|
||||
("Blinkmodi_02", 1), # From J519 BCM (sent at 1Hz when no lights active, 50Hz when active)
|
||||
|
||||
@@ -20,29 +20,25 @@ class CarInterface(CarInterfaceBase):
|
||||
@staticmethod
|
||||
def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None):
|
||||
ret = CarInterfaceBase.get_std_params(candidate, fingerprint)
|
||||
|
||||
# VW port is a community feature, since we don't own one to test
|
||||
ret.carName = "volkswagen"
|
||||
ret.communityFeature = True
|
||||
ret.radarOffCan = True
|
||||
|
||||
if True: # pylint: disable=using-constant-test
|
||||
# Set common MQB parameters that will apply globally
|
||||
ret.carName = "volkswagen"
|
||||
ret.radarOffCan = True
|
||||
# Set global MQB parameters
|
||||
ret.safetyModel = car.CarParams.SafetyModel.volkswagen
|
||||
ret.steerActuatorDelay = 0.05
|
||||
ret.enableBsm = 0x30F in fingerprint[0]
|
||||
|
||||
if 0xAD in fingerprint[0]:
|
||||
# Getriebe_11 detected: traditional automatic or DSG gearbox
|
||||
if 0xAD in fingerprint[0]: # Getriebe_11
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
elif 0x187 in fingerprint[0]:
|
||||
# EV_Gearshift detected: e-Golf or similar direct-drive electric
|
||||
elif 0x187 in fingerprint[0]: # EV_Gearshift
|
||||
ret.transmissionType = TransmissionType.direct
|
||||
else:
|
||||
# No trans message at all, must be a true stick-shift manual
|
||||
else: # No trans message at all, must be a true stick-shift manual
|
||||
ret.transmissionType = TransmissionType.manual
|
||||
|
||||
# Global tuning defaults, can be overridden per-vehicle
|
||||
|
||||
ret.steerActuatorDelay = 0.05
|
||||
ret.steerRateCost = 1.0
|
||||
ret.steerLimitTimer = 0.4
|
||||
ret.steerRatio = 15.6 # Let the params learner figure this out
|
||||
@@ -56,85 +52,68 @@ class CarInterface(CarInterfaceBase):
|
||||
# Per-chassis tuning values, override tuning defaults here if desired
|
||||
|
||||
if candidate == CAR.ATLAS_MK1:
|
||||
# Averages of all CA Atlas variants
|
||||
ret.mass = 2011 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.98
|
||||
|
||||
elif candidate == CAR.GOLF_MK7:
|
||||
# Averages of all AU Golf variants
|
||||
ret.mass = 1397 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.62
|
||||
|
||||
elif candidate == CAR.JETTA_MK7:
|
||||
# Averages of all BU Jetta variants
|
||||
ret.mass = 1328 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.71
|
||||
|
||||
elif candidate == CAR.PASSAT_MK8:
|
||||
# Averages of all 3C Passat variants
|
||||
ret.mass = 1551 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.79
|
||||
|
||||
elif candidate == CAR.TIGUAN_MK2:
|
||||
# Average of SWB and LWB variants
|
||||
ret.mass = 1715 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.74
|
||||
|
||||
elif candidate == CAR.TOURAN_MK2:
|
||||
# Average of SWB and LWB variants
|
||||
ret.mass = 1516 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.79
|
||||
|
||||
elif candidate == CAR.AUDI_A3_MK3:
|
||||
# Averages of all 8V A3 variants
|
||||
ret.mass = 1335 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.61
|
||||
|
||||
elif candidate == CAR.AUDI_Q2_MK1:
|
||||
# Averages of all GA Q2 variants
|
||||
ret.mass = 1205 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.61
|
||||
|
||||
elif candidate == CAR.SEAT_ATECA_MK1:
|
||||
# Averages of all 5F Ateca variants
|
||||
ret.mass = 1900 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.64
|
||||
|
||||
elif candidate == CAR.SEAT_LEON_MK3:
|
||||
# Averages of all 5F Leon variants
|
||||
ret.mass = 1227 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.64
|
||||
|
||||
elif candidate == CAR.SKODA_KODIAQ_MK1:
|
||||
# Averages of all 5N Kodiaq variants
|
||||
ret.mass = 1569 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.79
|
||||
|
||||
elif candidate == CAR.SKODA_OCTAVIA_MK3:
|
||||
# Averages of all 5E/NE Octavia variants
|
||||
ret.mass = 1388 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.68
|
||||
|
||||
elif candidate == CAR.SKODA_SCALA_MK1:
|
||||
# Averages of all NW Scala variants
|
||||
ret.mass = 1192 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.65
|
||||
|
||||
elif candidate == CAR.SKODA_SUPERB_MK3:
|
||||
# Averages of all 3V/NP Scala variants
|
||||
ret.mass = 1505 + STD_CARGO_KG
|
||||
ret.wheelbase = 2.84
|
||||
|
||||
ret.centerToFront = ret.wheelbase * 0.45
|
||||
|
||||
ret.enableBsm = 0x30F in fingerprint[0]
|
||||
|
||||
# TODO: get actual value, for now starting with reasonable value for
|
||||
# civic and scaling by mass and wheelbase
|
||||
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)
|
||||
|
||||
# TODO: start from empirically derived lateral slip stiffness for the civic and scale by
|
||||
# mass and CG position, so all cars will have approximately similar dyn behaviors
|
||||
ret.centerToFront = ret.wheelbase * 0.45
|
||||
ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront,
|
||||
tire_stiffness_factor=tire_stiffness_factor)
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ from typing import Dict
|
||||
|
||||
from cereal import car
|
||||
from selfdrive.car import dbc_dict
|
||||
|
||||
Ecu = car.CarParams.Ecu
|
||||
TransmissionType = car.CarParams.TransmissionType
|
||||
GearShifter = car.CarState.GearShifter
|
||||
|
||||
class CarControllerParams:
|
||||
HCA_STEP = 2 # HCA_01 message frequency 50Hz
|
||||
@@ -34,9 +37,6 @@ class DBC_FILES:
|
||||
|
||||
DBC = defaultdict(lambda: dbc_dict(DBC_FILES.mqb, None)) # type: Dict[str, Dict[str, str]]
|
||||
|
||||
TransmissionType = car.CarParams.TransmissionType
|
||||
GearShifter = car.CarState.GearShifter
|
||||
|
||||
BUTTON_STATES = {
|
||||
"accelCruise": False,
|
||||
"decelCruise": False,
|
||||
|
||||
Reference in New Issue
Block a user