Skip to content

Commit

Permalink
Merge pull request #3 from commaai/devel
Browse files Browse the repository at this point in the history
Merging new updates
  • Loading branch information
CryptoKylan authored Sep 6, 2018
2 parents f91c8ff + faea9a4 commit f310f8a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
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
7 changes: 6 additions & 1 deletion selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 @@ -69,6 +69,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 @@ -82,6 +83,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

0 comments on commit f310f8a

Please sign in to comment.