mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-21 09:12:25 +08:00
Chrysler: send LKAS control bit while above minSteerSpeed (#25150)
* Chrysler: send LKAS control bit while above minSteerSpeed * update refs * rework that a bit * little more * update refs old-commit-hash: 97d7ee369b9b8193fe1580fbaa00e65a26235432
This commit is contained in:
@@ -14,7 +14,7 @@ class CarController:
|
||||
|
||||
self.hud_count = 0
|
||||
self.last_lkas_falling_edge = 0
|
||||
self.lkas_active_prev = False
|
||||
self.lkas_control_bit_prev = False
|
||||
self.last_button_frame = 0
|
||||
|
||||
self.packer = CANPacker(dbc_name)
|
||||
@@ -24,7 +24,8 @@ class CarController:
|
||||
can_sends = []
|
||||
|
||||
# EPS faults if LKAS re-enables too quickly
|
||||
lkas_active = CC.latActive and not low_speed_alert and (self.frame - self.last_lkas_falling_edge > 200)
|
||||
lkas_control_bit = not low_speed_alert and (self.frame - self.last_lkas_falling_edge > 200)
|
||||
lkas_active = CC.latActive and self.lkas_control_bit_prev
|
||||
|
||||
# *** control msgs ***
|
||||
|
||||
@@ -59,12 +60,12 @@ class CarController:
|
||||
self.apply_steer_last = apply_steer
|
||||
|
||||
idx = self.frame // 2
|
||||
can_sends.append(create_lkas_command(self.packer, self.CP, int(apply_steer), lkas_active, idx))
|
||||
can_sends.append(create_lkas_command(self.packer, self.CP, int(apply_steer), lkas_control_bit, idx))
|
||||
|
||||
self.frame += 1
|
||||
if not lkas_active and self.lkas_active_prev:
|
||||
if not lkas_control_bit and self.lkas_control_bit_prev:
|
||||
self.last_lkas_falling_edge = self.frame
|
||||
self.lkas_active_prev = lkas_active
|
||||
self.lkas_control_bit_prev = lkas_control_bit
|
||||
|
||||
new_actuators = CC.actuators.copy()
|
||||
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
|
||||
|
||||
@@ -52,12 +52,12 @@ def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, au
|
||||
return packer.make_can_msg("DAS_6", 0, values)
|
||||
|
||||
|
||||
def create_lkas_command(packer, CP, apply_steer, lat_active, frame):
|
||||
def create_lkas_command(packer, CP, apply_steer, lkas_control_bit, frame):
|
||||
# LKAS_COMMAND Lane-keeping signal to turn the wheel
|
||||
enabled_val = 2 if CP.carFingerprint in RAM_CARS else 1
|
||||
values = {
|
||||
"STEERING_TORQUE": apply_steer,
|
||||
"LKAS_CONTROL_BIT": enabled_val if lat_active else 0,
|
||||
"LKAS_CONTROL_BIT": enabled_val if lkas_control_bit else 0,
|
||||
}
|
||||
return packer.make_can_msg("LKAS_COMMAND", 0, values, frame % 0x10)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
5efbbdf69e16db3d989bfaf62d10e958e80b9ca2
|
||||
7fbe776f271ed2d45abe989736133a5cfa0ec826
|
||||
Reference in New Issue
Block a user