temp, stash

pull/25489/head
Shane Smiskol 3 years ago
parent 5899ce1517
commit 501865f2d7
  1. 12
      selfdrive/car/tests/test_models.py
  2. 27
      selfdrive/car/toyota/carstate.py
  3. 1
      selfdrive/car/toyota/interface.py

@ -19,6 +19,7 @@ from selfdrive.car.tests.routes import non_tested_cars, routes, TestRoute
from selfdrive.test.openpilotci import get_url
from tools.lib.logreader import LogReader
from tools.lib.route import Route
from selfdrive.car.toyota.values import TSS2_CAR
from panda.tests.safety import libpandasafety_py
from panda.tests.safety.common import package_can_msg
@ -83,6 +84,7 @@ class TestCarModelBase(unittest.TestCase):
can_msgs = []
fingerprint = defaultdict(dict)
car_fw = []
for msg in lr:
if msg.which() == "can":
for m in msg.can:
@ -90,6 +92,7 @@ class TestCarModelBase(unittest.TestCase):
fingerprint[m.src][m.address] = len(m.dat)
can_msgs.append(msg)
elif msg.which() == "carParams":
car_fw = msg.carParams.carFw
if msg.carParams.openpilotLongitudinalControl:
disable_radar = True
if cls.car_model is None and not cls.ci:
@ -103,7 +106,10 @@ class TestCarModelBase(unittest.TestCase):
cls.can_msgs = sorted(can_msgs, key=lambda msg: msg.logMonoTime)
cls.CarInterface, cls.CarController, cls.CarState = interfaces[cls.car_model]
cls.CP = cls.CarInterface.get_params(cls.car_model, fingerprint, [], disable_radar)
cls.CP = cls.CarInterface.get_params(cls.car_model, fingerprint, car_fw, disable_radar)
print('{}: {}'.format(cls.car_model, cls.car_model not in TSS2_CAR and 0x2FF not in fingerprint[0]))
print('enableDsu:', cls.CP.enableDsu)
assert cls.CP.enableDsu
assert cls.CP
assert cls.CP.carFingerprint == cls.car_model
@ -120,8 +126,8 @@ class TestCarModelBase(unittest.TestCase):
self.safety.init_tests()
def test_car_params(self):
if self.CP.dashcamOnly:
self.skipTest("no need to check carParams for dashcamOnly")
# if self.CP.dashcamOnly:
self.skipTest("no need to check carParams for dashcamOnly")
# make sure car params are within a valid range
self.assertGreater(self.CP.mass, 1)

@ -120,7 +120,8 @@ class CarState(CarStateBase):
ret.genericToggle = bool(cp.vl["LIGHT_STALK"]["AUTO_HIGH_BEAM"])
ret.stockAeb = bool(cp_cruise.vl["PRE_COLLISION"]["PRECOLLISION_ACTIVE"] and cp_cruise.vl["PRE_COLLISION"]["FORCE"] < -1e-5)
# ret.stockAeb = bool(cp_cruise.vl["PRE_COLLISION"]["PRECOLLISION_ACTIVE"] and cp_cruise.vl["PRE_COLLISION"]["FORCE"] < -1e-5)
print(cp.vl_all['PRE_COLLISION'])
ret.espDisabled = cp.vl["ESP_CONTROL"]["TC_DISABLED"] != 0
if self.CP.enableBsm:
@ -234,17 +235,17 @@ class CarState(CarStateBase):
signals = []
checks = []
if CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
signals += [
("PRECOLLISION_ACTIVE", "PRE_COLLISION"),
("FORCE", "PRE_COLLISION"),
("ACC_TYPE", "ACC_CONTROL"),
("FCW", "ACC_HUD"),
]
checks += [
("PRE_COLLISION", 33),
("ACC_CONTROL", 33),
("ACC_HUD", 1),
]
# if CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
# signals += [
# ("PRECOLLISION_ACTIVE", "PRE_COLLISION"),
# ("FORCE", "PRE_COLLISION"),
# ("ACC_TYPE", "ACC_CONTROL"),
# ("FCW", "ACC_HUD"),
# ]
# checks += [
# ("PRE_COLLISION", 33),
# ("ACC_CONTROL", 33),
# ("ACC_HUD", 1),
# ]
return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 2)

@ -212,6 +212,7 @@ class CarInterface(CarInterfaceBase):
smartDsu = 0x2FF in fingerprint[0]
# In TSS2 cars the camera does long control
found_ecus = [fw.ecu for fw in car_fw]
print((len(found_ecus) > 0), (Ecu.dsu not in found_ecus), (candidate not in NO_DSU_CAR), (not smartDsu))
ret.enableDsu = (len(found_ecus) > 0) and (Ecu.dsu not in found_ecus) and (candidate not in NO_DSU_CAR) and (not smartDsu)
ret.enableGasInterceptor = 0x201 in fingerprint[0]
# if the smartDSU is detected, openpilot can send ACC_CMD (and the smartDSU will block it from the DSU) or not (the DSU is "connected")

Loading…
Cancel
Save