Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #13 from bsheaffer2017/release
Browse files Browse the repository at this point in the history
Seperation
  • Loading branch information
bugsy924 committed Nov 1, 2018
2 parents 72e5997 + 370de05 commit db4ec03
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 15 deletions.
4 changes: 2 additions & 2 deletions selfdrive/car/subaru/carcontroller.py
Expand Up @@ -14,7 +14,7 @@ def __init__(self, car_fingerprint):
self.STEER_STEP = 2 # how often we update the steer cmd
self.STEER_DELTA_UP = 60 # torque increase per refresh
self.STEER_DELTA_DOWN = 60 # torque decrease per refresh
if car_fingerprint in (CAR.OUTBACK, CAR.LEGACY):
if car_fingerprint in (CAR.OUTBACK_15, CAR.OUTBACK_17, CAR.LEGACY_15, CAR.LEGACY_17):
self.STEER_DRIVER_ALLOWANCE = 20 # allowed driver torque before start limiting
else:
self.STEER_DRIVER_ALLOWANCE = 250 # allowed driver torque before start limiting
Expand Down Expand Up @@ -75,7 +75,7 @@ def update(self, sendcan, enabled, CS, frame, actuators):
if not lkas_enabled:
apply_steer = 0

if self.car_fingerprint in (CAR.OUTBACK, CAR.LEGACY):
if self.car_fingerprint in (CAR.OUTBACK_15, CAR.OUTBACK_17, CAR.LEGACY_15, CAR.LEGACY_17):

if apply_steer != 0:
chksm_steer = apply_steer * -1
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/subaru/carstate.py
Expand Up @@ -79,7 +79,7 @@ def update(self, pt_cp):
self.acc_active = pt_cp.vl["CruiseControl"]['Cruise_Activated']
self.main_on = pt_cp.vl["CruiseControl"]['Cruise_On']

if self.car_fingerprint in (CAR.OUTBACK, CAR.LEGACY):
if self.car_fingerprint in (CAR.OUTBACK_15, CAR.OUTBACK_17, CAR.LEGACY_15, CAR.LEGACY_17):
self.steer_override = abs(self.steer_torque_driver) > 1.5
self.angle_steers = pt_cp.vl["Steering_Torque"]['Steering_Angle']

Expand Down
31 changes: 29 additions & 2 deletions selfdrive/car/subaru/interface.py
Expand Up @@ -58,7 +58,7 @@ def get_params(candidate, fingerprint):
ret.enableCamera = True
std_cargo = 136

if candidate == CAR.OUTBACK:
if candidate == CAR.OUTBACK_15:
ret.mass = 1568 + std_cargo
ret.wheelbase = 2.75
ret.centerToFront = ret.wheelbase * 0.5
Expand All @@ -71,7 +71,34 @@ def get_params(candidate, fingerprint):
ret.steerKpV, ret.steerKiV = [[0.003], [0.00]]
ret.steerMaxBP = [0.] # m/s
ret.steerMaxV = [1.]
elif candidate == CAR.LEGACY:
elif candidate == CAR.OUTBACK_17:
ret.mass = 1568 + std_cargo
ret.wheelbase = 2.75
ret.centerToFront = ret.wheelbase * 0.5

ret.steerRatio = 14
ret.steerActuatorDelay = 0.3
ret.steerRateCost = 0
ret.steerKf = 0.000002
ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] # m/s
ret.steerKpV, ret.steerKiV = [[0.003], [0.00]]
ret.steerMaxBP = [0.] # m/s
ret.steerMaxV = [1.]

elif candidate == CAR.LEGACY_15:
ret.mass = 1568 + std_cargo
ret.wheelbase = 2.75
ret.centerToFront = ret.wheelbase * 0.5

ret.steerRatio = 14
ret.steerActuatorDelay = 0.3
ret.steerRateCost = 0
ret.steerKf = 0.000002
ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] # m/s
ret.steerKpV, ret.steerKiV = [[0.003], [0.00]]
ret.steerMaxBP = [0.] # m/s
ret.steerMaxV = [1.]
elif candidate == CAR.LEGACY_17:
ret.mass = 1568 + std_cargo
ret.wheelbase = 2.75
ret.centerToFront = ret.wheelbase * 0.5
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/subaru/subarucan.py
@@ -1,7 +1,7 @@
from selfdrive.car.subaru.values import CAR, DBC

def create_steering_control(packer, bus, car_fingerprint, idx, steer1, byte2, checksum):
if car_fingerprint in (CAR.OUTBACK, CAR.LEGACY):
if car_fingerprint in (CAR.OUTBACK_15, CAR.OUTBACK_17, CAR.LEGACY_15, CAR.LEGACY_17):

