EV6 blinkers (#26618)

* right blink

* left blink

* rm debug

* just the support code

* revert panda

* behind flag
pull/26770/head
Adeeb Shihadeh 2 years ago committed by GitHub
parent 7548160dcd
commit c9b8f6457e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      opendbc
  2. 9
      selfdrive/car/hyundai/carcontroller.py
  3. 20
      selfdrive/car/hyundai/hyundaicanfd.py
  4. 4
      selfdrive/car/hyundai/interface.py
  5. 2
      selfdrive/car/hyundai/values.py

@ -1 +1 @@
Subproject commit 94fff4782be263efad10032a612b3c96a120c0b7 Subproject commit 1f8aa057bc1c96fcf8a2b612a9897ce91e627381

@ -83,11 +83,16 @@ class CarController:
# tester present - w/ no response (keeps relevant ECU disabled) # tester present - w/ no response (keeps relevant ECU disabled)
if self.frame % 100 == 0 and not (self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value) and self.CP.openpilotLongitudinalControl: if self.frame % 100 == 0 and not (self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value) and self.CP.openpilotLongitudinalControl:
# for longitudinal control, either radar or ADAS driving ECU
addr, bus = 0x7d0, 0 addr, bus = 0x7d0, 0
if self.CP.flags & HyundaiFlags.CANFD_HDA2.value: if self.CP.flags & HyundaiFlags.CANFD_HDA2.value:
addr, bus = 0x730, 5 addr, bus = 0x730, 5
can_sends.append([addr, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", bus]) can_sends.append([addr, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", bus])
# for blinkers
if self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
can_sends.append([0x7b1, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", 5])
# >90 degree steering fault prevention # >90 degree steering fault prevention
# Count up to MAX_ANGLE_FRAMES, at which point we need to cut torque to avoid a steering fault # Count up to MAX_ANGLE_FRAMES, at which point we need to cut torque to avoid a steering fault
if CC.latActive and abs(CS.out.steeringAngleDeg) >= MAX_ANGLE: if CC.latActive and abs(CS.out.steeringAngleDeg) >= MAX_ANGLE:
@ -118,6 +123,10 @@ class CarController:
if self.frame % 5 == 0 and (not hda2 or hda2_long): if self.frame % 5 == 0 and (not hda2 or hda2_long):
can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CP, CC.enabled)) can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CP, CC.enabled))
# blinkers
if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.frame, False, False))
if self.CP.openpilotLongitudinalControl: if self.CP.openpilotLongitudinalControl:
if hda2: if hda2:
can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.frame)) can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.frame))

@ -1,7 +1,6 @@
from common.numpy_fast import clip from common.numpy_fast import clip
from selfdrive.car.hyundai.values import HyundaiFlags from selfdrive.car.hyundai.values import HyundaiFlags
def get_e_can_bus(CP): def get_e_can_bus(CP):
# On the CAN-FD platforms, the LKAS camera is on both A-CAN and E-CAN. HDA2 cars # On the CAN-FD platforms, the LKAS camera is on both A-CAN and E-CAN. HDA2 cars
# have a different harness than the HDA1 and non-HDA variants in order to split # have a different harness than the HDA1 and non-HDA variants in order to split
@ -98,6 +97,25 @@ def create_acc_control(packer, CP, enabled, accel_last, accel, stopping, gas_ove
return packer.make_can_msg("SCC_CONTROL", get_e_can_bus(CP), values) return packer.make_can_msg("SCC_CONTROL", get_e_can_bus(CP), values)
def create_spas_messages(packer, frame, left_blink, right_blink):
ret = []
values = {
}
ret.append(packer.make_can_msg("SPAS1", 5, values))
blink = 0
if left_blink:
blink = 3
elif right_blink:
blink = 4
values = {
"BLINKER_CONTROL": blink,
}
ret.append(packer.make_can_msg("SPAS2", 5, values))
return ret
def create_adrv_messages(packer, frame): def create_adrv_messages(packer, frame):
# messages needed to car happy after disabling # messages needed to car happy after disabling

@ -287,6 +287,10 @@ class CarInterface(CarInterfaceBase):
addr, bus = 0x730, 5 addr, bus = 0x730, 5
disable_ecu(logcan, sendcan, bus=bus, addr=addr, com_cont_req=b'\x28\x83\x01') disable_ecu(logcan, sendcan, bus=bus, addr=addr, com_cont_req=b'\x28\x83\x01')
# for blinkers
if CP.flags & HyundaiFlags.ENABLE_BLINKERS:
disable_ecu(logcan, sendcan, bus=5, addr=0x7B1, com_cont_req=b'\x28\x83\x01')
def _update(self, c): def _update(self, c):
ret = self.CS.update(self.cp, self.cp_cam) ret = self.CS.update(self.cp, self.cp_cam)

@ -58,6 +58,8 @@ class HyundaiFlags(IntFlag):
ALT_LIMITS = 16 ALT_LIMITS = 16
ENABLE_BLINKERS = 32
class CAR: class CAR:
# Hyundai # Hyundai

Loading…
Cancel
Save