Merge branch 'devel-en' into devel-zht

This commit is contained in:
Dragonpilot
2019-07-23 15:41:11 +10:00
6 changed files with 47 additions and 12 deletions
+1
View File
@@ -92,6 +92,7 @@ keys = {
"DragonCachedModel": [TxType.PERSISTENT],
"DragonCachedFP": [TxType.PERSISTENT],
"DragonCachedVIN": [TxType.PERSISTENT],
"DragonAllowGas": [TxType.PERSISTENT],
}
+10
View File
@@ -182,6 +182,16 @@ class CarController(object):
idx = frame // 2
ts = frame * DT_CTRL
pump_on, self.last_pump_ts = brake_pump_hysteresis(apply_brake, self.apply_brake_last, self.last_pump_ts, ts)
# 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
if params.get("DragonAllowGas") == "1" and gasPressed:
apply_brake = 0
apply_gas = 0
can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on,
pcm_override, pcm_cancel_cmd, hud.chime, hud.fcw, idx))
self.apply_brake_last = apply_brake
+11 -6
View File
@@ -504,13 +504,18 @@ class CarInterface(object):
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]))
# DragonAllowGas
if params.get("DragonAllowGas") == "0":
# 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]))
if ret.gasPressed:
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
else:
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]))
# 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
+13
View File
@@ -229,6 +229,19 @@ class CarController(object):
elif ECU.APGS in self.fake_ecus:
can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True))
# 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 params.get("DragonAllowGas") == "1" 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):
lead = lead or CS.v_ego < 12. # at low speed we always assume the lead is present do ACC can be engaged
+11 -6
View File
@@ -370,13 +370,18 @@ class CarInterface(object):
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]))
# DragonAllowGas
if params.get("DragonAllowGas") == "0":
# 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]))
if ret.gasPressed:
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
else:
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]))
ret.events = events
@@ -17,6 +17,7 @@ default_conf = {
'DragonCachedModel': '', # for cache car
'DragonCachedFP': '', # for cache car
'DragonCachedVIN': '', # for cache car
'DragonAllowGas': '0',
}
def dragonpilot_set_params(params):