NIDEC pedal, good gas/brake transition (#22314)

* need gas to combat windbrake

* coasting deadzone

* no pcm gas and no pedal when braking
pull/22342/head
HaraldSchafer 4 years ago committed by GitHub
parent c68fc8ef9c
commit 4e939a9648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      selfdrive/car/honda/carcontroller.py

@ -188,21 +188,24 @@ class CarController():
0.5] 0.5]
# The Honda ODYSSEY seems to have different PCM_ACCEL # The Honda ODYSSEY seems to have different PCM_ACCEL
# msgs, is it other cars too? # msgs, is it other cars too?
if CS.CP.carFingerprint in HONDA_NIDEC_ALT_PCM_ACCEL: if CS.CP.enableGasInterceptor:
pcm_speed = 0.0
pcm_accel = int(0.0)
elif CS.CP.carFingerprint in HONDA_NIDEC_ALT_PCM_ACCEL:
pcm_speed_V = [0.0, pcm_speed_V = [0.0,
clip(CS.out.vEgo - 3.0, 0.0, 100.0), clip(CS.out.vEgo - 3.0, 0.0, 100.0),
clip(CS.out.vEgo + 0.0, 0.0, 100.0), clip(CS.out.vEgo + 0.0, 0.0, 100.0),
clip(CS.out.vEgo + 5.0, 0.0, 100.0)] clip(CS.out.vEgo + 5.0, 0.0, 100.0)]
pcm_speed = interp(gas-brake, pcm_speed_BP, pcm_speed_V)
pcm_accel = int((1.0) * 0xc6) pcm_accel = int((1.0) * 0xc6)
else: else:
pcm_speed_V = [0.0, pcm_speed_V = [0.0,
clip(CS.out.vEgo - 2.0, 0.0, 100.0), clip(CS.out.vEgo - 2.0, 0.0, 100.0),
clip(CS.out.vEgo + 2.0, 0.0, 100.0), clip(CS.out.vEgo + 2.0, 0.0, 100.0),
clip(CS.out.vEgo + 5.0, 0.0, 100.0)] clip(CS.out.vEgo + 5.0, 0.0, 100.0)]
pcm_speed = interp(gas-brake, pcm_speed_BP, pcm_speed_V)
pcm_accel = int(clip((accel/1.44)/max_accel, 0.0, 1.0) * 0xc6) pcm_accel = int(clip((accel/1.44)/max_accel, 0.0, 1.0) * 0xc6)
pcm_speed = interp(gas-brake, pcm_speed_BP, pcm_speed_V)
if not CS.CP.openpilotLongitudinalControl: if not CS.CP.openpilotLongitudinalControl:
if (frame % 2) == 0: if (frame % 2) == 0:
idx = frame // 2 idx = frame // 2
@ -238,7 +241,7 @@ class CarController():
gas_mult = interp(CS.out.vEgo, [0., 10.], [0.4, 1.0]) gas_mult = interp(CS.out.vEgo, [0., 10.], [0.4, 1.0])
# send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas.
# This prevents unexpected pedal range rescaling # This prevents unexpected pedal range rescaling
apply_gas = clip(gas_mult * gas, 0., 1.) apply_gas = clip(gas_mult * (gas - brake + wind_brake*3/4), 0., 1.)
can_sends.append(create_gas_command(self.packer, apply_gas, idx)) can_sends.append(create_gas_command(self.packer, apply_gas, idx))
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_car, hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_car,

Loading…
Cancel
Save