diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 3f7c5c93c..544b46ee2 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -168,6 +168,9 @@ class CarController(object): can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) else: + if CS.car_gas > 0 and dragonconf.conf["allowGasOnOP"]: + apply_brake = 0 + apply_gas = 0. # Send gas and brake commands. if (frame % 2) == 0: idx = frame // 2 diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index c261d86c2..b05830a66 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -11,7 +11,8 @@ from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.honda.carstate import CarState, get_can_parser, get_cam_can_parser from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, AUDIO_HUD, VISUAL_HUD from selfdrive.controls.lib.planner import _A_CRUISE_MAX_V_FOLLOWING - +from selfdrive.dragonpilot.dragonconf.dragonconf import dragonconf +dragonconf = dragonconf() # msgs sent for steering controller by camera module on can 0. # those messages are mutually exclusive on CRV and non-CRV cars @@ -539,11 +540,13 @@ class CarInterface(object): 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)): + if ret.gasPressed and not self.gas_pressed_prev and not dragonconf.conf["allowGasOnOP"]: events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - if ret.gasPressed: + if 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 and not dragonconf.conf["allowGasOnOP"]: events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 744514d5d..42c52cfba 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -220,6 +220,9 @@ class CarController(object): elif ECU.APGS in self.fake_ecus: can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True)) + if CS.gas_pressed and dragonconf.conf["allowGasOnOP"]: + apply_accel = 0 + apply_gas = 0 # accel cmd comes from DSU, but we can spam can to cancel the system even if we are using lat only control if (frame % 3 == 0 and ECU.DSU in self.fake_ecus) or (pcm_cancel_cmd and ECU.CAM in self.fake_ecus): lead = lead or CS.v_ego < 12. # at low speed we always assume the lead is present do ACC can be engaged diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 71ace4c1f..59acbe3eb 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -7,6 +7,8 @@ from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.car.toyota.carstate import CarState, get_can_parser, get_cam_can_parser from selfdrive.car.toyota.values import ECU, check_ecu_msgs, CAR, NO_STOP_TIMER_CAR from selfdrive.swaglog import cloudlog +from selfdrive.dragonpilot.dragonconf.dragonconf import dragonconf +dragonconf = dragonconf() class CarInterface(object): @@ -373,10 +375,10 @@ class CarInterface(object): # while in standstill, send a user alert events.append(create_event('manualRestart', [ET.WARNING])) - # enable request in prius is simple, as we activate when Toyota is active (rising edge) - if ret.cruiseState.enabled and not self.cruise_enabled_prev: - events.append(create_event('pcmEnable', [ET.ENABLE])) - elif not ret.cruiseState.enabled: + if ret.gasPressed and not self.gas_pressed_prev and not dragonconf.conf["allowGasOnOP"]: + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + + if ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001): events.append(create_event('pcmDisable', [ET.USER_DISABLE])) # disable on pedals rising edge or when brake is pressed and speed isn't zero @@ -384,7 +386,7 @@ class CarInterface(object): (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: + if ret.gasPressed and not dragonconf.conf["allowGasOnOP"]: events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) ret.events = events diff --git a/selfdrive/dragonpilot/dragonconf/dragonconf.py b/selfdrive/dragonpilot/dragonconf/dragonconf.py index 4d1372162..daad25450 100644 --- a/selfdrive/dragonpilot/dragonconf/dragonconf.py +++ b/selfdrive/dragonpilot/dragonconf/dragonconf.py @@ -48,6 +48,14 @@ class dragonconf(): if has_new_def: self.write(config) + # Allow Gas with OP, default False + if "allowGasOnOP" not in config: + config["allowGasOnOP"] = False + has_new_def = True + if has_new_def: + self.write(config) + + return config def write(self, config):