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

Crosstrek Hybrid 23 Tuning #135

Draft
wants to merge 3 commits into
base: subaru-community
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions selfdrive/car/subaru/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.mass = 1568. + STD_CARGO_KG
ret.wheelbase = 2.67
ret.centerToFront = ret.wheelbase * 0.5
ret.steerRatio = 17 # learned, 14 stock
ret.steerRatio = 13 # 17 learned, 14 stock
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kf = 0.00005
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 14., 23.], [0., 14., 23.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.045, 0.042, 0.20], [0.04, 0.035, 0.045]]
# Lateral Tuning for Crosstrek 23
ret.lateralTuning.pid.kf = 0.00003
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 10., 20., 30.], [0., 10., 20., 30.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.01, 0.05, 0.2, 0.21], [0.0010, 0.004, 0.008, 0.009]]
#ret.lateralTuning.pid.kf = 0.00005
#ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 14., 23.], [0., 14., 23.]]
#ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.045, 0.042, 0.20], [0.04, 0.035, 0.045]]

elif candidate in (CAR.FORESTER, CAR.FORESTER_2020H, CAR.FORESTER_2022):
ret.mass = 1568. + STD_CARGO_KG
Expand Down
2 changes: 2 additions & 0 deletions selfdrive/car/subaru/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ class SubaruCarInfo(CarInfo):
(Ecu.eps, 0x746, None): [
b'\x9a\xc2\x01\x00',
b'\n\xc2\x01\x00',
b'\n\xc2\x01\x01',
],
(Ecu.fwdCamera, 0x787, None): [
b'\x00\x00el\x1f@ #',
Expand All @@ -335,6 +336,7 @@ class SubaruCarInfo(CarInfo):
b'\xd7!`p\a',
b'\xe9\xf5B0\x00',
b'\xf4!`0\x07',
b'\xf5!`0\x07',
],
},
CAR.FORESTER: {
Expand Down