diff --git a/selfdrive/assets/img_chffr_wheel.png b/selfdrive/assets/img_chffr_wheel.png index 3f09a35a79bf45..13cad7a61b3ed9 100644 Binary files a/selfdrive/assets/img_chffr_wheel.png and b/selfdrive/assets/img_chffr_wheel.png differ diff --git a/selfdrive/assets/img_spinner_comma.png b/selfdrive/assets/img_spinner_comma.png index 16109557f85911..b54b2e1467cf86 100644 Binary files a/selfdrive/assets/img_spinner_comma.png and b/selfdrive/assets/img_spinner_comma.png differ diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 265175d94038ac..213fae50d06515 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -3,6 +3,7 @@ from panda import Panda from common.conversions import Conversions as CV from common.numpy_fast import interp +from common.params import Params from selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL from selfdrive.car import STD_CARGO_KG, CivicParams, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase @@ -88,15 +89,20 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.wheelbase = CivicParams.WHEELBASE ret.centerToFront = CivicParams.CENTER_TO_FRONT ret.steerRatio = 15.38 # 10.93 is end-to-end spec + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 8000], [0, 2560, 3840]] if eps_modified: - # stock request input values: 0x0000, 0x00DE, 0x014D, 0x01EF, 0x0290, 0x0377, 0x0454, 0x0610, 0x06EE - # stock request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x1680, 0x1680 - # modified request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x2880, 0x3180 - # stock filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108 - # modified filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0400, 0x0480 - # note: max request allowed is 4096, but request is capped at 3840 in firmware, so modifications result in 2x max - ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 8000], [0, 2560, 3840]] - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.1]] + if Params().get_bool('Torque'): + max_torque = 2.0 + friction = 0.05 + + ret.lateralTuning.init('torque') + ret.lateralTuning.torque.useSteeringAngle = True + ret.lateralTuning.torque.kp = 2.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.kf = 1.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.ki = 0.5 / MAX_LAT_ACCEL + ret.lateralTuning.torque.friction = friction + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.1]] else: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] @@ -108,9 +114,24 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.wheelbase = CivicParams.WHEELBASE ret.centerToFront = CivicParams.CENTER_TO_FRONT ret.steerRatio = 15.38 # 10.93 is end-to-end spec - ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2564, 8000], [0, 2564, 3840]] + if eps_modified: + if Params().get_bool('Torque'): + max_torque = 2.0 + friction = 0.05 + + ret.lateralTuning.init('torque') + ret.lateralTuning.torque.useSteeringAngle = True + ret.lateralTuning.torque.kp = 2.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.kf = 1.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.ki = 0.5 / MAX_LAT_ACCEL + ret.lateralTuning.torque.friction = friction + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.36], [0.108]] #minus 10% from 0.4, 0.12 + else: + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] tire_stiffness_factor = 1. - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] elif candidate in (CAR.ACCORD, CAR.ACCORDH): stop_and_go = True @@ -119,13 +140,20 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.centerToFront = ret.wheelbase * 0.39 ret.steerRatio = 16.33 # 11.82 is spec end-to-end ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - tire_stiffness_factor = 0.8467 - - if eps_modified: - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] + if Params().get_bool('Torque'): + max_torque = 2.0 + friction = 0.05 + + ret.lateralTuning.init('torque') + ret.lateralTuning.torque.useSteeringAngle = True + ret.lateralTuning.torque.kp = 2.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.kf = 1.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.ki = 0.5 / MAX_LAT_ACCEL + ret.lateralTuning.torque.friction = friction else: ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] - + tire_stiffness_factor = 0.8467 + elif candidate == CAR.ACURA_ILX: stop_and_go = False ret.mass = 3095. * CV.LB_TO_KG + STD_CARGO_KG @@ -158,7 +186,19 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl # stock request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x129A, 0x134D, 0x1400 # modified request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x1ACD, 0x239A, 0x2800 ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 10000], [0, 2560, 3840]] - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.21], [0.07]] + # Use LQR tune if param is set + if Params().get_bool('Torque'): + max_torque = 2.0 + friction = 0.05 + + ret.lateralTuning.init('torque') + ret.lateralTuning.torque.useSteeringAngle = True + ret.lateralTuning.torque.kp = 2.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.kf = 1.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.ki = 0.5 / MAX_LAT_ACCEL + ret.lateralTuning.torque.friction = friction + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.21], [0.07]] else: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]] @@ -223,11 +263,24 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.mass = 4068. * CV.LB_TO_KG + STD_CARGO_KG ret.wheelbase = 2.75 ret.centerToFront = ret.wheelbase * 0.41 - ret.steerRatio = 11.95 # as spec + ret.steerRatio = 16.0 #11.95 is spec ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]] + if Params().get_bool('Torque'): + max_torque = 2.0 + friction = 0.05 + + ret.lateralTuning.init('torque') + ret.lateralTuning.torque.useSteeringAngle = True + ret.lateralTuning.torque.kp = 2.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.kf = 1.0 / MAX_LAT_ACCEL + ret.lateralTuning.torque.ki = 0.5 / MAX_LAT_ACCEL + ret.lateralTuning.torque.friction = friction + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.06]] + ret.lateralTuning.pid.kf = 0.00007818594 tire_stiffness_factor = 0.677 + elif candidate == CAR.ODYSSEY: stop_and_go = False ret.mass = 4471. * CV.LB_TO_KG + STD_CARGO_KG diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index ab1f44ac87b03b..449b67c287efd8 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -535,6 +535,15 @@ class Footnote(Enum): b'39990-TGG-J510\x00\x00', b'39990-TGL-E130\x00\x00', b'39990-TGN-E120\x00\x00', + b'39990-TBA,C020\x00\x00', + b'39990-TBA,C120\x00\x00', + b'39990-TEA,T820\x00\x00', + b'39990-TEZ,T020\x00\x00', + b'39990-TGG,A020\x00\x00', + b'39990-TGG,A120\x00\x00', + b'39990-TGG,J510\x00\x00', + b'39990-TGL,E130\x00\x00', + b'39990-TGN,E120\x00\x00', ], (Ecu.srs, 0x18da53f1, None): [ b'77959-TBA-A060\x00\x00', diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index b3d0aefa8439e6..58d9f171b7f9b1 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -2,6 +2,8 @@ from cereal import car from common.conversions import Conversions as CV from panda import Panda +from common.numpy_fast import interp +from common.params import Params from selfdrive.car.toyota.tunes import LatTunes, LongTunes, set_long_tune, set_lat_tune from selfdrive.car.toyota.values import Ecu, CAR, ToyotaFlags, TSS2_CAR, NO_DSU_CAR, MIN_ACC_SPEED, EPS_SCALE, EV_HYBRID_CAR, CarControllerParams from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config @@ -87,7 +89,10 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.steerRatio = 13.7 tire_stiffness_factor = 0.7933 ret.mass = 3400. * CV.LB_TO_KG + STD_CARGO_KG # mean between normal and hybrid - set_lat_tune(ret.lateralTuning, LatTunes.PID_C) + if Params().get_bool('Torque'): + set_lat_tune(ret.lateralTuning, LatTunes.TORQUE, MAX_LAT_ACCEL=2.0, FRICTION=0.10) + else: + set_lat_tune(ret.lateralTuning, LatTunes.PID_C) elif candidate in (CAR.HIGHLANDER_TSS2, CAR.HIGHLANDERH_TSS2): stop_and_go = True @@ -183,7 +188,10 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl ret.steerRatio = 13.4 # True steerRatio from older prius tire_stiffness_factor = 0.6371 # hand-tune ret.mass = 3115. * CV.LB_TO_KG + STD_CARGO_KG - set_lat_tune(ret.lateralTuning, LatTunes.PID_N) + if Params().get_bool('Torque'): + set_lat_tune(ret.lateralTuning, LatTunes.TORQUE, MAX_LAT_ACCEL=2.0, FRICTION=0.10) + else: + set_lat_tune(ret.lateralTuning, LatTunes.PID_N) elif candidate == CAR.MIRAI: stop_and_go = True @@ -236,7 +244,12 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl set_long_tune(ret.longitudinalTuning, LongTunes.PEDAL) elif candidate in TSS2_CAR: set_long_tune(ret.longitudinalTuning, LongTunes.TSS2) - ret.stoppingDecelRate = 0.3 # reach stopping target smoothly + # Improved longitudinal tune settings from sshane + ret.vEgoStopping = 0.2 # car is near 0.1 to 0.2 when car starts requesting stopping accel + ret.vEgoStarting = 0.2 # needs to be > or == vEgoStopping + ret.stoppingDecelRate = 0.3 # reach stopping target smoothly - seems to take 0.5 seconds to go from 0 to -0.4 + ret.longitudinalActuatorDelayLowerBound = 0.3 + ret.longitudinalActuatorDelayUpperBound = 0.3 else: set_long_tune(ret.longitudinalTuning, LongTunes.TSS) diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index bb3800534bf82d..8c08ef587b962a 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -177,6 +177,7 @@ std::unordered_map keys = { {"Offroad_TemperatureTooHigh", CLEAR_ON_MANAGER_START}, {"Offroad_UnofficialHardware", CLEAR_ON_MANAGER_START}, {"Offroad_UpdateFailed", CLEAR_ON_MANAGER_START}, + {"Torque", PERSISTENT}, }; } // namespace diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 19620cbf4b989d..e6b273be0351d6 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -246,10 +246,10 @@ def calibration_incomplete_alert(CP: car.CarParams, sm: messaging.SubMaster, met def no_gps_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: gps_integrated = sm['peripheralState'].pandaType in (log.PandaState.PandaType.uno, log.PandaState.PandaType.dos) return Alert( - "Poor GPS reception", - "Hardware malfunctioning if sky is visible" if gps_integrated else "Check GPS antenna placement", - AlertStatus.normal, AlertSize.mid, - Priority.LOWER, VisualAlert.none, AudibleAlert.none, .2, creation_delay=300.) + "", + "If sky is visible, contact support" if gps_integrated else "", + AlertStatus.normal, AlertSize.none, + Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., .2) # *** debug alerts *** @@ -509,7 +509,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool, sof "Take Control", "Turn Exceeds Steering Limit", AlertStatus.userPrompt, AlertSize.mid, - Priority.LOW, VisualAlert.steerRequired, AudibleAlert.promptRepeat, 1.), + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, 1., 1., 1.), }, # Thrown when the fan is driven at >50% but is not rotating diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 0d21c519a3534b..f94e54b69ca660 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -17,8 +17,8 @@ LON_MPC_STEP = 0.2 # first step is 0.2s AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted A_CRUISE_MIN = -1.2 -A_CRUISE_MAX_VALS = [1.2, 1.2, 0.8, 0.6] -A_CRUISE_MAX_BP = [0., 15., 25., 40.] +A_CRUISE_MAX_VALS = [2.5, 3.0, 2.5, 1.5, 1.2] # Sets the limits of the planner accel, PID may exceed +A_CRUISE_MAX_BP = [0., 5., 10., 20., 55.] # Lookup table for turns _A_TOTAL_MAX_V = [1.7, 3.2] diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 1934da67015fcc..1a2074656b3c98 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -41,6 +41,7 @@ def manager_init() -> None: ("DisengageOnAccelerator", "1"), ("HasAcceptedTerms", "0"), ("OpenpilotEnabledToggle", "1"), + ("DisableRadar_Allow", "1"), ] if not PC: default_params.append(("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) diff --git a/selfdrive/thermald/power_monitoring.py b/selfdrive/thermald/power_monitoring.py index 25b1bad04dd0c2..cc1f9bd563fb4e 100644 --- a/selfdrive/thermald/power_monitoring.py +++ b/selfdrive/thermald/power_monitoring.py @@ -20,7 +20,7 @@ VBATT_PAUSE_CHARGING = 11.0 # Lower limit on the LPF car battery voltage VBATT_INSTANT_PAUSE_CHARGING = 7.0 # Lower limit on the instant car battery voltage measurements to avoid triggering on instant power loss -MAX_TIME_OFFROAD_S = 30*3600 +MAX_TIME_OFFROAD_S = 3*3600 #3 hours MIN_ON_TIME_S = 3600 class PowerMonitoring: diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index 23a040dd561418..71e982c2258822 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -71,6 +71,12 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { "When enabled, pressing the accelerator pedal will disengage openpilot.", "../assets/offroad/icon_disengage_on_accelerator.svg", }, + { + "Torque", + "Use Torque Tune", + "Use Torque tuning values. For select models only..", + "../assets/offroad/icon_openpilot.png", + }, #ifdef ENABLE_MAPS { "NavSettingTime24h",