Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Subaru XV 2018 support #633

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion selfdrive/car/subaru/carcontroller.py
Expand Up @@ -13,7 +13,7 @@ def __init__(self, car_fingerprint):
self.STEER_STEP = 2 # how often we update the steer cmd
self.STEER_DELTA_UP = 50 # torque increase per refresh, 0.8s to max
self.STEER_DELTA_DOWN = 70 # torque decrease per refresh
if car_fingerprint == CAR.IMPREZA:
if car_fingerprint in [CAR.IMPREZA, CAR.XV]:
self.STEER_DRIVER_ALLOWANCE = 60 # allowed driver torque before start limiting
self.STEER_DRIVER_MULTIPLIER = 10 # weight driver torque heavily
self.STEER_DRIVER_FACTOR = 1 # from dbc
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/subaru/interface.py
Expand Up @@ -59,7 +59,7 @@ def get_params(candidate, fingerprint):
std_cargo = 136
ret.steerRateCost = 0.7

if candidate in [CAR.IMPREZA]:
if candidate in [CAR.IMPREZA, CAR.XV]:
ret.mass = 1568 + std_cargo
ret.wheelbase = 2.67
ret.centerToFront = ret.wheelbase * 0.5
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/car/subaru/subarucan.py
Expand Up @@ -11,9 +11,9 @@ def subaru_checksum(packer, values, addr):

def create_steering_control(packer, car_fingerprint, apply_steer, frame, steer_step):

if car_fingerprint == CAR.IMPREZA:
if car_fingerprint in [CAR.IMPREZA, CAR.XV]:
#counts from 0 to 15 then back to 0 + 16 for enable bit
idx = ((frame // steer_step) % 16)
idx = ((frame / steer_step) % 16)

values = {
"Counter": idx,
Expand All @@ -27,7 +27,7 @@ def create_steering_control(packer, car_fingerprint, apply_steer, frame, steer_s

def create_steering_status(packer, car_fingerprint, apply_steer, frame, steer_step):

if car_fingerprint == CAR.IMPREZA:
if car_fingerprint in [CAR.IMPREZA, CAR.XV]:
values = {}
values["Checksum"] = subaru_checksum(packer, {}, 0x322)

Expand Down
6 changes: 6 additions & 0 deletions selfdrive/car/subaru/values.py
Expand Up @@ -2,17 +2,23 @@

class CAR:
IMPREZA = "SUBARU IMPREZA LIMITED 2019"
XV = "SUBARU XV ACTIVE 2018"

FINGERPRINTS = {
CAR.IMPREZA: [{
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, 544: 8, 545: 8, 546: 8, 552: 8, 554: 8, 557: 8, 576: 8, 577: 8, 722: 8, 801: 8, 802: 8, 805: 8, 808: 8, 816: 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, 1722: 8, 1743: 8, 1759: 8, 1786: 5, 1787: 5, 1788: 8, 1809: 8, 1813: 8, 1817: 8, 1821: 8, 1840: 8, 1848: 8, 1924: 8, 1932: 8, 1952: 8, 1960: 8
}],
CAR.XV: [{
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
}],
}

STEER_THRESHOLD = {
CAR.IMPREZA: 80,
CAR.XV: 80,
}

DBC = {
CAR.IMPREZA: dbc_dict('subaru_global_2017', None),
CAR.XV: dbc_dict('subaru_global_2017', None),
}