Skip to content

Commit

Permalink
Merge pull request commaai#2 from emmertex/hyundai-dev
Browse files Browse the repository at this point in the history
Merge changes from emmertex/hyundai-dev ...9-12-18
  • Loading branch information
James-T1 authored Sep 12, 2018
2 parents c842e7c + ae8f2d7 commit 7c75a96
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Supported Cars
| Acura | ILX 2016 | AcuraWatch Plus | Yes | Yes | 25mph<sup>1</sup>| 25mph |
| Acura | ILX 2017 | AcuraWatch Plus | Yes | Yes | 25mph<sup>1</sup>| 25mph |
| Acura | RDX 2018 | AcuraWatch Plus | Yes | Yes | 25mph<sup>1</sup>| 12mph |
| GM<sup>3</sup> | Volt 2017 | Driver Confidence II | Yes | Yes | 0mph | 7mph |
| GM<sup>3</sup> | Volt 2018 | Driver Confidence II | Yes | Yes | 0mph | 7mph |
| GM<sup>3</sup> | Volt 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| GM<sup>3</sup> | Volt 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph |
| Honda | Civic 2016 | Honda Sensing | Yes | Yes | 0mph | 12mph |
| Honda | Civic 2017 | Honda Sensing | Yes | Yes | 0mph | 12mph |
Expand Down Expand Up @@ -77,7 +77,7 @@ Supported Cars
| Toyota | C-HR 2018<sup>4</sup> | All | Yes | Stock | 0mph | 0mph |
| Toyota | Corolla 2017 | All | Yes | Yes<sup>2</sup>| 20mph | 0mph |
| Toyota | Corolla 2018 | All | Yes | Yes<sup>2</sup>| 20mph | 0mph |
| Toyota | Highlander 2017 | All | Yes | Yes<sup>2</sup>| 20mph | 0mph |
| Toyota | Highlander 2017 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph |
| Toyota | Highlander Hybrid 2018| All | Yes | Yes<sup>2</sup>| 0mph | 0mph |
| Toyota | Prius 2016 | TSS-P | Yes | Yes<sup>2</sup>| 0mph | 0mph |
| Toyota | Prius 2017 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph |
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Version 0.5.3 (2018-09-03)
========================
* Hyundai Santa Fe support!
* Honda Pilot 2019 support thanks to energee!
* Toyota Hyghlander support thanks to daehahn!
* Toyota Highlander support thanks to daehahn!
* Improve steering tuning for Honda Odyssey

Version 0.5.2 (2018-08-16)
Expand Down
Binary file modified apk/ai.comma.plus.offroad.apk
Binary file not shown.
7 changes: 6 additions & 1 deletion selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def actuator_hystereses(final_pedal, pedal_steady):


class CarController(object):
def __init__(self, canbus, car_fingerprint):
def __init__(self, canbus, car_fingerprint, allow_controls):
self.pedal_steady = 0.
self.start_time = sec_since_boot()
self.chime = 0
Expand All @@ -64,6 +64,7 @@ def __init__(self, canbus, car_fingerprint):
self.steer_idx = 0
self.apply_steer_last = 0
self.car_fingerprint = car_fingerprint
self.allow_controls = allow_controls

# Setup detection helper. Routes commands to
# an appropriate CAN bus number.
Expand All @@ -77,6 +78,10 @@ def update(self, sendcan, enabled, CS, frame, actuators, \
hud_v_cruise, hud_show_lanes, hud_show_car, chime, chime_cnt):
""" Controls thread """

# Sanity check.
if not self.allow_controls:
return

P = self.params

# Send CAN commands.
Expand Down
19 changes: 10 additions & 9 deletions selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ class CM:
LOW_CHIME = 0x86
HIGH_CHIME = 0x87

# GM cars have 4 CAN buses, which creates many ways
# of how the car can be connected to.
# This ia a helper class for the interface to be setup-agnostic.
# Supports single Panda setup (connected to OBDII port),
# and a CAN forwarding setup (connected to camera module connector).

class CanBus(object):
def __init__(self):
self.powertrain = 0
self.obstacle = 1
self.chassis = 2
self.sw_gmlan = 3

