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

WIP: 2018 Toyota Camry Hybrid #195

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
657c218
Add camry hybrid
vanillagorillaa Feb 13, 2018
b6f1515
Add Camry
vanillagorillaa Feb 13, 2018
ffcebc8
Add Camry Hybrid
vanillagorillaa Feb 13, 2018
b7f6a17
Add Camry Hybrid
vanillagorillaa Feb 13, 2018
ebec0f2
Add Camry Hybrid
vanillagorillaa Feb 13, 2018
3aa7c22
Add Camry Hybrid
vanillagorillaa Feb 13, 2018
f2c06c2
add camry to stop and go
vanillagorillaa Feb 13, 2018
9521f0b
Update README.md
vanillagorillaa Feb 13, 2018
e68290d
Add Camry Hybrid
vanillagorillaa Feb 13, 2018
6ccc908
Add Camry hybrid
vanillagorillaa Feb 13, 2018
ed3c3d2
Merge pull request #1 from vanillagorillaa/vanillagorillaa-camry-hybrid
vanillagorillaa Feb 13, 2018
3d3f98a
syntax
vanillagorillaa Feb 14, 2018
b73d29d
syntax
vanillagorillaa Feb 14, 2018
2a534b4
Update and rename toyota_camry_2018_hybrid_pt.dbc to toyota_camry_hyb…
vanillagorillaa Feb 15, 2018
f19bb12
Update and rename toyota_camry_2018_hybrid_pt_generated.dbc to toyota…
vanillagorillaa Feb 15, 2018
f400567
Update carstate.py
vanillagorillaa Feb 15, 2018
40ca89b
Merge branch 'devel' into vanillagorillaa-camry-hybrid
vanillagorillaa Feb 15, 2018
6b9d24f
add 02E4, 0412
vanillagorillaa Feb 27, 2018
8a02392
typo
vanillagorillaa Feb 27, 2018
61705b7
different values for camry hybrid
vanillagorillaa Feb 27, 2018
6421868
remove Camry Hybrid
vanillagorillaa Mar 10, 2018
3dfc7f6
update camry hybrid fingerprint
vanillagorillaa Mar 11, 2018
d9bc165
parse gear correctly
vanillagorillaa Mar 11, 2018
acc493e
Merge branch 'devel' into vanillagorillaa-camry-hybrid
vanillagorillaa Mar 20, 2018
153817f
Update toyota_camry_hybrid_2018_pt.dbc
vanillagorillaa Mar 20, 2018
ef39db7
Update safety_toyota.h
vanillagorillaa Apr 13, 2018
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Community WIP Cars

- [Classic Tesla Model S (pre-AP)](https://github.com/commaai/openpilot/pull/145)

- [Toyota Camry Hybrid 2018](https://github.com/commaai/openpilot/pull/195)

Directory structure
------

Expand Down
4 changes: 4 additions & 0 deletions common/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TOYOTA:
RAV4 = "TOYOTA RAV4 2017"
COROLLA = "TOYOTA COROLLA 2017"
LEXUS_RXH = "LEXUS RX HYBRID 2017"
CAMRYH = "TOYOTA CAMRY 2018 HYBRID"

_DEBUG_ADDRESS = {1880: 8} # reserved for debug purposes

Expand Down Expand Up @@ -68,6 +69,9 @@ class TOYOTA:
TOYOTA.LEXUS_RXH: [{
36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8
}],
TOYOTA.CAMRYH: [{
36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 761: 8, 764: 8, 800: 8, 810: 2, 812: 8, 818: 8, 824: 8, 829: 2, 830: 7, 835: 8, 836: 8, 869: 7, 870: 7, 889: 8, 898: 8, 900: 6, 902: 6, 905: 8, 921: 8, 933: 8, 934: 8, 935: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 983: 8, 984: 8, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1011: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1237: 8, 1264: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1595: 8, 1745: 8, 1779: 8, 1786: 8, 1787: 8, 1788: 8, 1789: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8
}],
}

# support additional internal only fingerprints
Expand Down
4 changes: 4 additions & 0 deletions panda/board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ static void toyota_init(int16_t param) {
}

static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
if (bus_num == 0 || bus_num == 2) {
int addr = to_fwd->RIR>>21;
return addr != 0x2E4 && addr != 0x412 ? (uint8_t)(~bus_num & 0x2) : -1;
}
return -1;
}

Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
TOYOTA.RAV4H: ToyotaInterface,
TOYOTA.COROLLA: ToyotaInterface,
TOYOTA.LEXUS_RXH: ToyotaInterface,
TOYOTA.CAMRYH: ToyotaInterface,

"simulator2": Sim2Interface,
"mock": MockInterface
Expand Down
4 changes: 3 additions & 1 deletion selfdrive/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def parse_gear_shifter(can_gear, car_fingerprint):
# TODO: Use values from DBC to parse this field
if car_fingerprint == CAR.PRIUS:
if car_fingerprint in [CAR.PRIUS, CAR.CAMRYH]:
if can_gear == 0x0:
return "park"
elif can_gear == 0x1:
Expand Down Expand Up @@ -47,6 +47,8 @@ def get_can_parser(CP):
dbc_f = 'toyota_corolla_2017_pt_generated.dbc'
elif CP.carFingerprint == CAR.LEXUS_RXH:
dbc_f = 'lexus_rx_hybrid_2017_pt_generated.dbc'
elif CP.carFingerprint == CAR.CAMRYH:
dbc_f = 'toyota_camry_hybrid_2018_pt_generated.dbc'

signals = [
# sig_name, sig_address, default
Expand Down
10 changes: 9 additions & 1 deletion selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ def get_params(candidate, fingerprint):
ret.steerKpV, ret.steerKiV = [[0.6], [0.1]]
ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerRateCost = .8
elif candidate == CAR.CAMRYH:
ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file
ret.wheelbase = 2.82
ret.steerRatio = 13.7 # official specs say 13.7 (L, LE) 13.8 (SE, XLE, XSE)
ret.mass = 3579./2.205 + std_cargo # using heaviest trim
ret.steerKp, ret.steerKi = 0.6, 0.1
ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerRateCost = .8

ret.centerToFront = ret.wheelbase * 0.44

Expand All @@ -117,7 +125,7 @@ def get_params(candidate, fingerprint):

# min speed to enable ACC. if car can do stop and go, then set enabling speed
# to a negative value, so it won't matter.
if candidate in [CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH]: # rav4 hybrid can do stop and go
if candidate in [CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.CAMRYH]: # rav4 hybrid can do stop and go
ret.minEnableSpeed = -1.
elif candidate in [CAR.RAV4, CAR.COROLLA]: # TODO: hack ICE to do stop and go
ret.minEnableSpeed = 19. * CV.MPH_TO_MS
Expand Down