Skip to content

Commit 15b8354

Browse files
authored
Toyota: remove disconnected DSU support (#2931)
* start rn * bring back unsup dsu for carstate * more * yay more red diff * final * final * expected failures for enableDsu routes. non tested for now * keep
1 parent 89b131e commit 15b8354

File tree

7 files changed

+28
-74
lines changed

7 files changed

+28
-74
lines changed

opendbc/car/car.capnp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ struct CarParams {
461461
notCar @66 :Bool; # flag for non-car robotics platforms
462462

463463
pcmCruise @3 :Bool; # is openpilot's state tied to the PCM's cruise state?
464-
enableDsu @5 :Bool; # driving support unit
465464
enableBsm @56 :Bool; # blind spot monitoring
466465
flags @64 :UInt32; # flags for car specific quirks
467466
alphaLongitudinalAvailable @71 :Bool;
@@ -733,4 +732,5 @@ struct CarParams {
733732
longitudinalActuatorDelayLowerBoundDEPRECATED @61 :Float32;
734733
stoppingControlDEPRECATED @31 :Bool; # Does the car allow full control even at lows speeds when stopping
735734
radarTimeStepDEPRECATED @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard
735+
enableDsuDEPRECATED @5 :Bool; # driving support unit
736736
}

opendbc/car/docs_definitions.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ class CommonFootnote(Enum):
189189
"openpilot Longitudinal Control (Alpha) is available behind a toggle; " +
190190
"the toggle is only available in non-release branches such as `devel` or `nightly-dev`.",
191191
Column.LONGITUDINAL, docs_only=True)
192-
EXP_LONG_DSU = CarFootnote(
193-
"By default, this car will use the stock Adaptive Cruise Control (ACC) for longitudinal control. " +
194-
"If the Driver Support Unit (DSU) is disconnected, openpilot ACC will replace " +
195-
"stock ACC. <b><i>NOTE: disconnecting the DSU disables Automatic Emergency Braking (AEB).</i></b>",
196-
Column.LONGITUDINAL)
197192

198193

199194
def get_footnotes(footnotes: list[Enum], column: Column) -> list[Enum]:
@@ -269,13 +264,10 @@ def init(self, CP: CarParams, all_footnotes=None):
269264

270265
# longitudinal column
271266
op_long = "Stock"
272-
if CP.alphaLongitudinalAvailable or CP.enableDsu:
267+
if CP.alphaLongitudinalAvailable:
273268
op_long = "openpilot available"
274-
if CP.enableDsu:
275-
self.footnotes.append(CommonFootnote.EXP_LONG_DSU)
276-
else:
277-
self.footnotes.append(CommonFootnote.EXP_LONG_AVAIL)
278-
elif CP.openpilotLongitudinalControl and not CP.enableDsu:
269+
self.footnotes.append(CommonFootnote.EXP_LONG_AVAIL)
270+
elif CP.openpilotLongitudinalControl:
279271
op_long = "openpilot"
280272

281273
# min steer & enable speed columns

opendbc/car/tests/routes.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
HONDA.ACURA_TLX_2G,
3232
HONDA.HONDA_NBOX_2G,
3333
HONDA.ACURA_MDX_4G_MMR,
34-
HONDA.HONDA_CITY_7G
34+
HONDA.HONDA_CITY_7G,
35+
36+
# These had their DSUs unplugged, need new routes
37+
# TOYOTA.LEXUS_ES # hybrid
38+
TOYOTA.TOYOTA_COROLLA,
39+
TOYOTA.TOYOTA_RAV4H,
40+
3541
]
3642

3743

