check for safety mode mismatch (#2443)

albatross
Adeeb Shihadeh 2020-11-04 11:12:15 -08:00 committed by GitHub
parent 47c21f10f5
commit 89d02dcf97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View File

@ -201,7 +201,8 @@ class Controls:
if self.can_rcv_error or (not CS.canValid and self.sm.frame > 5 / DT_CTRL):
self.events.add(EventName.canError)
if self.mismatch_counter >= 200:
if (self.sm['health'].safetyModel != self.CP.safetyModel and self.sm.frame > 2 / DT_CTRL) or \
self.mismatch_counter >= 200:
self.events.add(EventName.controlsMismatch)
if not self.sm.alive['plan'] and self.sm.alive['pathPlan']:
# only plan not being received: radar not communicating

View File

@ -8,6 +8,7 @@ import numpy as np
from opendbc import DBC_PATH
from cereal import car
from common.realtime import Ratekeeper
from selfdrive.config import Conversions as CV
import cereal.messaging as messaging
@ -375,6 +376,7 @@ class Plant():
Plant.driverState.send(driver_state.to_bytes())
health = messaging.new_message('health')
health.health.safetyModel = car.CarParams.SafetyModel.hondaNidec
health.health.controlsAllowed = True
Plant.health.send(health.to_bytes())

View File

@ -1 +1 @@
f863303a303348b27d624a1e301857ec0b432e17
635052c6f021001fd11ec68ad0f6ee1811ee4a76

View File

@ -13,17 +13,19 @@ INJECT_MODEL = 0
segments = [
("HONDA", "d83f36766f8012a5|2020-02-05--18-42-21--2"), # HONDA.CIVIC_BOSCH_DIESEL (BOSCH)
("HONDA", "99c94dc769b5d96e|2019-08-03--14-19-59--2"), # HONDA.CIVIC (NIDEC)
("HONDA", "a74b011b32b51b56|2020-07-26--17-09-36--6"), # HONDA.CIVIC (NIDEC)
("TOYOTA", "77611a1fac303767|2020-02-29--13-29-33--3"), # TOYOTA.COROLLA_TSS2
("TOYOTA", "b14c5b4742e6fc85|2020-10-14--11-04-47--4"), # TOYOTA.RAV4 (LQR)
("TOYOTA", "0982d79ebb0de295|2020-10-18--19-11-36--5"), # TOYOTA.PRIUS (INDI)
("GM", "7cc2a8365b4dd8a9|2018-12-02--12-10-44--2"), # GM.ACADIA
("CHRYSLER", "b6849f5cf2c926b1|2020-02-28--07-29-48--13"), # CHRYSLER.PACIFICA
("HYUNDAI", "5b7c365c50084530|2020-04-15--16-13-24--3"), # HYUNDAI.SONATA
("SUBARU", "7873afaf022d36e2|2019-07-03--18-46-44--0"), # SUBARU.IMPREZA
("SUBARU", "c321c6b697c5a5ff|2020-06-23--11-04-33--12"), # SUBARU.FORESTER
("VOLKSWAGEN", "76b83eb0245de90e|2020-03-05--19-16-05--3"), # VW.GOLF
("NISSAN", "fbbfa6af821552b9|2020-03-03--08-09-43--0"), # NISSAN.XTRAIL
# TODO: update this route
("GM", "7cc2a8365b4dd8a9|2018-12-02--12-10-44--2"), # GM.ACADIA
# Enable when port is tested and dascamOnly is no longer set
#("MAZDA", "32a319f057902bb3|2020-04-27--15-18-58--2"), # MAZDA.CX5
]