|
|
|
@ -27,7 +27,7 @@ class CarState(CarStateBase): |
|
|
|
|
|
|
|
|
|
ret.vEgoRaw = float(np.mean([ret.wheelSpeeds.fl, ret.wheelSpeeds.fr, ret.wheelSpeeds.rl, ret.wheelSpeeds.rr])) |
|
|
|
|
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) |
|
|
|
|
ret.standstill = bool(pt_cp.vl["ESP_21"]["ESP_Haltebestaetigung"]) |
|
|
|
|
ret.standstill = ret.vEgo < 0.1 |
|
|
|
|
|
|
|
|
|
# Update steering angle, rate, yaw rate, and driver input torque. VW send |
|
|
|
|
# the sign/direction in a separate signal so they must be recombined. |
|
|
|
@ -47,6 +47,7 @@ class CarState(CarStateBase): |
|
|
|
|
ret.gasPressed = ret.gas > 0 |
|
|
|
|
ret.brake = pt_cp.vl["ESP_05"]["ESP_Bremsdruck"] / 250.0 # FIXME: this is pressure in Bar, not sure what OP expects |
|
|
|
|
ret.brakePressed = bool(pt_cp.vl["ESP_05"]["ESP_Fahrer_bremst"]) |
|
|
|
|
self.esp_hold_confirmation = pt_cp.vl["ESP_21"]["ESP_Haltebestaetigung"] |
|
|
|
|
|
|
|
|
|
# Update gear and/or clutch position data. |
|
|
|
|
if trans_type == TransmissionType.automatic: |
|
|
|
@ -94,13 +95,13 @@ class CarState(CarStateBase): |
|
|
|
|
ret.stockAeb = bool(ext_cp.vl["ACC_10"]["ANB_Teilbremsung_Freigabe"]) or bool(ext_cp.vl["ACC_10"]["ANB_Zielbremsung_Freigabe"]) |
|
|
|
|
|
|
|
|
|
# Update ACC radar status. |
|
|
|
|
accStatus = pt_cp.vl["TSK_06"]["TSK_Status"] |
|
|
|
|
if accStatus == 2: |
|
|
|
|
self.tsk_status = pt_cp.vl["TSK_06"]["TSK_Status"] |
|
|
|
|
if self.tsk_status == 2: |
|
|
|
|
# ACC okay and enabled, but not currently engaged |
|
|
|
|
ret.cruiseState.available = True |
|
|
|
|
ret.cruiseState.enabled = False |
|
|
|
|
elif accStatus in [3, 4, 5]: |
|
|
|
|
# ACC okay and enabled, currently engaged and regulating speed (3) or engaged with driver accelerating (4) or overrun (5) |
|
|
|
|
elif self.tsk_status in [3, 4, 5]: |
|
|
|
|
# ACC okay and enabled, currently regulating speed (3) or driver accel override (4) or overrun coast-down (5) |
|
|
|
|
ret.cruiseState.available = True |
|
|
|
|
ret.cruiseState.enabled = True |
|
|
|
|
else: |
|
|
|
@ -110,9 +111,10 @@ class CarState(CarStateBase): |
|
|
|
|
|
|
|
|
|
# Update ACC setpoint. When the setpoint is zero or there's an error, the |
|
|
|
|
# radar sends a set-speed of ~90.69 m/s / 203mph. |
|
|
|
|
ret.cruiseState.speed = ext_cp.vl["ACC_02"]["ACC_Wunschgeschw"] * CV.KPH_TO_MS |
|
|
|
|
if ret.cruiseState.speed > 90: |
|
|
|
|
ret.cruiseState.speed = 0 |
|
|
|
|
if self.CP.pcmCruise: |
|
|
|
|
ret.cruiseState.speed = ext_cp.vl["ACC_02"]["ACC_Wunschgeschw"] * CV.KPH_TO_MS |
|
|
|
|
if ret.cruiseState.speed > 90: |
|
|
|
|
ret.cruiseState.speed = 0 |
|
|
|
|
|
|
|
|
|
# Update control button states for turn signals and ACC controls. |
|
|
|
|
self.buttonStates["accelCruise"] = bool(pt_cp.vl["GRA_ACC_01"]["GRA_Tip_Hoch"]) |
|
|
|
|