Skip to content

Commit

Permalink
Merge pull request #1 from PenitentTangent2401/distance
Browse files Browse the repository at this point in the history
Toyota: Add following distance button for SecOC Long
  • Loading branch information
chrispypatt authored Dec 31, 2024
2 parents fc029da + 75fcf63 commit 0a0e2db
Show file tree
Hide file tree
Showing 4 changed files with 999 additions and 4 deletions.
9 changes: 7 additions & 2 deletions opendbc/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from opendbc.car.common.numpy_fast import mean
from opendbc.car.interfaces import CarStateBase
from opendbc.car.toyota.values import ToyotaFlags, CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, \
TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR
TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR, \
SECOC_CAR

ButtonType = structs.CarState.ButtonEvent.Type
SteerControlType = structs.CarParams.SteerControlType
Expand Down Expand Up @@ -186,7 +187,10 @@ def update(self, can_parsers) -> structs.CarState:
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
# distance button is wired to the ACC module (camera or radar)
prev_distance_button = self.distance_button
self.distance_button = cp_acc.vl["ACC_CONTROL"]["DISTANCE"]
if self.CP.carFingerprint in (SECOC_CAR):
self.distance_button = cp.vl["ACC_CONTROL_3"]["DISTANCE"]
else:
self.distance_button = cp_acc.vl["ACC_CONTROL"]["DISTANCE"]

ret.buttonEvents = create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise})

Expand Down Expand Up @@ -214,6 +218,7 @@ def get_can_parsers(CP):
("GEAR_PACKET_HYBRID", 60),
("SECOC_SYNCHRONIZATION", 10),
("GAS_PEDAL", 42),
("ACC_CONTROL_3", 1),
]
else:
pt_messages.append(("VSC1S07", 20))
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/toyota/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class CAR(Platforms):
# [ToyotaCarDocs("Toyota RAV4 Prime 2021-23", min_enable_speed=MIN_ACC_SPEED)],
[],
CarSpecs(mass=4372. * CV.LB_TO_KG, wheelbase=2.68, steerRatio=16.88, tireStiffnessFactor=0.5533),
dbc_dict('toyota_rav4_prime_generated', 'toyota_tss2_adas'),
dbc_dict('toyota_secoc_generated', 'toyota_tss2_adas'),
flags=ToyotaFlags.TSS2 | ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.NO_DSU | ToyotaFlags.SECOC,
)
TOYOTA_MIRAI = ToyotaTSS2PlatformConfig( # TSS 2.5
Expand All @@ -273,7 +273,7 @@ class CAR(Platforms):
# [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'),
dbc_dict('toyota_secoc_generated', 'toyota_tss2_adas'),
flags=ToyotaFlags.TSS2 | ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.NO_DSU | ToyotaFlags.SECOC,
)

Expand Down
Loading

0 comments on commit 0a0e2db

Please sign in to comment.