|
|
@ -4,7 +4,7 @@ from openpilot.common.conversions import Conversions as CV |
|
|
|
from openpilot.selfdrive.car.interfaces import CarStateBase |
|
|
|
from openpilot.selfdrive.car.interfaces import CarStateBase |
|
|
|
from opendbc.can.parser import CANParser |
|
|
|
from opendbc.can.parser import CANParser |
|
|
|
from openpilot.selfdrive.car.volkswagen.values import DBC, CANBUS, PQ_CARS, NetworkLocation, TransmissionType, GearShifter, \ |
|
|
|
from openpilot.selfdrive.car.volkswagen.values import DBC, CANBUS, PQ_CARS, NetworkLocation, TransmissionType, GearShifter, \ |
|
|
|
CarControllerParams |
|
|
|
CarControllerParams, VolkswagenFlags |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CarState(CarStateBase): |
|
|
|
class CarState(CarStateBase): |
|
|
@ -14,6 +14,7 @@ class CarState(CarStateBase): |
|
|
|
self.button_states = {button.event_type: False for button in self.CCP.BUTTONS} |
|
|
|
self.button_states = {button.event_type: False for button in self.CCP.BUTTONS} |
|
|
|
self.esp_hold_confirmation = False |
|
|
|
self.esp_hold_confirmation = False |
|
|
|
self.upscale_lead_car_signal = False |
|
|
|
self.upscale_lead_car_signal = False |
|
|
|
|
|
|
|
self.eps_stock_values = False |
|
|
|
|
|
|
|
|
|
|
|
def create_button_events(self, pt_cp, buttons): |
|
|
|
def create_button_events(self, pt_cp, buttons): |
|
|
|
button_events = [] |
|
|
|
button_events = [] |
|
|
@ -59,6 +60,11 @@ class CarState(CarStateBase): |
|
|
|
ret.steerFaultPermanent = hca_status in ("DISABLED", "FAULT") |
|
|
|
ret.steerFaultPermanent = hca_status in ("DISABLED", "FAULT") |
|
|
|
ret.steerFaultTemporary = hca_status in ("INITIALIZING", "REJECTED") |
|
|
|
ret.steerFaultTemporary = hca_status in ("INITIALIZING", "REJECTED") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# VW Emergency Assist status tracking and mitigation |
|
|
|
|
|
|
|
self.eps_stock_values = pt_cp.vl["LH_EPS_03"] |
|
|
|
|
|
|
|
if self.CP.flags & VolkswagenFlags.STOCK_HCA_PRESENT: |
|
|
|
|
|
|
|
ret.carFaultedNonCritical = bool(cam_cp.vl["HCA_01"]["EA_Ruckfreigabe"]) or cam_cp.vl["HCA_01"]["EA_ACC_Sollstatus"] > 0 |
|
|
|
|
|
|
|
|
|
|
|
# Update gas, brakes, and gearshift. |
|
|
|
# Update gas, brakes, and gearshift. |
|
|
|
ret.gas = pt_cp.vl["Motor_20"]["MO_Fahrpedalrohwert_01"] / 100.0 |
|
|
|
ret.gas = pt_cp.vl["Motor_20"]["MO_Fahrpedalrohwert_01"] / 100.0 |
|
|
|
ret.gasPressed = ret.gas > 0 |
|
|
|
ret.gasPressed = ret.gas > 0 |
|
|
@ -293,6 +299,11 @@ class CarState(CarStateBase): |
|
|
|
|
|
|
|
|
|
|
|
messages = [] |
|
|
|
messages = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if CP.flags & VolkswagenFlags.STOCK_HCA_PRESENT: |
|
|
|
|
|
|
|
messages += [ |
|
|
|
|
|
|
|
("HCA_01", 1), # From R242 Driver assistance camera, 50Hz if steering/1Hz if not |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
if CP.networkLocation == NetworkLocation.fwdCamera: |
|
|
|
if CP.networkLocation == NetworkLocation.fwdCamera: |
|
|
|
messages += [ |
|
|
|
messages += [ |
|
|
|
# sig_address, frequency |
|
|
|
# sig_address, frequency |
|
|
|