Skip to content

Commit

Permalink
Toyota: Add 2021-23 Toyota Sienna with SecOC (#1344)
Browse files Browse the repository at this point in the history
* from @pd0wm #1005

* from @pd0wm commaai/openpilot#31179

* we did need that flag rename

* those flags were numbered like that for a reason

* no more bustime

* add secOCKey to structs

* hack around new pitch value for now

* secOCKey placeholder

* help the test along for now

* codespell disapproves of my creative vision

* add crypto dependency

* the other one

* the other other one

* temp use SecOC branch of Panda

* i am the panda, for now

* propitiate static type checker

* on second thought, moving car.capnp is a good idea

* remove the SecOC key from CarParams

* remove SecOC key reading from Toyota port

* add secoc_key to CS/CC

* update SecOC key references

* default key in interfaces for tests

* more CarParams.SecurityConfig

* set secOcRequired at startup for SecOC car

* see if type checker likes this better

* santa please bring car.capnp back soon

* list -> flag

* diff reduction: won't need the flag rename

* add IDLE_COAST signal

* regen RAV4 DBC

* consolidate and remove ALT_GAS_MSG flag

* consolidate and remove GEAR_PACKET_HYBRID flag

* cleanup pitch signal

* cleanup can_gear

* cleanup SECOC_SYNCHRONIZATION

* more cleanup

* cleanup Mirai

* FLAG.value consistency, in case capnp move needs this

* not necessary, reduce diff with master

* prettier

* validation like this should be an offline test

* match non-SecOC LTA message

* follow secoc library move

* repack flag values

* whitespace fix

* cleanup stockAeb

* comment not necessary

* add explicit FIXME for pandacan ref

* how did that sneak back in

* mention why CarDocs are missing

* use carlog to note wrong key problems

* limit logging volume

* add SecOC Sienna, FW from 970f02decf19930c/00000007--744397430a

* add FW from 0bbe367c98fa1538/00000001--1c0d7ae2e4

* add CI test route for Sienna

* SR closer to online learned, tweak mass to Edmunds value

* add FW from 8bfb000e03b2a257/00000004--f9eee5f52e

* fix transposition
  • Loading branch information
jyoung8607 authored Oct 7, 2024
1 parent 78fdc46 commit 0ebc4cb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions opendbc/car/tests/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class CarTestRoute(NamedTuple):
CarTestRoute("7e34a988419b5307|2019-12-18--19-13-30", TOYOTA.TOYOTA_RAV4_TSS2), # hybrid
CarTestRoute("2475fb3eb2ffcc2e|2022-04-29--12-46-23", TOYOTA.TOYOTA_RAV4_TSS2_2022), # hybrid
CarTestRoute("20ba9ade056a8c7b|2021-02-08--21-57-35", TOYOTA.TOYOTA_RAV4_PRIME), # SecOC
CarTestRoute("8bfb000e03b2a257/00000004--f9eee5f52e", TOYOTA.TOYOTA_SIENNA_4TH_GEN), # SecOC
CarTestRoute("7a31f030957b9c85|2023-04-01--14-12-51", TOYOTA.LEXUS_ES),
CarTestRoute("37041c500fd30100|2020-12-30--12-17-24", TOYOTA.LEXUS_ES), # hybrid
CarTestRoute("e6a24be49a6cd46e|2019-10-29--10-52-42", TOYOTA.LEXUS_ES_TSS2),
Expand Down
1 change: 1 addition & 0 deletions opendbc/car/torque_data/substitute.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"TOYOTA_ALPHARD_TSS2" = "TOYOTA_SIENNA"
"TOYOTA_PRIUS_V" = "TOYOTA_PRIUS"
"TOYOTA_RAV4_PRIME" = "TOYOTA_RAV4_TSS2"
"TOYOTA_SIENNA_4TH_GEN" = "TOYOTA_RAV4_TSS2"
"LEXUS_IS" = "LEXUS_NX"
"LEXUS_CTH" = "LEXUS_NX"
"LEXUS_ES" = "TOYOTA_CAMRY"
Expand Down
22 changes: 22 additions & 0 deletions opendbc/car/toyota/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,28 @@
b'8646F0801100\x00\x00\x00\x00',
],
},
CAR.TOYOTA_SIENNA_4TH_GEN: {
(Ecu.engine, 0x700, None): [
b'\x01896630841000\x00\x00\x00\x00',
b'\x01896630857101\x00\x00\x00\x00',
b'\x01896630864000\x00\x00\x00\x00',
],
(Ecu.abs, 0x7b0, None): [
b'\x01F15260815100\x00\x00\x00\x00',
b'\x01F15260815300\x00\x00\x00\x00',
],
(Ecu.eps, 0x7a1, None): [
b'\x018965B4509100\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
b'\x018821F3301500\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x750, 0x6d): [
b'\x028646F0802200\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
b'\x028646F0802300\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
b'\x028646F0802400\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
],
},
CAR.LEXUS_CTH: {
(Ecu.dsu, 0x791, None): [
b'881517601100\x00\x00\x00\x00',
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime
# https://engage.toyota.com/static/images/toyota_safety_sense/TSS_Applicability_Chart.pdf
stop_and_go = candidate != CAR.TOYOTA_AVALON

elif candidate in (CAR.TOYOTA_RAV4_TSS2, CAR.TOYOTA_RAV4_TSS2_2022, CAR.TOYOTA_RAV4_TSS2_2023, CAR.TOYOTA_RAV4_PRIME):
elif candidate in (CAR.TOYOTA_RAV4_TSS2, CAR.TOYOTA_RAV4_TSS2_2022, CAR.TOYOTA_RAV4_TSS2_2023, CAR.TOYOTA_RAV4_PRIME, CAR.TOYOTA_SIENNA_4TH_GEN):
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kiBP = [0.0]
ret.lateralTuning.pid.kpBP = [0.0]
Expand Down
8 changes: 8 additions & 0 deletions opendbc/car/toyota/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ class CAR(Platforms):
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
flags=ToyotaFlags.NO_STOP_TIMER,
)
TOYOTA_SIENNA_4TH_GEN = PlatformConfig(
# TODO: Enable this docs entry when it can be suppressed from openpilot CARS.md
# [ToyotaCarDocs("Toyota Sienna 2021-23", min_enable_speed=MIN_ACC_SPEED)],
[],
CarSpecs(mass=4625. * CV.LB_TO_KG, wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444),
dbc_dict('toyota_rav4_prime_generated', 'toyota_tss2_adas'),
flags=ToyotaFlags.TSS2 | ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.NO_DSU | ToyotaFlags.SECOC,
)

# Lexus
LEXUS_CTH = PlatformConfig(
Expand Down

0 comments on commit 0ebc4cb

Please sign in to comment.