This commit is contained in:
Your Name
2024-02-05 02:21:21 -06:00
parent 67178ebc4b
commit 9213866846
3 changed files with 17 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CAN_GEARS, CAMERA_SCC_CAR, \
CANFD_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.frogpilot.functions.speed_limit_controller import SpeedLimitController
PREV_BUTTON_SAMPLES = 8
CLUSTER_SAMPLE_RATE = 20 # frames
@@ -295,6 +296,11 @@ class CarState(CarStateBase):
self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING
else cp_cam.vl["CAM_0x2a4"])
if self.CP.nav_msg:
SpeedLimitController.load_state()
SpeedLimitController.car_speed_limit = self.calculate_speed_limit_canfd(self.CP, cp, cp_cam) * speed_conv
SpeedLimitController.write_car_state()
self.custom_speed_up = False
self.custom_speed_down = False
@@ -345,6 +351,10 @@ class CarState(CarStateBase):
return ret
def calculate_speed_limit_canfd(self, CP, cp, cp_cam):
self._speed_limit_clu = cp.vl["CLUSTER_SPEED_LIMIT"]["SPEED_LIMIT_1"]
return self._speed_limit_clu if self._speed_limit_clu not in (0, 255) else 0
def get_can_parser(self, CP):
if CP.carFingerprint in CANFD_CAR:
return self.get_can_parser_canfd(CP)
@@ -462,4 +472,7 @@ class CarState(CarStateBase):
("SCC_CONTROL", 50),
]
if CP.nav_msg:
messages.append(("CLUSTER_SPEED_LIMIT", 10))
return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus(CP).CAM)

View File

@@ -293,9 +293,11 @@ class CarInterface(CarInterfaceBase):
# *** feature detection ***
if candidate in CANFD_CAR:
ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN]
ret.nav_msg = 0x544 in fingerprint[0]
else:
ret.enableBsm = 0x58b in fingerprint[0]
ret.nav_msg = False
# *** panda safety config ***
ret.safetyConfigs = set_safety_config_hyundai(candidate, CAN, can_fd=(candidate in CANFD_CAR))

View File

@@ -151,7 +151,7 @@ void setDefaultParams() {
{"StoppingDistance", FrogsGoMoo ? "6" : "0"},
{"TSS2Tune", "1"},
{"TurnAggressiveness", FrogsGoMoo ? "150" : "100"},
{"TurnDesires", "1"},
{"TurnDesires", "0"},
{"UnlimitedLength", "1"},
{"UseSI", FrogsGoMoo ? "1" : "0"},
{"UseVienna", "0"},