From c93f3b10f725ee581884faa764407866fb69733c Mon Sep 17 00:00:00 2001 From: HaraldSchafer Date: Thu, 2 Sep 2021 12:05:03 -0700 Subject: [PATCH] no more old nidec (#22104) --- selfdrive/car/honda/carcontroller.py | 26 ++++++++++++-------------- selfdrive/car/honda/values.py | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 9361fea286..e5f8c03926 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -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: diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 654d6e4e92..da87a7c409 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -1263,6 +1263,5 @@ SPEED_FACTOR = { CAR.HRV: 1.025, } -OLD_NIDEC_LONG_CONTROL = set([CAR.ODYSSEY, CAR.ACURA_RDX, CAR.CRV, CAR.HRV]) HONDA_BOSCH = set([CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_5G, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G]) HONDA_BOSCH_ALT_BRAKE_SIGNAL = set([CAR.ACCORD, CAR.CRV_5G, CAR.ACURA_RDX_3G])