diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py index 333b71ec10..428b7f2149 100755 --- a/selfdrive/car/chrysler/interface.py +++ b/selfdrive/car/chrysler/interface.py @@ -70,19 +70,13 @@ class CarInterface(CarInterfaceBase): ret.buttonEvents = [] # events - events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low]) + events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low], gas_resume_speed = 2.) if ret.cruiseState.enabled and not self.cruise_enabled_prev: events.append(create_event('pcmEnable', [ET.ENABLE])) elif not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on gas pedal and speed isn't zero. Gas pedal is used to resume ACC - # from a 3+ second stop. - if (ret.gasPressed and (not self.gas_pressed_prev) and ret.vEgo > 2.0) or \ - (ret.brakePressed and (not self.brake_pressed_prev or not ret.standstill)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - if ret.vEgo < self.CP.minSteerSpeed: events.append(create_event('belowSteerSpeed', [ET.WARNING])) diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index fb6ed1890f..6a5992406a 100755 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -67,11 +67,6 @@ class CarInterface(CarInterfaceBase): elif not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - if self.CS.lkas_state not in [2, 3] and ret.vEgo > 13.* CV.MPH_TO_MS and ret.cruiseState.enabled: events.append(create_event('steerTempUnavailableMute', [ET.WARNING])) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 1cc664bdfd..48b744a928 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -173,10 +173,6 @@ class CarInterface(CarInterfaceBase): events.append(create_event('speedTooLow', [ET.NO_ENTRY])) if self.CS.park_brake: events.append(create_event('parkBrake', [ET.NO_ENTRY, ET.USER_DISABLE])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed): # and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) if ret.cruiseState.standstill: events.append(create_event('resumeRequired', [ET.WARNING])) if self.CS.pcm_acc_status == AccState.FAULTED: diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index a602ef533b..a1e6243052 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -353,7 +353,7 @@ class CarInterface(CarInterfaceBase): ret.longitudinalTuning.kpV = [1.2, 0.8, 0.5] ret.longitudinalTuning.kiBP = [0., 35.] ret.longitudinalTuning.kiV = [0.18, 0.12] - + elif candidate == CAR.INSIGHT: stop_and_go = True ret.mass = 2987. * CV.LB_TO_KG + STD_CARGO_KG @@ -465,11 +465,6 @@ class CarInterface(CarInterfaceBase): if self.CP.enableCruise and ret.vEgo < self.CP.minEnableSpeed: events.append(create_event('speedTooLow', [ET.NO_ENTRY])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low if self.CP.enableCruise and not ret.cruiseState.enabled and (c.actuators.brake <= 0. or not self.CP.openpilotLongitudinalControl): diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index dfc1042649..2ec2d57aec 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -111,11 +111,6 @@ class CarInterface(CarInterfaceBase): elif not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgoRaw > 0.1)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - # low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s) if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.: self.low_speed_alert = True diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index adbb65f9a6..a25df91f9b 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -81,7 +81,7 @@ class CarInterfaceBase(): def apply(self, c): raise NotImplementedError - def create_common_events(self, cs_out, extra_gears=[]): + def create_common_events(self, cs_out, extra_gears=[], gas_resume_speed=-1): events = [] if cs_out.doorOpen: @@ -105,6 +105,13 @@ class CarInterfaceBase(): elif getattr(self.CS, "steer_warning", False): events.append(create_event('steerTempUnavailable', [ET.NO_ENTRY, ET.WARNING])) + # Disable on rising edge of gas or brake. Also disable on brake when speed > 0. + # Optionally allow to press gas at zero speed to resume. + # e.g. Chrysler does not spam the resume button yet, so resuming with gas is handy. FIXME! + if (cs_out.gasPressed and (not self.gas_pressed_prev) and cs_out.vEgo > gas_resume_speed) or \ + (cs_out.brakePressed and (not self.brake_pressed_prev or not cs_out.standstill)): + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + return events class RadarInterfaceBase(): diff --git a/selfdrive/car/nissan/interface.py b/selfdrive/car/nissan/interface.py index 208af9fd63..47d18297af 100644 --- a/selfdrive/car/nissan/interface.py +++ b/selfdrive/car/nissan/interface.py @@ -75,14 +75,6 @@ class CarInterface(CarInterfaceBase): if not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - - if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) - ret.events = events # update previous brake/gas pressed diff --git a/selfdrive/car/subaru/interface.py b/selfdrive/car/subaru/interface.py index 81a1c95b59..0f2f4176cf 100644 --- a/selfdrive/car/subaru/interface.py +++ b/selfdrive/car/subaru/interface.py @@ -70,11 +70,6 @@ class CarInterface(CarInterfaceBase): if not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on gas pedal rising edge - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - ret.events = events self.gas_pressed_prev = ret.gasPressed diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 45f9a356e9..c8e6da5501 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -316,11 +316,6 @@ class CarInterface(CarInterfaceBase): elif not ret.cruiseState.enabled: events.append(create_event('pcmDisable', [ET.USER_DISABLE])) - # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - ret.events = events self.gas_pressed_prev = ret.gasPressed diff --git a/selfdrive/car/volkswagen/interface.py b/selfdrive/car/volkswagen/interface.py index 60fa227c75..4a2f7cb7a3 100644 --- a/selfdrive/car/volkswagen/interface.py +++ b/selfdrive/car/volkswagen/interface.py @@ -110,12 +110,6 @@ class CarInterface(CarInterfaceBase): if self.CS.steeringFault: events.append(create_event('steerTempUnavailable', [ET.NO_ENTRY, ET.WARNING])) - # Per the Comma safety model, disable on pedals rising edge or when brake - # is pressed and speed isn't zero. - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or not ret.standstill)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - # Engagement and longitudinal control using stock ACC. Make sure OP is # disengaged if stock ACC is disengaged. if not ret.cruiseState.enabled: diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index e466c41678..5f3d060951 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -f48e39778dc502d62fa2eac515f886f7d7520ffa \ No newline at end of file +7bc2ec3b0888827c0028bc7b35ede111ba2b0419 \ No newline at end of file