# 384 = "ASCMLKASteeringCmd"
# 715 = "ASCMGasRegenCmd"
CONTROL_MSGS = [384, 715]

class CarInterface(object):
def __init__(self, CP, sendcan=None):
self.CP = CP
Expand All @@ -54,7 +52,7 @@ def __init__(self, CP, sendcan=None):
# sending if read only is False
if sendcan is not None:
self.sendcan = sendcan
self.CC = CarController(canbus, CP.carFingerprint)
self.CC = CarController(canbus, CP.carFingerprint, CP.enableCamera)

@staticmethod
def compute_gb(accel, speed):
Expand All @@ -73,8 +71,11 @@ def get_params(candidate, fingerprint):

ret.enableCruise = False

# TODO: gate this on detection
ret.enableCamera = True
# Presence of a camera on the object bus is ok.
# Have to go passive if ASCM is online (ACC-enabled cars),
# or camera is on powertrain bus (LKA cars without ACC).
ret.enableCamera = not any(x for x in CONTROL_MSGS if x in fingerprint)

std_cargo = 136

if candidate == CAR.VOLT:
Expand Down
14 changes: 9 additions & 5 deletions selfdrive/car/hyundai/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def get_can_parser(CP):
("CF_Clu_AmpInfo", "CLU11", 0),
("CF_Clu_AliveCnt1", "CLU11", 0),

("CF_Clu_InhibitD", "CLU15", 0),
("CF_Clu_InhibitP", "CLU15", 0),
("CF_Clu_InhibitN", "CLU15", 0),
("CF_Clu_InhibitR", "CLU15", 0),

("CF_Lvr_Gear","LVR12",0),

("ACCEnable", "TCS13", 0),
Expand Down Expand Up @@ -205,14 +210,13 @@ def update(self, cp, cp_cam):
self.car_gas = cp.vl["EMS12"]['TPS']

# Gear Selecton - This should be compatible with all Kia/Hyundai with Auto's
gear = cp.vl["LVR12"]["CF_Lvr_Gear"]
if gear == 5:
if cp.vl["CLU15"]["CF_Clu_InhibitD"] == 1:
self.gear_shifter = "drive"
elif gear == 6:
elif cp.vl["CLU15"]["CF_Clu_InhibitN"] == 1:
self.gear_shifter = "neutral"
elif gear == 0:
elif cp.vl["CLU15"]["CF_Clu_InhibitP"] == 1:
self.gear_shifter = "park"
elif gear == 7:
elif cp.vl["CLU15"]["CF_Clu_InhibitR"] == 1:
self.gear_shifter = "reverse"
else:
self.gear_shifter = "unknown"
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ def get_params(candidate, fingerprint):
# to a negative value, so it won't matter.
# hybrid models can't do stop and go even though the stock ACC can't
if candidate in [CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.CHR,
CAR.CHRH, CAR.CAMRY, CAR.CAMRYH, CAR.HIGHLANDERH]:
CAR.CHRH, CAR.CAMRY, CAR.CAMRYH, CAR.HIGHLANDERH, CAR.HIGHLANDER]:
ret.minEnableSpeed = -1.
elif candidate in [CAR.RAV4, CAR.COROLLA, CAR.HIGHLANDER]: # TODO: hack ICE to do stop and go
elif candidate in [CAR.RAV4, CAR.COROLLA]: # TODO: hack ICE to do stop and go
ret.minEnableSpeed = 19. * CV.MPH_TO_MS

centerToRear = ret.wheelbase - ret.centerToFront
Expand Down Expand Up @@ -244,7 +244,7 @@ def update(self, c):
ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS
ret.cruiseState.available = bool(self.CS.main_on)
ret.cruiseState.speedOffset = 0.
if self.CP.carFingerprint in [CAR.RAV4H, CAR.HIGHLANDERH]:
if self.CP.carFingerprint in [CAR.RAV4H, CAR.HIGHLANDERH, CAR.HIGHLANDER]:
# ignore standstill in hybrid vehicles, since pcm allows to restart without
# receiving any special command
ret.cruiseState.standstill = False
Expand Down

0 comments on commit 7c75a96

Please sign in to comment.