@@ -215,12 +221,12 @@ class CarTestRoute(NamedTuple):
215221
CarTestRoute("54034823d30962f5/2021-05-24--06-37-34", TOYOTA.TOYOTA_CAMRY), # hybrid
216222
CarTestRoute("3456ad0cd7281b24/2020-12-13--17-45-56", TOYOTA.TOYOTA_CAMRY_TSS2),
217223
CarTestRoute("ffccc77938ddbc44/2021-01-04--16-55-41", TOYOTA.TOYOTA_CAMRY_TSS2), # hybrid
218-
CarTestRoute("4e45c89c38e8ec4d/2021-05-02--02-49-28", TOYOTA.TOYOTA_COROLLA),
224+
# CarTestRoute("4e45c89c38e8ec4d/2021-05-02--02-49-28", TOYOTA.TOYOTA_COROLLA),
219225
CarTestRoute("5f5afb36036506e4/2019-05-14--02-09-54", TOYOTA.TOYOTA_COROLLA_TSS2),
220226
CarTestRoute("5ceff72287a5c86c/2019-10-19--10-59-02", TOYOTA.TOYOTA_COROLLA_TSS2), # hybrid
221227
CarTestRoute("d2525c22173da58b/2021-04-25--16-47-04", TOYOTA.TOYOTA_PRIUS),
222228
CarTestRoute("b14c5b4742e6fc85/2020-07-28--19-50-11", TOYOTA.TOYOTA_RAV4),
223-
CarTestRoute("32a7df20486b0f70/2020-02-06--16-06-50", TOYOTA.TOYOTA_RAV4H),
229+
# CarTestRoute("32a7df20486b0f70/2020-02-06--16-06-50", TOYOTA.TOYOTA_RAV4H),
224230
CarTestRoute("cdf2f7de565d40ae/2019-04-25--03-53-41", TOYOTA.TOYOTA_RAV4_TSS2),
225231
CarTestRoute("a5c341bb250ca2f0/2022-05-18--16-05-17", TOYOTA.TOYOTA_RAV4_TSS2_2022),
226232
CarTestRoute("ad5a3fa719bc2f83/2023-10-17--19-48-42", TOYOTA.TOYOTA_RAV4_TSS2_2023),
@@ -231,7 +237,7 @@ class CarTestRoute(NamedTuple):
231237
CarTestRoute("8bfb000e03b2a257/00000004--f9eee5f52e", TOYOTA.TOYOTA_SIENNA_4TH_GEN), # SecOC
232238
CarTestRoute("0b54d0594d924cd9/00000057--b6206a3205", TOYOTA.TOYOTA_YARIS), # SecOC
233239
CarTestRoute("7a31f030957b9c85/2023-04-01--14-12-51", TOYOTA.LEXUS_ES),
234-
CarTestRoute("37041c500fd30100/2020-12-30--12-17-24", TOYOTA.LEXUS_ES), # hybrid
240+
# CarTestRoute("37041c500fd30100/2020-12-30--12-17-24", TOYOTA.LEXUS_ES), # hybrid
235241
CarTestRoute("e6a24be49a6cd46e/2019-10-29--10-52-42", TOYOTA.LEXUS_ES_TSS2),
236242
CarTestRoute("f49e8041283f2939/2019-05-30--11-51-51", TOYOTA.LEXUS_ES_TSS2), # hybrid
237243
CarTestRoute("da23c367491f53e2/2021-05-21--09-09-11", TOYOTA.LEXUS_CTH, segment=3),

opendbc/car/toyota/carcontroller.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import numpy as np
33
from opendbc.car import Bus, make_tester_present_msg, rate_limit, structs, ACCELERATION_DUE_TO_GRAVITY, DT_CTRL
44
from opendbc.car.lateral import apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance
5-
from opendbc.car.can_definitions import CanData
65
from opendbc.car.carlog import carlog
76
from opendbc.car.common.filter_simple import FirstOrderFilter, HighPassFilter
87
from opendbc.car.common.pid import PIDController
98
from opendbc.car.secoc import add_mac, build_sync_mac
109
from opendbc.car.interfaces import CarControllerBase
1110
from opendbc.car.toyota import toyotacan
12-
from opendbc.car.toyota.values import CAR, STATIC_DSU_MSGS, NO_STOP_TIMER_CAR, TSS2_CAR, \
11+
from opendbc.car.toyota.values import CAR, NO_STOP_TIMER_CAR, TSS2_CAR, \
1312
CarControllerParams, ToyotaFlags, \
1413
UNSUPPORTED_DSU_CAR
1514
from opendbc.can import CANPacker
@@ -293,15 +292,9 @@ def update(self, CC, CS, now_nanos):
293292
hud_control.rightLaneVisible, hud_control.leftLaneDepart,
294293
hud_control.rightLaneDepart, CC.enabled, CS.lkas_hud))
295294

296-
if (self.frame % 100 == 0 or send_ui) and (self.CP.enableDsu or self.CP.flags & ToyotaFlags.DISABLE_RADAR.value):
295+
if (self.frame % 100 == 0 or send_ui) and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
297296
can_sends.append(toyotacan.create_fcw_command(self.packer, fcw_alert))
298297

299-
# *** static msgs ***
300-
if self.CP.enableDsu:
301-
for addr, cars, bus, fr_step, vl in STATIC_DSU_MSGS:
302-
if self.frame % fr_step == 0 and self.CP.carFingerprint in cars:
303-
can_sends.append(CanData(addr, vl, bus))
304-
305298
# keep radar disabled
306299
if self.frame % 20 == 0 and self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
307300
can_sends.append(make_tester_present_msg(0x750, 0, 0xF))

