diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index ed68fa7ce..59ae644ce 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -88,7 +88,7 @@ class CarController(): # dragonpilot self.turning_signal_timer = 0 self.dragon_enable_steering_on_signal = False - # self.dragon_allow_gas = False + self.dragon_allow_gas = False self.dragon_lat_ctrl = True def update(self, enabled, CS, frame, actuators, \ @@ -97,7 +97,7 @@ class CarController(): # dragonpilot, don't check for param too often as it's a kernel call if frame % 500 == 0: self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else False - # self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False + self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True # *** apply brake hysteresis *** @@ -190,15 +190,15 @@ class CarController(): # DragonAllowGas # if we detect gas pedal pressed, we do not want OP to apply gas or brake # gasPressed code from interface.py - # if not CS.CP.enableGasInterceptor: - # gasPressed = CS.pedal_gas > 0 - # else: - # gasPressed = CS.user_gas_pressed - # dragon_apply_brake = apply_brake - # if self.dragon_allow_gas and gasPressed: - # dragon_apply_brake = 0 - # apply_gas = 0 - can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on, + if not CS.CP.enableGasInterceptor: + gasPressed = CS.pedal_gas > 0 + else: + gasPressed = CS.user_gas_pressed + dragon_apply_brake = apply_brake + if self.dragon_allow_gas and gasPressed: + dragon_apply_brake = 0 + apply_gas = 0 + can_sends.append(hondacan.create_brake_command(self.packer, dragon_apply_brake, pump_on, pcm_override, pcm_cancel_cmd, hud.fcw, idx, CS.CP.carFingerprint, CS.CP.isPandaBlack)) self.apply_brake_last = apply_brake diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 8a09cbbcc..b11b719db 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -120,7 +120,7 @@ class CarController(): # dragonpilot self.turning_signal_timer = 0 self.dragon_enable_steering_on_signal = False - # self.dragon_allow_gas = False + self.dragon_allow_gas = False self.dragon_lat_ctrl = True self.dragon_lane_departure_warning = True @@ -130,7 +130,7 @@ class CarController(): # dragonpilot, don't check for param too often as it's a kernel call if frame % 500 == 0: self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else False - # self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False + self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True self.dragon_lane_departure_warning = False if params.get("DragonToyotaLaneDepartureWarning", encoding='utf8') == "0" else True @@ -247,15 +247,15 @@ class CarController(): # DragonAllowGas # if we detect gas pedal pressed, we do not want OP to apply gas or brake # gasPressed code from interface.py - # if CS.CP.enableGasInterceptor: - # # use interceptor values to disengage on pedal press - # gasPressed = CS.pedal_gas > 15 - # else: - # gasPressed = CS.pedal_gas > 0 + if CS.CP.enableGasInterceptor: + # use interceptor values to disengage on pedal press + gasPressed = CS.pedal_gas > 15 + else: + gasPressed = CS.pedal_gas > 0 - # if self.dragon_allow_gas and gasPressed: - # apply_accel = 0 - # apply_gas = 0 + if self.dragon_allow_gas and gasPressed: + 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):