Skip to content
Permalink
Browse files

Chrysler updates (#537)

* Chrysler updates

* Update openDBC
  • Loading branch information...
legonigel committed Feb 22, 2019
1 parent 5c8aa72 commit 15fa6664c0cd6dee2cf9c3ef7e47c65b39a2ead8
@@ -66,7 +66,8 @@ Supported Cars
| Chevrolet<sup>3</sup>| Malibu 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom<sup>7</sup>|
| Chevrolet<sup>3</sup>| Volt 2017-18 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom<sup>7</sup>|
| Cadillac<sup>3</sup> | ATS 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom<sup>7</sup>|
| Chrysler | Pacifica Hybrid 2017 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA |
| Chrysler | Pacifica 2018 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA |
| Chrysler | Pacifica Hybrid 2017-19 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA |
| GMC<sup>3</sup> | Acadia Denali 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom<sup>7</sup>|
| Holden<sup>3</sup> | Astra 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph | Custom<sup>7</sup>|
| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph | Bosch |
@@ -82,6 +83,7 @@ Supported Cars
| Hyundai | Santa Fe 2019 | All | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Hyundai | Elantra 2017 | SCC + LKAS | Yes | Stock | 19mph | 34mph | Custom<sup>6</sup>|
| Hyundai | Genesis 2018 | All | Yes | Stock | 19mph | 34mph | Custom<sup>6</sup>|
| Jeep | Grand Cherokee 2017-19 | Adaptive Cruise | Yes | Stock | 0mph | 9mph | FCA |
| Kia | Optima 2019 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Kia | Sorento 2018 | All | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Kia | Stinger 2018 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
@@ -8,6 +8,7 @@ Version 0.5.9 (2019-02-10)
* Kia Optima support thanks to emmertex!
* Buick Regal 2018 support thanks to HOYS!
* Comma pedal support for Toyota thanks to wocsor! Note: tuning needed and not maintained by comma
* Chrysler Pacifica and Jeep Grand Cherokee suppor thanks to adhintz!

Version 0.5.8 (2019-01-17)
========================
@@ -122,6 +122,7 @@ BO_ 678 LKAS_HUD: 8 XXX
SG_ LKAS_ICON_COLOR : 1|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_LANE_LINES : 19|4@0+ (1,0) [0|1] "" XXX
SG_ LKAS_ALERTS : 27|4@0+ (1,0) [0|1] "" XXX
SG_ CAR_MODEL : 15|8@0+ (1,0) [0|255] "" XXX

BO_ 705 AUTO_PARK_BUTTON: 8 XXX
SG_ AUTO_PARK_TOGGLE_2 : 8|1@0+ (1,0) [0|1] "" XXX
@@ -25,6 +25,7 @@ def __init__(self, dbc_name, car_fingerprint, enable_camera):
self.apply_steer_last = 0
self.ccframe = 0
self.prev_frame = -1
self.hud_count = 0
self.car_fingerprint = car_fingerprint
self.alert_active = False
self.send_chime = False
@@ -39,7 +40,7 @@ def __init__(self, dbc_name, car_fingerprint, enable_camera):
def update(self, sendcan, enabled, CS, frame, actuators,
pcm_cancel_cmd, hud_alert, audible_alert):

# this seems needed to avoid steerign faults and to force the sync with the EPS counter
# this seems needed to avoid steering faults and to force the sync with the EPS counter
if self.prev_frame == frame:
return

@@ -81,8 +82,10 @@ def update(self, sendcan, enabled, CS, frame, actuators,
can_sends.append(new_msg)

if (self.ccframe % 25 == 0): # 0.25s period
new_msg = create_lkas_hud(CS.gear_shifter, lkas_active, hud_alert, self.car_fingerprint)
new_msg = create_lkas_hud(self.packer, CS.gear_shifter, lkas_active, hud_alert, self.car_fingerprint,
self.hud_count)
can_sends.append(new_msg)
self.hud_count += 1

new_msg = create_lkas_command(self.packer, int(apply_steer), frame)
can_sends.append(new_msg)
@@ -13,6 +13,8 @@ def parse_gear_shifter(can_gear):
return "neutral"
elif can_gear == 0x4:
return "drive"
elif can_gear == 0x5:
return "low"
return "unknown"


@@ -5,6 +5,13 @@
VisualAlert = car.CarControl.HUDControl.VisualAlert
AudibleAlert = car.CarControl.HUDControl.AudibleAlert

MODEL_TO_CONSTANT = {
CAR.PACIFICA_2017_HYBRID: 0,
CAR.PACIFICA_2018: 0x64,
CAR.PACIFICA_2018_HYBRID: 0xa8,
CAR.PACIFICA_2019_HYBRID: 0x68,
CAR.JEEP_CHEROKEE: 0xa4,
}

def calc_checksum(data):
"""This function does not want the checksum byte in the input data.
@@ -51,40 +58,41 @@ def create_lkas_heartbit(car_fingerprint):
msg = '0000000820'.decode('hex') # 2017
return make_can_msg(0x2d9, msg)

def create_lkas_hud(gear, lkas_active, hud_alert, car_fingerprint):
# LKAS_HUD (678) Controls what lane-keeping icon is displayed.
def create_lkas_hud(packer, gear, lkas_active, hud_alert, car_fingerprint, hud_count):
# LKAS_HUD 0x2a6 (678) Controls what lane-keeping icon is displayed.

if hud_alert == VisualAlert.steerRequired:
msg = '0000000300000000'.decode('hex')
return make_can_msg(0x2a6, msg)

# TODO: use can packer
msg = '0000000000000000'.decode('hex') # park or neutral
if car_fingerprint == CAR.PACIFICA_2018:
msg = '0064000000000000'.decode('hex') # Have not verified 2018 park with a real car.
elif car_fingerprint == CAR.JEEP_CHEROKEE:
msg = '00a4000000000000'.decode('hex') # Have not verified 2018 park with a real car.
elif car_fingerprint == CAR.PACIFICA_2018_HYBRID:
msg = '01a8010000000000'.decode('hex')
if (gear == 'drive' or gear == 'reverse'):
color = 0 # default values are for park or neutral
lines = 0
alerts = 0

if hud_count < (3 *4): # first 3 seconds, 4Hz
lines = 1
alerts = 1
elif hud_count < (6 * 4): # next 3 seconds, 4Hz
lines = 1
alerts = 0
# CAR.PACIFICA_2018_HYBRID and CAR.PACIFICA_2019_HYBRID
# had color = 1 and lines = 1 but trying 2017 hybrid style for now.
if gear in ('drive', 'reverse', 'low'):
if lkas_active:
msg = '0200060000000000'.decode('hex') # control active, display green.
if car_fingerprint == CAR.PACIFICA_2018:
msg = '0264060000000000'.decode('hex')
elif car_fingerprint == CAR.JEEP_CHEROKEE:
msg = '02a4060000000000'.decode('hex')
elif car_fingerprint == CAR.PACIFICA_2018_HYBRID:
msg = '02a8060000000000'.decode('hex')
color = 2 # control active, display green.
lines = 6
else:
msg = '0100010000000000'.decode('hex') # control off, display white.
if car_fingerprint == CAR.PACIFICA_2018:
msg = '0164010000000000'.decode('hex')
elif car_fingerprint == CAR.JEEP_CHEROKEE:
msg = '01a4010000000000'.decode('hex')
elif car_fingerprint == CAR.PACIFICA_2018_HYBRID:
msg = '01a8010000000000'.decode('hex')

return make_can_msg(0x2a6, msg)
color = 1 # control off, display white.
lines = 1

values = {
"LKAS_ICON_COLOR": color, # byte 0, last 2 bits
"CAR_MODEL": MODEL_TO_CONSTANT[car_fingerprint], # byte 1
"LKAS_LANE_LINES": lines, # byte 2, last 4 bits
"LKAS_ALERTS": alerts, # byte 3, last 4 bits
}

return packer.make_can_msg("LKAS_HUD", 0, values) # 0x2a6


def create_lkas_command(packer, apply_steer, frame):
@@ -0,0 +1,48 @@
import chryslercan
from values import CAR
from carcontroller import CarController
from selfdrive.can.packer import CANPacker

from cereal import car
VisualAlert = car.CarControl.HUDControl.VisualAlert
AudibleAlert = car.CarControl.HUDControl.AudibleAlert

import unittest


class TestChryslerCan(unittest.TestCase):

def test_checksum(self):
self.assertEqual(0x75, chryslercan.calc_checksum([0x01, 0x20]))
self.assertEqual(0xcc, chryslercan.calc_checksum([0x14, 0, 0, 0, 0x20]))

def test_heartbit(self):
self.assertEqual(
[0x2d9, 0, '0000000820'.decode('hex'), 0],
chryslercan.create_lkas_heartbit(CAR.PACIFICA_2017_HYBRID))

def test_hud(self):
packer = CANPacker('chrysler_pacifica_2017_hybrid')
self.assertEqual(
[0x2a6, 0, '0000010100000000'.decode('hex'), 0],
chryslercan.create_lkas_hud(packer,
'park', False, False, CAR.PACIFICA_2017_HYBRID, 1))
self.assertEqual(
[0x2a6, 0, '0000010000000000'.decode('hex'), 0],
chryslercan.create_lkas_hud(packer,
'park', False, False, CAR.PACIFICA_2017_HYBRID, 5*4))
self.assertEqual(
[0x2a6, 0, '0000000000000000'.decode('hex'), 0],
chryslercan.create_lkas_hud(packer,
'park', False, False, CAR.PACIFICA_2017_HYBRID, 99999))
self.assertEqual(
[0x2a6, 0, '0200060000000000'.decode('hex'), 0],
chryslercan.create_lkas_hud(packer,
'drive', True, False, CAR.PACIFICA_2017_HYBRID, 99999))
self.assertEqual(
[0x2a6, 0, '0264060000000000'.decode('hex'), 0],
chryslercan.create_lkas_hud(packer,
'drive', True, False, CAR.PACIFICA_2018, 99999))

if __name__ == '__main__':
unittest.main()
@@ -217,7 +217,7 @@ def update(self, c):
events.append(create_event('commIssue', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
else:
self.can_invalid_count = 0
if not ret.gearShifter == 'drive':
if not (ret.gearShifter in ('drive', 'low')):
events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE]))
if ret.doorOpen:
events.append(create_event('doorOpen', [ET.NO_ENTRY, ET.SOFT_DISABLE]))
@@ -0,0 +1 @@
PYTHONPATH=`realpath ../../../` python chryslercan_test.py
Oops, something went wrong.

0 comments on commit 15fa666

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.