mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-26 07:43:51 +08:00
Honda: fix brake pressed signal (#23683)
* or brake_switch * remove car exceptions * Revert "remove car exceptions" This reverts commit cad6a552aa4a17c69616014d3e9333d30c1fadd3. * does have ts noise, use updated * bump panda for tests * bump * messsssy draft * clean up * clean up * bump * CS: process all messages at once, like we do during real openpilot usage * handle multiple messages updated in one cycle * bump * bump * use less confusing, but equivalent cp.vl * Update selfdrive/test/test_models.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * no msg * bump opendbc * Update selfdrive/car/honda/carstate.py Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * same test logic * add brake_switch_prev to class * need to set previous brake switch when not lagging (most of the time) * need to compare * only update previous if updated this cycle rm * need to maintain previous active state * move brake_switch * bump opendbc * bump * bump * bump * bump * bump * bump * bump opendbc * rename * oops * bump opendbc * bump Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
2
opendbc
2
opendbc
Submodule opendbc updated: 572ab7641b...053a761244
2
panda
2
panda
Submodule panda updated: 2d96ef02df...ab10c977d2
@@ -163,8 +163,8 @@ class CarState(CarStateBase):
|
||||
self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"])
|
||||
|
||||
self.brake_error = False
|
||||
self.brake_switch_prev = 0
|
||||
self.brake_switch_prev_ts = 0
|
||||
self.brake_switch_prev = False
|
||||
self.brake_switch_active = False
|
||||
self.cruise_setting = 0
|
||||
self.v_cruise_pcm_prev = 0
|
||||
|
||||
@@ -260,18 +260,20 @@ class CarState(CarStateBase):
|
||||
else:
|
||||
ret.cruiseState.speed = cp.vl["CRUISE"]["CRUISE_SPEED_PCM"] * CV.KPH_TO_MS
|
||||
|
||||
self.brake_switch = cp.vl["POWERTRAIN_DATA"]["BRAKE_SWITCH"] != 0
|
||||
if self.CP.carFingerprint in HONDA_BOSCH_ALT_BRAKE_SIGNAL:
|
||||
ret.brakePressed = cp.vl["BRAKE_MODULE"]["BRAKE_PRESSED"] != 0
|
||||
else:
|
||||
# brake switch has shown some single time step noise, so only considered when
|
||||
# switch is on for at least 2 consecutive CAN samples
|
||||
# panda safety only checks BRAKE_PRESSED signal
|
||||
ret.brakePressed = bool(cp.vl["POWERTRAIN_DATA"]["BRAKE_PRESSED"] or
|
||||
(self.brake_switch and self.brake_switch_prev and cp.ts["POWERTRAIN_DATA"]["BRAKE_SWITCH"] != self.brake_switch_prev_ts))
|
||||
|
||||
self.brake_switch_prev = self.brake_switch
|
||||
self.brake_switch_prev_ts = cp.ts["POWERTRAIN_DATA"]["BRAKE_SWITCH"]
|
||||
# brake switch rises earlier than brake pressed but is never 1 when in park
|
||||
brake_switch_vals = cp.vl_all["POWERTRAIN_DATA"]["BRAKE_SWITCH"]
|
||||
if len(brake_switch_vals):
|
||||
brake_switch = cp.vl["POWERTRAIN_DATA"]["BRAKE_SWITCH"] != 0
|
||||
if len(brake_switch_vals) > 1:
|
||||
self.brake_switch_prev = brake_switch_vals[-2] != 0
|
||||
self.brake_switch_active = brake_switch and self.brake_switch_prev
|
||||
self.brake_switch_prev = brake_switch
|
||||
ret.brakePressed = (cp.vl["POWERTRAIN_DATA"]["BRAKE_PRESSED"] != 0) or self.brake_switch_active
|
||||
|
||||
ret.brake = cp.vl["VSA_STATUS"]["USER_BRAKE"]
|
||||
ret.cruiseState.enabled = cp.vl["POWERTRAIN_DATA"]["ACC_STATUS"] != 0
|
||||
|
||||
@@ -220,8 +220,6 @@ class TestCarModel(unittest.TestCase):
|
||||
if CS.brakePressed and not self.safety.get_brake_pressed_prev():
|
||||
if self.CP.carFingerprint in (HONDA.PILOT, HONDA.PASSPORT, HONDA.RIDGELINE) and CS.brake > 0.05:
|
||||
brake_pressed = False
|
||||
if self.CP.carName == "honda" and self.CI.CS.brake_switch:
|
||||
brake_pressed = False
|
||||
checks['brakePressed'] += brake_pressed != self.safety.get_brake_pressed_prev()
|
||||
|
||||
if self.CP.pcmCruise:
|
||||
|
||||
@@ -22,7 +22,7 @@ from tools.lib.logreader import LogReader
|
||||
|
||||
# Baseline CPU usage by process
|
||||
PROCS = {
|
||||
"selfdrive.controls.controlsd": 50.0,
|
||||
"selfdrive.controls.controlsd": 55.0,
|
||||
"./loggerd": 45.0,
|
||||
"./locationd": 9.1,
|
||||
"selfdrive.controls.plannerd": 22.6,
|
||||
@@ -30,7 +30,7 @@ PROCS = {
|
||||
"selfdrive.locationd.paramsd": 9.1,
|
||||
"./camerad": 7.07,
|
||||
"./_sensord": 6.17,
|
||||
"selfdrive.controls.radard": 5.67,
|
||||
"selfdrive.controls.radard": 7.0,
|
||||
"./_modeld": 4.48,
|
||||
"./boardd": 3.63,
|
||||
"./_dmonitoringmodeld": 2.67,
|
||||
@@ -55,13 +55,13 @@ if EON:
|
||||
if TICI:
|
||||
PROCS.update({
|
||||
"./loggerd": 70.0,
|
||||
"selfdrive.controls.controlsd": 28.0,
|
||||
"selfdrive.controls.controlsd": 31.0,
|
||||
"./camerad": 31.0,
|
||||
"./_ui": 33.0,
|
||||
"selfdrive.controls.plannerd": 11.7,
|
||||
"./_dmonitoringmodeld": 10.0,
|
||||
"selfdrive.locationd.paramsd": 5.0,
|
||||
"selfdrive.controls.radard": 3.6,
|
||||
"selfdrive.controls.radard": 4.5,
|
||||
"selfdrive.thermald.thermald": 3.87,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user