values = {
"Byte0": idx,
Expand All @@ -19,4 +19,4 @@ def create_steering_control(packer, bus, car_fingerprint, idx, steer1, byte2, ch
"Byte3": byte2
}

return packer.make_can_msg("ES_LKAS", 0, values)
return packer.make_can_msg("ES_LKAS", 0, values)
26 changes: 18 additions & 8 deletions selfdrive/car/subaru/values.py
Expand Up @@ -2,24 +2,34 @@
from selfdrive.car import dbc_dict

class CAR:
OUTBACK = "SUBARU OUTBACK PREMIUM 2015"
LEGACY = "SUBARU LEGACY LIMITED 2015"
OUTBACK_15 = "SUBARU OUTBACK PREMIUM 2015"
OUTBACK_17 = "SUBARU OUTBACK LIMITED 2017"
LEGACY_15 = "SUBARU LEGACY LIMITED 2015"
LEGACY_17 = "SUBARU LEGACY ? 2017"
XV2018 = "SUBARU XV ACTIVE 2018"

FINGERPRINTS = {
CAR.OUTBACK: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 346: 8, 352: 8, 353: 8, 354: 8, 356: 8, 358: 8, 359: 8, 392: 8, 604: 8, 640: 8, 642: 8, 644: 8, 805: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 885: 8, 977: 8, 1632: 8, 1640: 8, 1736: 8, 1745: 8, 1785: 8, 1786: 5, 1787: 5, 1788: 8, 1882: 8, 2015: 8, 2024: 8, 2025: 8
CAR.OUTBACK_15: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 346: 8, 352: 8, 353: 8, 354: 8, 356: 8, 358: 8, 359: 8, 392: 8, 640: 8, 642: 8, 644: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 977: 8, 1632: 8, 1745: 8, 1786: 5
}],
CAR.LEGACY: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 392: 8, 604: 8, 640: 8, 642: 8, 644: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 885: 8, 977: 8, 1632: 8, 1640: 8, 1736: 8, 1745: 8, 1785: 5, 1786: 5, 1787: 5, 1788: 8, 1882: 8, 2015: 8, 2024: 8, 2025: 8
CAR.OUTBACK_17: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 352: 8, 353: 8, 354: 8, 356: 8, 358: 8, 359: 8, 392: 8, 604: 8, 640: 8, 642: 8, 644: 8, 805: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 885: 8, 977: 8, 1632: 8, 1640: 8, 1736: 8, 1745: 8, 1785: 5, 1786: 5, 1787: 5, 1788: 8
}],
CAR.LEGACY_15: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 352: 8, 353: 8, 354: 8, 356: 8, 358: 8, 359: 8, 392: 8, 604: 8, 640: 8, 642: 8, 644: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 977: 8, 1632: 8, 1745: 8, 1786: 5
}],
CAR.LEGACY_17: [{
2: 8, 208: 8, 209: 4, 210: 8, 211: 7, 212: 8, 320: 8, 321: 8, 324: 8, 328: 8, 329: 8, 336: 2, 338: 8, 342: 8, 392: 8, 604: 8, 640: 8, 642: 8, 864: 8, 865: 8, 866: 8, 872: 8, 880: 8, 881: 8, 882: 8, 884: 8, 885: 8, 977: 8, 1632: 8, 1640: 8, 1736: 8, 1745: 8, 1785: 5, 1786: 5, 1787: 5, 1788: 8
}],
CAR.XV2018: [{
2: 8, 64: 8, 65: 8, 72: 8, 73: 8, 280: 8, 281: 8, 290: 8, 312: 8, 313: 8, 314: 8, 315: 8, 316: 8, 326: 8, 372: 8, 544: 8, 545: 8, 546: 8, 554: 8, 557: 8, 576: 8, 577: 8, 722: 8, 801: 8, 802: 8, 805: 8, 808: 8, 811: 8, 826: 8, 837: 8, 838: 8, 839: 8, 842: 8, 912: 8, 915: 8, 940: 8, 1614: 8, 1617: 8, 1632: 8, 1650: 8, 1657: 8, 1658: 8, 1677: 8, 1697: 8, 1759: 8, 1786: 5, 1787: 5, 1788: 8
}],
}

DBC = {
CAR.OUTBACK: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.LEGACY: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.OUTBACK_15: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.OUTBACK_17: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.LEGACY_15: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.LEGACY_17: dbc_dict('subaru_outback_2015_eyesight', None),
CAR.XV2018: dbc_dict('subaru_xv_2018_eyesight', None),
}

0 comments on commit db4ec03

Please sign in to comment.