Merge branch 'hkg-can-jerk' into master-dev-c3

This commit is contained in:
Jason Wen
2024-08-01 06:28:27 -04:00
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -234,6 +234,9 @@ class CarController(CarControllerBase):
if self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
can_sends.append([0x7b1, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", self.CAN.ECAN])
if self.CP.openpilotLongitudinalControl:
self.make_jerk(CS, accel, actuators)
# CAN-FD platforms
if self.CP.carFingerprint in CANFD_CAR:
hda2 = self.CP.flags & HyundaiFlags.CANFD_HDA2
@@ -264,7 +267,7 @@ class CarController(CarControllerBase):
can_sends.extend(hyundaicanfd.create_fca_warning_light(self.packer, self.CAN, self.frame))
if self.frame % 2 == 0:
can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled and CS.out.cruiseState.enabled, self.accel_last, accel, stopping, CC.cruiseControl.override,
set_speed_in_units, hud_control))
set_speed_in_units, hud_control, self.jerk_u, self.jerk_l))
self.accel_last = accel
else:
# button presses
@@ -302,8 +305,6 @@ class CarController(CarControllerBase):
self.last_button_frame = self.frame
elif self.frame % 2 == 0:
can_sends.extend([hyundaican.create_clu11(self.packer, (self.frame // 2) + 1, CS.clu11, self.cruise_button, self.CP)] * 25)
else:
self.make_jerk(CS, accel, actuators)
# Parse lead distance from radarState and display the corresponding distance in the car's cluster
if self.CP.openpilotLongitudinalControl and self.sm.updated['radarState'] and self.frame % 5 == 0:
+3 -3
View File
@@ -121,7 +121,7 @@ def create_lfahda_cluster(packer, CAN, enabled, lat_active, lateral_paused, blin
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)
def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control):
def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control, upper_jerk, lower_jerk):
jerk = 5
jn = jerk / 50
if not enabled or gas_override:
@@ -137,8 +137,8 @@ def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_ov
"aReqValue": a_val,
"aReqRaw": a_raw,
"VSetDis": set_speed,
"JerkLowerLimit": jerk if enabled else 1,
"JerkUpperLimit": 3.0,
"JerkLowerLimit": lower_jerk,
"JerkUpperLimit": upper_jerk,
"ACC_ObjDist": 1,
"ObjValid": 0,