opendbc/car/toyota/carstate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def update(self, can_parsers) -> structs.CarState:
7878
else:
7979
ret.gasPressed = cp.vl["PCM_CRUISE"]["GAS_RELEASED"] == 0 # TODO: these also have GAS_PEDAL, come back and unify
8080
can_gear = int(cp.vl["GEAR_PACKET"]["GEAR"])
81-
if not self.CP.enableDsu and not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
81+
if not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
8282
ret.stockAeb = bool(cp_acc.vl["PRE_COLLISION"]["PRECOLLISION_ACTIVE"] and cp_acc.vl["PRE_COLLISION"]["FORCE"] < -1e-5)
8383

8484
self.parse_wheel_speeds(ret,

opendbc/car/toyota/interface.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from opendbc.car.toyota.carcontroller import CarController
44
from opendbc.car.toyota.radar_interface import RadarInterface
55
from opendbc.car.toyota.values import Ecu, CAR, DBC, ToyotaFlags, CarControllerParams, TSS2_CAR, RADAR_ACC_CAR, NO_DSU_CAR, \
6-
MIN_ACC_SPEED, EPS_SCALE, UNSUPPORTED_DSU_CAR, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR, \
6+
MIN_ACC_SPEED, EPS_SCALE, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR, \
77
ToyotaSafetyFlags
88
from opendbc.car.disable_ecu import disable_ecu
99
from opendbc.car.interfaces import CarInterfaceBase
@@ -52,7 +52,6 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo
5252

5353
# In TSS2 cars, the camera does long control
5454
found_ecus = [fw.ecu for fw in car_fw]
55-
ret.enableDsu = len(found_ecus) > 0 and Ecu.dsu not in found_ecus and candidate not in (NO_DSU_CAR | UNSUPPORTED_DSU_CAR)
5655

5756
if Ecu.hybrid in found_ecus:
5857
ret.flags |= ToyotaFlags.HYBRID.value
@@ -92,14 +91,9 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo
9291
break
9392

9493
elif candidate in (CAR.TOYOTA_CHR, CAR.TOYOTA_CAMRY, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_NX):
95-
# TODO: Some of these platforms are not advertised to have full range ACC, are they similar to SNG_WITHOUT_DSU cars?
94+
# TODO: Some of these platforms are not advertised to have full range ACC, do they really all have sng?
9695
stop_and_go = True
9796

98-
# TODO: these models can do stop and go, but unclear if it requires sDSU or unplugging DSU.
99-
# For now, don't list stop and go functionality in the docs
100-
if ret.flags & ToyotaFlags.SNG_WITHOUT_DSU:
101-
stop_and_go = stop_and_go or (ret.enableDsu and not docs)
102-
10397
ret.centerToFront = ret.wheelbase * 0.44
10498

10599
# TODO: Some TSS-P platforms have BSM, but are flipped based on region or driving direction.
@@ -124,9 +118,8 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, alpha_lo
124118
# openpilot longitudinal behind experimental long toggle:
125119
# - TSS2 radar ACC cars (disables radar)
126120

127-
ret.openpilotLongitudinalControl = ret.enableDsu or \
128-
candidate in (TSS2_CAR - RADAR_ACC_CAR) or \
129-
bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value)
121+
ret.openpilotLongitudinalControl = (candidate in (TSS2_CAR - RADAR_ACC_CAR) or
122+
bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value))
130123

131124
ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR
132125

opendbc/car/toyota/values.py

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ class ToyotaFlags(IntFlag):
7171
# these cars use the Lane Tracing Assist (LTA) message for lateral control
7272
ANGLE_CONTROL = 128
7373
NO_STOP_TIMER = 256
74-
# these cars are speculated to allow stop and go when the DSU is unplugged
75-
SNG_WITHOUT_DSU = 512
7674
# these cars can utilize 2.0 m/s^2
7775
RAISED_ACCEL_LIMIT = 1024
7876
SECOC = 2048
7977

78+
# deprecated flags
79+
# these cars are speculated to allow stop and go when the DSU is unplugged
80+
SNG_WITHOUT_DSU_DEPRECATED = 512
81+
8082

