|
|
|
@ -5,7 +5,7 @@ from selfdrive.controls.lib.drive_helpers import rate_limit |
|
|
|
|
from common.numpy_fast import clip, interp |
|
|
|
|
from selfdrive.car import create_gas_command |
|
|
|
|
from selfdrive.car.honda import hondacan |
|
|
|
|
from selfdrive.car.honda.values import OLD_NIDEC_LONG_CONTROL, CruiseButtons, VISUAL_HUD, HONDA_BOSCH, CarControllerParams |
|
|
|
|
from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, CarControllerParams |
|
|
|
|
from opendbc.can.packer import CANPacker |
|
|
|
|
|
|
|
|
|
VisualAlert = car.CarControl.HUDControl.VisualAlert |
|
|
|
@ -183,20 +183,18 @@ class CarController(): |
|
|
|
|
|
|
|
|
|
# wind brake from air resistance decel at high speed |
|
|
|
|
wind_brake = interp(CS.out.vEgo, [0.0, 2.3, 35.0], [0.001, 0.002, 0.15]) |
|
|
|
|
if CS.CP.carFingerprint in OLD_NIDEC_LONG_CONTROL: |
|
|
|
|
#pcm_speed = pcm_speed |
|
|
|
|
pcm_accel = int(clip(pcm_accel, 0, 1) * 0xc6) |
|
|
|
|
else: |
|
|
|
|
max_accel = interp(CS.out.vEgo, P.NIDEC_MAX_ACCEL_BP, P.NIDEC_MAX_ACCEL_V) |
|
|
|
|
# TODO this 1.44 is just to maintain previous behavior |
|
|
|
|
pcm_accel = int(clip((accel/1.44)/max_accel, 0.0, 1.0) * 0xc6) |
|
|
|
|
pcm_speed_BP = [-wind_brake, |
|
|
|
|
-wind_brake*(3/4), |
|
|
|
|
|
|
|
|
|
# All of this is only relevant for HONDA NIDEC |
|
|
|
|
max_accel = interp(CS.out.vEgo, P.NIDEC_MAX_ACCEL_BP, P.NIDEC_MAX_ACCEL_V) |
|
|
|
|
# TODO this 1.44 is just to maintain previous behavior |
|
|
|
|
pcm_accel = int(clip((accel/1.44)/max_accel, 0.0, 1.0) * 0xc6) |
|
|
|
|
pcm_speed_BP = [-wind_brake, |
|
|
|
|
-wind_brake*(3/4), |
|
|
|
|
0.0] |
|
|
|
|
pcm_speed_V = [0.0, |
|
|
|
|
clip(CS.out.vEgo + accel/2.0 - 2.0, 0.0, 100.0), |
|
|
|
|
clip(CS.out.vEgo + accel/2.0 + 2.0, 0.0, 100.0)] |
|
|
|
|
pcm_speed = interp(-brake, pcm_speed_BP, pcm_speed_V) |
|
|
|
|
pcm_speed_V = [0.0, |
|
|
|
|
clip(CS.out.vEgo + accel/2.0 - 2.0, 0.0, 100.0), |
|
|
|
|
clip(CS.out.vEgo + accel/2.0 + 2.0, 0.0, 100.0)] |
|
|
|
|
pcm_speed = interp(-brake, pcm_speed_BP, pcm_speed_V) |
|
|
|
|
|
|
|
|
|
if not CS.CP.openpilotLongitudinalControl: |
|
|
|
|
if (frame % 2) == 0: |
|
|
|
|