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: 97d7ee369b
taco
Adeeb Shihadeh 3 years ago committed by GitHub
parent d3c4739ce1
commit 9d1f2d9b8e
  1. 11
      selfdrive/car/chrysler/carcontroller.py
  2. 4
      selfdrive/car/chrysler/chryslercan.py
  3. 2
      selfdrive/test/process_replay/ref_commit

@ -14,7 +14,7 @@ class CarController:
self.hud_count = 0 self.hud_count = 0
self.last_lkas_falling_edge = 0 self.last_lkas_falling_edge = 0
self.lkas_active_prev = False self.lkas_control_bit_prev = False
self.last_button_frame = 0 self.last_button_frame = 0
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
@ -24,7 +24,8 @@ class CarController:
can_sends = [] can_sends = []
# EPS faults if LKAS re-enables too quickly # 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 *** # *** control msgs ***
@ -59,12 +60,12 @@ class CarController:
self.apply_steer_last = apply_steer self.apply_steer_last = apply_steer
idx = self.frame // 2 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 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.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 = CC.actuators.copy()
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX 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) 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 # LKAS_COMMAND Lane-keeping signal to turn the wheel
enabled_val = 2 if CP.carFingerprint in RAM_CARS else 1 enabled_val = 2 if CP.carFingerprint in RAM_CARS else 1
values = { values = {
"STEERING_TORQUE": apply_steer, "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) return packer.make_can_msg("LKAS_COMMAND", 0, values, frame % 0x10)

@ -1 +1 @@
5efbbdf69e16db3d989bfaf62d10e958e80b9ca2 7fbe776f271ed2d45abe989736133a5cfa0ec826
Loading…
Cancel
Save