8183
def dbc_dict(pt, radar):
8284
return {Bus.pt: pt, Bus.radar: radar}
@@ -213,7 +215,7 @@ class CAR(Platforms):
213215
],
214216
CarSpecs(mass=4516. * CV.LB_TO_KG, wheelbase=2.8194, steerRatio=16.0, tireStiffnessFactor=0.8),
215217
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
216-
flags=ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.SNG_WITHOUT_DSU,
218+
flags=ToyotaFlags.NO_STOP_TIMER,
217219
)
218220
TOYOTA_HIGHLANDER_TSS2 = ToyotaTSS2PlatformConfig(
219221
[
@@ -235,7 +237,7 @@ class CAR(Platforms):
235237
[ToyotaCarDocs("Toyota Prius v 2017", "Toyota Safety Sense P", min_enable_speed=MIN_ACC_SPEED)],
236238
CarSpecs(mass=3340. * CV.LB_TO_KG, wheelbase=2.78, steerRatio=17.4, tireStiffnessFactor=0.5533),
237239
dbc_dict('toyota_new_mc_pt_generated', 'toyota_adas'),
238-
flags=ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.SNG_WITHOUT_DSU,
240+
flags=ToyotaFlags.NO_STOP_TIMER,
239241
)
240242
TOYOTA_PRIUS_TSS2 = ToyotaTSS2PlatformConfig(
241243
[
@@ -260,7 +262,7 @@ class CAR(Platforms):
260262
TOYOTA_RAV4.specs,
261263
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
262264
# Note that the ICE RAV4 does not respect positive acceleration commands under 19 mph
263-
flags=ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.SNG_WITHOUT_DSU,
265+
flags=ToyotaFlags.NO_STOP_TIMER,
264266
)
265267
TOYOTA_RAV4_TSS2 = ToyotaTSS2PlatformConfig(
266268
[
@@ -397,38 +399,6 @@ class CAR(Platforms):
397399
)
398400

399401

400-
# (addr, cars, bus, 1/freq*100, vl)
401-
STATIC_DSU_MSGS = [
402-
(0x128, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_AVALON),
403-
1, 3, b'\xf4\x01\x90\x83\x00\x37'),
404-
(0x128, (CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES), 1, 3, b'\x03\x00\x20\x00\x00\x52'),
405-
(0x141, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_AVALON,
406-
CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 1, 2, b'\x00\x00\x00\x46'),
407-
(0x160, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_AVALON,
408-
CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 1, 7, b'\x00\x00\x08\x12\x01\x31\x9c\x51'),
409-
(0x161, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_AVALON, CAR.TOYOTA_PRIUS_V),
410-
1, 7, b'\x00\x1e\x00\x00\x00\x80\x07'),
411-
(0X161, (CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES), 1, 7, b'\x00\x1e\x00\xd4\x00\x00\x5b'),
412-
(0x283, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_AVALON,
413-
CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 0, 3, b'\x00\x00\x00\x00\x00\x00\x8c'),
414-
(0x2E6, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX), 0, 3, b'\xff\xf8\x00\x08\x7f\xe0\x00\x4e'),
415-
(0x2E7, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX), 0, 3, b'\xa8\x9c\x31\x9c\x00\x00\x00\x02'),
416-
(0x33E, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX), 0, 20, b'\x0f\xff\x26\x40\x00\x1f\x00'),
417-
(0x344, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_AVALON,
418-
CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 0, 5, b'\x00\x00\x01\x00\x00\x00\x00\x50'),
419-
(0x365, (CAR.TOYOTA_PRIUS, CAR.LEXUS_NX, CAR.TOYOTA_HIGHLANDER), 0, 20, b'\x00\x00\x00\x80\x03\x00\x08'),
420-
(0x365, (CAR.TOYOTA_RAV4, CAR.TOYOTA_RAV4H, CAR.TOYOTA_COROLLA, CAR.TOYOTA_AVALON, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.LEXUS_RX,
421-
CAR.TOYOTA_PRIUS_V), 0, 20, b'\x00\x00\x00\x80\xfc\x00\x08'),
422-
(0x366, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_HIGHLANDER), 0, 20, b'\x00\x00\x4d\x82\x40\x02\x00'),
423-
(0x366, (CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_AVALON, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V),
424-
0, 20, b'\x00\x72\x07\xff\x09\xfe\x00'),
425-
(0x470, (CAR.TOYOTA_PRIUS, CAR.LEXUS_RX), 1, 100, b'\x00\x00\x02\x7a'),
426-
(0x470, (CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_RAV4H, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 1, 100, b'\x00\x00\x01\x79'),
427-
(0x4CB, (CAR.TOYOTA_PRIUS, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.LEXUS_NX, CAR.TOYOTA_RAV4, CAR.TOYOTA_COROLLA, CAR.TOYOTA_HIGHLANDER, CAR.TOYOTA_AVALON,
428-
CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_ES, CAR.TOYOTA_PRIUS_V), 0, 100, b'\x0c\x00\x00\x00\x00\x00\x00\x00'),
429-
]
430-
431-
432402
def get_platform_codes(fw_versions: list[bytes]) -> dict[bytes, set[bytes]]:
433403
# Returns sub versions in a dict so comparisons can be made within part-platform-major_version combos
434404
codes = defaultdict(set) # Optional[part]-platform-major_version: set of sub_version

0 commit comments

Comments
 (0)