|
|
@ -2,7 +2,7 @@ from opendbc.can.packer import CANPacker |
|
|
|
from common.realtime import DT_CTRL |
|
|
|
from common.realtime import DT_CTRL |
|
|
|
from selfdrive.car import apply_toyota_steer_torque_limits |
|
|
|
from selfdrive.car import apply_toyota_steer_torque_limits |
|
|
|
from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, create_cruise_buttons |
|
|
|
from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, create_cruise_buttons |
|
|
|
from selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams |
|
|
|
from selfdrive.car.chrysler.values import CAR, RAM_CARS, CarControllerParams |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CarController: |
|
|
|
class CarController: |
|
|
@ -20,11 +20,22 @@ class CarController: |
|
|
|
self.packer = CANPacker(dbc_name) |
|
|
|
self.packer = CANPacker(dbc_name) |
|
|
|
self.params = CarControllerParams(CP) |
|
|
|
self.params = CarControllerParams(CP) |
|
|
|
|
|
|
|
|
|
|
|
def update(self, CC, CS, low_speed_alert): |
|
|
|
def update(self, CC, CS): |
|
|
|
can_sends = [] |
|
|
|
can_sends = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: can we make this more sane? why is it different for all the cars? |
|
|
|
|
|
|
|
lkas_control_bit = self.lkas_control_bit_prev |
|
|
|
|
|
|
|
if CS.out.vEgo > self.CP.minSteerSpeed: |
|
|
|
|
|
|
|
lkas_control_bit = True |
|
|
|
|
|
|
|
elif self.CP.carFingerprint in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019): |
|
|
|
|
|
|
|
if CS.out.vEgo < (self.CP.minSteerSpeed - 3.0): |
|
|
|
|
|
|
|
lkas_control_bit = False |
|
|
|
|
|
|
|
elif self.CP.carFingerprint in RAM_CARS: |
|
|
|
|
|
|
|
if CS.out.vEgo < (self.CP.minSteerSpeed - 0.5): |
|
|
|
|
|
|
|
lkas_control_bit = False |
|
|
|
|
|
|
|
|
|
|
|
# EPS faults if LKAS re-enables too quickly |
|
|
|
# EPS faults if LKAS re-enables too quickly |
|
|
|
lkas_control_bit = not low_speed_alert and (self.frame - self.last_lkas_falling_edge > 200) |
|
|
|
lkas_control_bit = lkas_control_bit and (self.frame - self.last_lkas_falling_edge > 200) |
|
|
|
lkas_active = CC.latActive and self.lkas_control_bit_prev |
|
|
|
lkas_active = CC.latActive and self.lkas_control_bit_prev |
|
|
|
|
|
|
|
|
|
|
|
# *** control msgs *** |
|
|
|
# *** control msgs *** |
|
|
|