Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frogpilot/car/honda/values_ext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from enum import IntFlag


class HondaFlagsFP(IntFlag):
EPS_MODIFIED = 128
14 changes: 7 additions & 7 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from openpilot.selfdrive.car.honda.hondacan import CanBus
from openpilot.selfdrive.car.honda.values import CarControllerParams, CruiseButtons, CruiseSettings, HondaFlags, CAR, HONDA_BOSCH, \
HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS
from openpilot.frogpilot.car.honda.values_ext import HondaFlagsFP
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.disable_ecu import disable_ecu
Expand Down Expand Up @@ -90,13 +91,12 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs, fr
ret.longitudinalTuning.kiBP = [0., 5., 35.]
ret.longitudinalTuning.kiV = [1.2, 0.8, 0.5]

eps_modified = False
for fw in car_fw:
if fw.ecu == "eps" and b"," in fw.fwVersion:
eps_modified = True
ret.flags |= HondaFlagsFP.EPS_MODIFIED.value

if candidate == CAR.HONDA_CIVIC:
if eps_modified:
if ret.flags & HondaFlagsFP.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
Expand All @@ -110,7 +110,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs, fr
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]]

elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022):
if eps_modified:
if ret.flags & HondaFlagsFP.EPS_MODIFIED:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2564, 8000], [0, 2564, 3840]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] # 2.5x Modded EPS
else:
Expand All @@ -120,7 +120,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs, fr
elif candidate == CAR.HONDA_ACCORD:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end

if eps_modified:
if ret.flags & HondaFlagsFP.EPS_MODIFIED:
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]]
else:
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]]
Expand All @@ -135,7 +135,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs, fr
ret.wheelSpeedFactor = 1.025

elif candidate == CAR.HONDA_CRV_5G:
if eps_modified:
if ret.flags & HondaFlagsFP.EPS_MODIFIED:
# stock request input values: 0x0000, 0x00DB, 0x01BB, 0x0296, 0x0377, 0x0454, 0x0532, 0x0610, 0x067F
# 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
Expand Down Expand Up @@ -200,7 +200,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs, fr

elif candidate == CAR.HONDA_CLARITY:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_CLARITY
if eps_modified:
if ret.flags & HondaFlagsFP.EPS_MODIFIED:
for fw in car_fw:
if fw.ecu == "eps" and b"-" not in fw.fwVersion and b"," in fw.fwVersion:
ret.lateralTuning.pid.kf = 0.00004
Expand Down