lane change?

This commit is contained in:
firestar5683
2026-04-26 17:36:12 -05:00
parent da61e79f2e
commit e2681b17a4
37 changed files with 69 additions and 4 deletions
@@ -63,6 +63,8 @@ class CarController(CarControllerBase):
self._ecu_disable_checked = False
self._params = Params()
self.long_active_ecu = self.CP.openpilotLongitudinalControl
self._ioniq_6_lane_change_ui_side = None
self._ioniq_6_lane_change_ui_trigger_frames = 0
def update(self, CC, CS, now_nanos, starpilot_toggles):
actuators = CC.actuators
@@ -228,6 +230,24 @@ class CarController(CarControllerBase):
if lka_steering and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.CAN, CC.leftBlinker, CC.rightBlinker))
if self.CP.carFingerprint == CAR.HYUNDAI_IONIQ_6:
lane_change_ui_side = None
if CC.leftBlinker and not CC.rightBlinker:
lane_change_ui_side = "left"
elif CC.rightBlinker and not CC.leftBlinker:
lane_change_ui_side = "right"
if lane_change_ui_side != self._ioniq_6_lane_change_ui_side:
self._ioniq_6_lane_change_ui_side = lane_change_ui_side
self._ioniq_6_lane_change_ui_trigger_frames = 6 if lane_change_ui_side is not None else 0
if lane_change_ui_side is not None:
trigger = self._ioniq_6_lane_change_ui_trigger_frames > 0
can_sends.extend(hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(self.CAN, self.frame,
lane_change_ui_side, trigger))
if self._ioniq_6_lane_change_ui_trigger_frames > 0:
self._ioniq_6_lane_change_ui_trigger_frames -= 1
if self.long_active_ecu:
if lka_steering:
can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.CAN, self.frame))
@@ -264,6 +264,18 @@ IONIQ_6_CLUSTER_BLINDSPOT_3B5 = {
}
IONIQ_6_CLUSTER_LANE_CHANGE_3C1 = {
"right": {
"trigger": bytes.fromhex("e910300041000000"),
"steady": bytes.fromhex("ab20300001000000"),
},
"left": {
"trigger": bytes.fromhex("3d40304010000000"),
"steady": bytes.fromhex("3e50300000000000"),
},
}
def create_ioniq_6_cluster_blindspot_messages(CAN, frame, left_blindspot=False, right_blindspot=False,
left_blinker=False, right_blinker=False):
side = None
@@ -291,6 +303,17 @@ def create_ioniq_6_cluster_blindspot_messages(CAN, frame, left_blindspot=False,
return ret
def create_ioniq_6_cluster_lane_change_messages(CAN, frame, side=None, trigger=False):
if side not in IONIQ_6_CLUSTER_LANE_CHANGE_3C1:
return []
if trigger:
return [(0x3C1, IONIQ_6_CLUSTER_LANE_CHANGE_3C1[side]["trigger"], CAN.ECAN)]
if frame % 20 == 0:
return [(0x3C1, IONIQ_6_CLUSTER_LANE_CHANGE_3C1[side]["steady"], CAN.ECAN)]
return []
def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control):
jerk = 5
jn = jerk / 50
@@ -380,6 +380,27 @@ class TestHyundaiFingerprint:
both_msgs = hyundaicanfd.create_ioniq_6_cluster_blindspot_messages(can_bus, 0, True, True)
assert both_msgs == []
def test_ioniq_6_cluster_lane_change_helper_uses_stock_trigger_and_hold(self):
CP = CarParams.new_message()
CP.carFingerprint = CAR.HYUNDAI_IONIQ_6
CP.flags = int(HyundaiFlags.CANFD | HyundaiFlags.CANFD_LKA_STEERING)
can_bus = CanBus(CP)
assert hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(can_bus, 7, "right") == []
assert hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(can_bus, 0, "right", trigger=True) == [
(0x3C1, bytes.fromhex("e910300041000000"), can_bus.ECAN),
]
assert hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(can_bus, 20, "right") == [
(0x3C1, bytes.fromhex("ab20300001000000"), can_bus.ECAN),
]
assert hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(can_bus, 0, "left", trigger=True) == [
(0x3C1, bytes.fromhex("3d40304010000000"), can_bus.ECAN),
]
assert hyundaicanfd.create_ioniq_6_cluster_lane_change_messages(can_bus, 20, "left") == [
(0x3C1, bytes.fromhex("3e50300000000000"), can_bus.ECAN),
]
def test_sportage_angle_jerk_override_is_scoped(self):
sportage = CarParams.new_message()
sportage.carFingerprint = CAR.KIA_SPORTAGE_HEV_2026
@@ -29,6 +29,7 @@
{0x1E5, e_can, 16, .check_relay = false}, /* BLINDSPOTS_FRONT_CORNER_1 */ \
{0x31A, e_can, 32, .check_relay = false}, /* cluster blindspot overlay */ \
{0x3B5, e_can, 32, .check_relay = false}, /* cluster blindspot overlay */ \
{0x3C1, e_can, 8, .check_relay = false}, /* cluster lane change overlay */ \
// *** Addresses checked in rx hook ***
// EV, ICE, HYBRID: ACCELERATOR (0x35), ACCELERATOR_BRAKE_ALT (0x100), ACCELERATOR_ALT (0x105)
@@ -451,7 +451,7 @@ class TestHyundaiCanfdLKASteeringAltEV(TestHyundaiCanfdBase):
class TestHyundaiCanfdLKASteeringLongEV(HyundaiLongitudinalBase, TestHyundaiCanfdLKASteeringEV):
TX_MSGS = [[0x50, 0], [0x1CF, 1], [0x2A4, 0], [0x51, 0], [0x730, 1], [0x12a, 1], [0x160, 1],
[0x1ba, 1], [0x1e0, 1], [0x1e5, 1], [0x31a, 1], [0x3b5, 1],
[0x1ba, 1], [0x1e0, 1], [0x1e5, 1], [0x31a, 1], [0x3b5, 1], [0x3c1, 1],
[0x1a0, 1], [0x1ea, 1], [0x200, 1], [0x345, 1], [0x1da, 1]]
RELAY_MALFUNCTION_ADDRS = {0: (0x50, 0x2a4), 1: (0x1a0,)} # LKAS, CAM_0x2A4, SCC_CONTROL
@@ -481,7 +481,7 @@ class TestHyundaiCanfdLKASteeringLongEV(HyundaiLongitudinalBase, TestHyundaiCanf
# Tests longitudinal for ICE, hybrid, EV cars with LFA steering
class TestHyundaiCanfdLFASteeringLongBase(HyundaiLongitudinalBase, TestHyundaiCanfdLFASteeringBase):
TX_MSGS = [[0x12A, 0], [0x1A0, 1], [0x1CF, 0], [0x1E0, 0], [0x1BA, 0], [0x1E5, 0], [0x31A, 0], [0x3B5, 0]]
TX_MSGS = [[0x12A, 0], [0x1A0, 1], [0x1CF, 0], [0x1E0, 0], [0x1BA, 0], [0x1E5, 0], [0x31A, 0], [0x3B5, 0], [0x3C1, 0]]
FWD_BLACKLISTED_ADDRS = {2: [0x12a, 0xcb, 0x1e0, 0x1a0, 0x160]}
RELAY_MALFUNCTION_ADDRS = {0: (0x12A, 0xCB, 0x1E0, 0x1a0, 0x160)} # LFA, ADAS_CMD_35_10ms, LFAHDA_CLUSTER, SCC_CONTROL, ADRV_0x160
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,2 +1,2 @@
extern const uint8_t gitversion[19];
const uint8_t gitversion[19] = "DEV-71528fd5-DEBUG";
const uint8_t gitversion[19] = "DEV-da61e79f-DEBUG";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
DEV-71528fd5-DEBUG
DEV-da61e79f-DEBUG