Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge update #1

Merged
merged 48 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f4f081c
cabana: imporve series selector dialog (#27266)
deanlee Feb 8, 2023
d096ec1
bump opendbc (#27253)
sshane Feb 8, 2023
276586f
cabana: bit level change frequency highlighting (#27259)
pd0wm Feb 8, 2023
ec6a550
Rename GM CS variable to be consistent to the CAN parsers
sshane Feb 9, 2023
134766f
Toyota: Car Port for Toyota C-HR 2021 (TSS2) (#27212)
eFiniLan Feb 9, 2023
ccfa73f
Remove Bolt EV platform from torque params
sshane Feb 9, 2023
955c1df
ui: dmoji (#27070)
ZwX1616 Feb 9, 2023
a522dce
add dmoji to release notes
adeebshihadeh Feb 9, 2023
d744702
Chrysler: torque tuning + increased steer rate (#26934)
nuwandavek Feb 9, 2023
dae1331
HKG: Car Port for Kia Niro Hybrid 2023 (HDA1) (#26827)
sunnyhaibin Feb 9, 2023
542345a
Hyundai CAN-FD: use common PT bus function (#27268)
sunnyhaibin Feb 9, 2023
1e49c54
new model: improved height estimation (#27234)
YassineYousfi Feb 9, 2023
37abe37
cabana: set series color in createSeries (#27270)
deanlee Feb 9, 2023
b2d9a24
Chrysler: remove Pacifica 2018 ICE from tuning blacklist (#27272)
sshane Feb 9, 2023
be6f5c6
VW MQB: Add FW for 2023 Volkswagen Tiguan (#27273)
jyoung8607 Feb 9, 2023
cd37231
add g++-12 dependancy for Ubuntu 22.04 (#27263)
ClockeNessMnstr Feb 9, 2023
9aac080
GM: increase min steer speed to avoid temporary faults (#27274)
sshane Feb 9, 2023
ab6bb8a
Hyundai: add IONIQ 5 fwdCamera FW version (#27209)
chaichuansheng88 Feb 9, 2023
cb05223
Subaru: add Crosstrek 2022 FW versions (#27222)
N0VA-DKW Feb 9, 2023
a1e5ab1
Add C-HR 2021 to release notes
sshane Feb 9, 2023
95fc84e
cabana: catch exceptions thrown from opendbc (#27242)
deanlee Feb 9, 2023
8f5057f
GM: enforce steering command message timing (#27250)
sshane Feb 9, 2023
37f3fe5
Add several missing CHR_TSS2 firmwares (#27278)
ErichMoraga Feb 10, 2023
29ca52b
GM: split steering speeds (#27277)
sshane Feb 10, 2023
5ee4740
Toyota: C-HR Hybrid 2022 support (#27269)
Korben00 Feb 10, 2023
7978901
controlsd: revert CAN timeout threshold (#27275)
adeebshihadeh Feb 10, 2023
5ab2d35
controlsd: higher default set speed in experimental mode (#27279)
adeebshihadeh Feb 10, 2023
1f85f84
UI: fix old frame shown on startup (#27283)
adeebshihadeh Feb 10, 2023
429311a
cabana: fix the text of signal value being clipped (#27292)
deanlee Feb 10, 2023
237428d
cabana: dont reset filter after seek (#27290)
deanlee Feb 10, 2023
409c1c9
cabana: set pen width in createSeries (#27288)
deanlee Feb 10, 2023
d19b668
cabana: fix incorrect bit color after seek (#27287)
deanlee Feb 10, 2023
fae5553
cabana: add <array> include to fix macos build (#27291)
pd0wm Feb 10, 2023
7cfa236
cabana: improve SignalItemDelegate::paint (#27295)
deanlee Feb 10, 2023
152f1bf
cabana: fix inconsistent size for play button (#27298)
deanlee Feb 10, 2023
3d2c156
cabana: fix y axis precision (#27299)
deanlee Feb 10, 2023
0fdcf4e
cabana: fix text-overflow for long msg name (#27297)
deanlee Feb 10, 2023
5831a83
GM: add hysteresis to cluster speed (#27301)
sshane Feb 11, 2023
c05aa0e
Chrysler: log temporary LKAS faults (#27303)
sshane Feb 11, 2023
9333030
add new model to release notes
YassineYousfi Feb 11, 2023
b1f84f9
Chrysler: setup panda safety flag for old tuning's steer limits
adeebshihadeh Feb 11, 2023
69e52f0
bump panda
adeebshihadeh Feb 11, 2023
4f21344
events: reword ESP off alert (#27304)
sshane Feb 11, 2023
ed52916
update chrysler test segment with new flag
adeebshihadeh Feb 11, 2023
7b65433
HKG: remove Kia Stinger 2018 from legacy safety mode (#27302)
pangmili Feb 11, 2023
6474e16
GM: add permanent ACC fault signal (#27306)
sshane Feb 11, 2023
4998b60
more release notes
adeebshihadeh Feb 12, 2023
341eb2e
boardd: retry on bad SPI RX data len (#27314)
adeebshihadeh Feb 12, 2023
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
15 changes: 11 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Version 0.9.1 (2022-12-XX)
Version 0.9.1 (2023-2-23)
========================
* Adjust alert volume using ambient noise level
* Removed driver monitoring timer resetting on interaction if face detected and distracted
* New German translation thanks to Vrabetz and CzokNorris!
* New driving model
* 30% improved height estimation resulting in better driving performance for tall cars
* Driver monitoring: removed timer resetting on user interaction if distracted
* UI updates
* Adjust alert volume using ambient noise level
* Driver monitoring icon shows driver's head pose
* German translation thanks to Vrabetz and CzokNorris!
* Chevrolet Bolt EV 2022-23 support thanks to JasonJShuler!
* Genesis GV60 2023 support thanks to sunnyhaibin!
* Hyundai Tucson 2022-23 support
* Kia K5 Hybrid 2020 support thanks to sunnyhaibin!
* Kia Niro Hybrid 2023 support thanks to sunnyhaibin!
* Kia Sorento 2022-23 support thanks to sunnyhaibin!
* Kia Sorento Plug-in Hybrid 2022 support thanks to sunnyhaibin!
* Toyota C-HR 2021 support thanks to eFiniLan!
* Toyota C-HR Hybrid 2022 support thanks to Korben00!
* Volkswagen Crafter and MAN TGE 2017-23 support thanks to jyoung8607!

Version 0.9.0 (2022-11-21)
Expand Down
17 changes: 10 additions & 7 deletions docs/CARS.md

Large diffs are not rendered by default.

Binary file modified selfdrive/assets/img_driver_face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion selfdrive/boardd/spi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ int PandaSpiHandle::spi_transfer(uint8_t endpoint, uint8_t *tx_data, uint16_t tx
goto transfer_fail;
}
rx_data_len = *(uint16_t *)(rx_buf+1);
assert(rx_data_len < SPI_BUF_SIZE);
if (rx_data_len >= SPI_BUF_SIZE) {
LOGE("SPI: RX data len larger than buf size %d", rx_data_len);
goto transfer_fail;
}

// Read data
transfer.len = rx_data_len + 1;
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/body/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def deadband_filter(torque, deadband):
torque -= deadband
return torque

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):

torque_l = 0
torque_r = 0
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/body/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ def _update(self, c):

return ret

def apply(self, c):
return self.CC.update(c, self.CS)
def apply(self, c, now_nanos):
return self.CC.update(c, self.CS, now_nanos)
2 changes: 1 addition & 1 deletion selfdrive/car/chrysler/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, dbc_name, CP, VM):
self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP)

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):
can_sends = []

lkas_active = CC.latActive and self.lkas_control_bit_prev
Expand Down
4 changes: 3 additions & 1 deletion selfdrive/car/chrysler/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def update(self, cp, cp_cam):

if self.CP.carFingerprint in RAM_CARS:
self.auto_high_beam = cp_cam.vl["DAS_6"]['AUTO_HIGH_BEAM_ON'] # Auto High Beam isn't Located in this message on chrysler or jeep currently located in 729 message
ret.steerFaultTemporary = cp.vl["EPS_3"]["DASM_FAULT"] == 1
ret.steerFaultTemporary = cp.vl["EPS_3"]["DASM_FAULT"] == 1
else:
ret.steerFaultTemporary = cp.vl["EPS_2"]["LKAS_TEMPORARY_FAULT"] == 1
ret.steerFaultPermanent = cp.vl["EPS_2"]["LKAS_STATE"] == 4

# blindspot sensors
Expand Down Expand Up @@ -135,6 +136,7 @@ def get_can_parser(CP):
("COUNTER", "EPS_2",),
("COLUMN_TORQUE", "EPS_2"),
("EPS_TORQUE_MOTOR", "EPS_2"),
("LKAS_TEMPORARY_FAULT", "EPS_2"),
("LKAS_STATE", "EPS_2"),
("COUNTER", "CRUISE_BUTTONS"),
]
Expand Down
29 changes: 19 additions & 10 deletions selfdrive/car/chrysler/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from cereal import car
from panda import Panda
from selfdrive.car import STD_CARGO_KG, get_safety_config
from selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
from selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, CHRYSLER_OLD_TUNING_BLACKLIST, ChryslerFlags
from selfdrive.car.interfaces import CarInterfaceBase


Expand All @@ -23,7 +23,11 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
elif candidate in RAM_DT:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_CHRYSLER_RAM_DT

if candidate in CHRYSLER_OLD_TUNING_BLACKLIST:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_CHRYSLER_LOWER_RATE

ret.minSteerSpeed = 3.8 # m/s
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
if candidate not in RAM_CARS:
# Newer FW versions standard on the following platforms, or flashed by a dealer onto older platforms have a higher minimum steering speed.
new_eps_platform = candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019)
Expand All @@ -36,27 +40,32 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.mass = 2242. + STD_CARGO_KG
ret.wheelbase = 3.089
ret.steerRatio = 16.2 # Pacifica Hybrid 2017
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]]
ret.lateralTuning.pid.kf = 0.00006

if candidate in CHRYSLER_OLD_TUNING_BLACKLIST:
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]]
ret.lateralTuning.pid.kf = 0.00006

# Jeep
elif candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019):
ret.mass = 1778 + STD_CARGO_KG
ret.wheelbase = 2.71
ret.steerRatio = 16.7
ret.steerActuatorDelay = 0.2
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]]
ret.lateralTuning.pid.kf = 0.00006

if candidate in CHRYSLER_OLD_TUNING_BLACKLIST:
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.], [9., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]]
ret.lateralTuning.pid.kf = 0.00006

# Ram
elif candidate == CAR.RAM_1500:
ret.steerActuatorDelay = 0.2
ret.wheelbase = 3.88
ret.steerRatio = 16.3
ret.mass = 2493. + STD_CARGO_KG
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
ret.minSteerSpeed = 14.5
# Older EPS FW allow steer to zero
if any(fw.ecu == 'eps' and fw.fwVersion[:4] <= b"6831" for fw in car_fw):
Expand Down Expand Up @@ -100,5 +109,5 @@ def _update(self, c):

return ret

def apply(self, c):
return self.CC.update(c, self.CS)
def apply(self, c, now_nanos):
return self.CC.update(c, self.CS, now_nanos)
12 changes: 10 additions & 2 deletions selfdrive/car/chrysler/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ def __init__(self, CP):
self.STEER_DELTA_DOWN = 6
self.STEER_MAX = 261 # EPS allows more, up to 350?
else:
self.STEER_DELTA_UP = 3
self.STEER_DELTA_DOWN = 3
if CP.carFingerprint in CHRYSLER_OLD_TUNING_BLACKLIST:
self.STEER_DELTA_UP = 3
self.STEER_DELTA_DOWN = 3
else:
self.STEER_DELTA_UP = 6
self.STEER_DELTA_DOWN = 6
self.STEER_MAX = 261 # higher than this faults the EPS

STEER_THRESHOLD = 120
Expand All @@ -56,6 +60,10 @@ def __init__(self, CP):
RAM_HD = {CAR.RAM_HD, }
RAM_CARS = RAM_DT | RAM_HD

# the increased steer rate hasn't been verified on these cars.
# remove from this list once it's been tested and confirmed to not fault
CHRYSLER_OLD_TUNING_BLACKLIST = {CAR.PACIFICA_2017_HYBRID, CAR.PACIFICA_2018_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE}

@dataclass
class ChryslerCarInfo(CarInfo):
package: str = "Adaptive Cruise Control (ACC)"
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/ford/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, dbc_name, CP, VM):
self.lkas_enabled_last = False
self.steer_alert_last = False

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):
can_sends = []

actuators = CC.actuators
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/ford/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ def _update(self, c):

return ret

def apply(self, c):
return self.CC.update(c, self.CS)
def apply(self, c, now_nanos):
return self.CC.update(c, self.CS, now_nanos)
13 changes: 8 additions & 5 deletions selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s
CAMERA_CANCEL_DELAY_FRAMES = 10
# Enforce a minimum interval between steering messages to avoid a fault
MIN_STEER_MSG_INTERVAL_MS = 15


class CarController:
Expand All @@ -37,7 +39,7 @@ def __init__(self, dbc_name, CP, VM):
self.packer_obj = CANPacker(DBC[self.CP.carFingerprint]['radar'])
self.packer_ch = CANPacker(DBC[self.CP.carFingerprint]['chassis'])

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):
actuators = CC.actuators
hud_control = CC.hudControl
hud_alert = hud_control.visualAlert
Expand All @@ -56,17 +58,18 @@ def update(self, CC, CS):
# - on startup, first few msgs are blocked
# - until we're in sync with camera so counters align when relay closes, preventing a fault.
# openpilot can subtly drift, so this is activated throughout a drive to stay synced
out_of_sync = self.lka_steering_cmd_counter % 4 != (CS.camera_lka_steering_cmd_counter + 1) % 4
out_of_sync = self.lka_steering_cmd_counter % 4 != (CS.cam_lka_steering_cmd_counter + 1) % 4
if not self.sent_lka_steering_cmd or out_of_sync:
steer_step = self.params.STEER_STEP

if CS.loopback_lka_steering_cmd_updated:
self.lka_steering_cmd_counter += 1
self.sent_lka_steering_cmd = True

# Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we just
# received the ASCMLKASteeringCmd loopback confirmation in the current CS frame
if (self.frame - self.last_steer_frame) >= steer_step and not CS.loopback_lka_steering_cmd_updated:
# Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we
# received the ASCMLKASteeringCmd loopback confirmation too recently
last_lka_steer_msg_ms = (now_nanos - CS.loopback_lka_steering_cmd_ts_nanos) * 1e-6
if (self.frame - self.last_steer_frame) >= steer_step and last_lka_steer_msg_ms > MIN_STEER_MSG_INTERVAL_MS:
# Initialize ASCMLKASteeringCmd counter using the camera until we get a msg on the bus
if not self.sent_lka_steering_cmd:
self.lka_steering_cmd_counter = CS.pt_lka_steering_cmd_counter + 1
Expand Down
14 changes: 11 additions & 3 deletions selfdrive/car/gm/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ def __init__(self, CP):
super().__init__(CP)
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"]
self.cluster_speed_hyst_gap = CV.KPH_TO_MS / 2.
self.cluster_min_speed = CV.KPH_TO_MS / 2.

self.loopback_lka_steering_cmd_updated = False
self.loopback_lka_steering_cmd_ts_nanos = 0
self.pt_lka_steering_cmd_counter = 0
self.camera_lka_steering_cmd_counter = 0
self.cam_lka_steering_cmd_counter = 0
self.buttons_counter = 0

def update(self, pt_cp, cam_cp, loopback_cp):
Expand All @@ -33,9 +37,10 @@ def update(self, pt_cp, cam_cp, loopback_cp):

# Variables used for avoiding LKAS faults
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
self.loopback_lka_steering_cmd_ts_nanos = loopback_cp.ts_nanos["ASCMLKASteeringCmd"]["RollingCounter"]
if self.CP.networkLocation == NetworkLocation.fwdCamera:
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
self.camera_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
self.cam_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]

ret.wheelSpeeds = self.get_wheel_speeds(
pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"],
Expand Down Expand Up @@ -95,7 +100,8 @@ def update(self, pt_cp, cam_cp, loopback_cp):
ret.parkingBrake = pt_cp.vl["VehicleIgnitionAlt"]["ParkBrake"] == 1
ret.cruiseState.available = pt_cp.vl["ECMEngineStatus"]["CruiseMainOn"] != 0
ret.espDisabled = pt_cp.vl["ESPStatus"]["TractionControlOn"] != 1
ret.accFaulted = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.FAULTED
ret.accFaulted = (pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.FAULTED or
pt_cp.vl["EBCMFrictionBrakeStatus"]["FrictionBrakeUnavailable"] == 1)

ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF
ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL
Expand Down Expand Up @@ -150,6 +156,7 @@ def get_can_parser(CP):
("RLWheelSpd", "EBCMWheelSpdRear"),
("RRWheelSpd", "EBCMWheelSpdRear"),
("MovingBackward", "EBCMWheelSpdRear"),
("FrictionBrakeUnavailable", "EBCMFrictionBrakeStatus"),
("PRNDL2", "ECMPRDNL2"),
("ManualMode", "ECMPRDNL2"),
("LKADriverAppldTrq", "PSCMStatus"),
Expand All @@ -175,6 +182,7 @@ def get_can_parser(CP):
("VehicleIgnitionAlt", 10),
("EBCMWheelSpdFront", 20),
("EBCMWheelSpdRear", 20),
("EBCMFrictionBrakeStatus", 20),
("AcceleratorPedal2", 33),
("ASCMSteeringButton", 33),
("ECMEngineStatus", 100),
Expand Down
8 changes: 4 additions & 4 deletions selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.pcmCruise = True
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM
ret.minEnableSpeed = 5 * CV.KPH_TO_MS
ret.minSteerSpeed = 10 * CV.KPH_TO_MS

# Tuning for experimental long
ret.longitudinalTuning.kpV = [2.0, 1.5]
Expand All @@ -89,6 +90,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.pcmCruise = False # stock non-adaptive cruise control is kept off
# supports stop and go, but initial engage must (conservatively) be above 18mph
ret.minEnableSpeed = 18 * CV.MPH_TO_MS
ret.minSteerSpeed = 7 * CV.MPH_TO_MS

# Tuning
ret.longitudinalTuning.kpV = [2.4, 1.5]
Expand All @@ -100,8 +102,6 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
ret.dashcamOnly = candidate in {CAR.CADILLAC_ATS, CAR.HOLDEN_ASTRA, CAR.MALIBU, CAR.BUICK_REGAL, CAR.EQUINOX}

# Start with a baseline tuning for all GM vehicles. Override tuning as needed in each model section below.
# Some GMs need some tolerance above 10 kph to avoid a fault
ret.minSteerSpeed = 10.1 * CV.KPH_TO_MS
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.00]]
ret.lateralTuning.pid.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594
Expand Down Expand Up @@ -236,5 +236,5 @@ def _update(self, c):

return ret

def apply(self, c):
return self.CC.update(c, self.CS)
def apply(self, c, now_nanos):
return self.CC.update(c, self.CS, now_nanos)
2 changes: 1 addition & 1 deletion selfdrive/car/honda/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, dbc_name, CP, VM):
self.brake = 0.0
self.last_steer = 0.0

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):
actuators = CC.actuators
hud_control = CC.hudControl
hud_v_cruise = hud_control.setSpeed * CV.MS_TO_KPH if hud_control.speedVisible else 255
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,5 @@ def _update(self, c):

# pass in a car.CarControl
# to be called @ 100hz
def apply(self, c):
return self.CC.update(c, self.CS)
def apply(self, c, now_nanos):
return self.CC.update(c, self.CS, now_nanos)
2 changes: 1 addition & 1 deletion selfdrive/car/hyundai/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, dbc_name, CP, VM):
self.car_fingerprint = CP.carFingerprint
self.last_button_frame = 0

def update(self, CC, CS):
def update(self, CC, CS, now_nanos):
actuators = CC.actuators
hud_control = CC.hudControl

Expand Down
12 changes: 8 additions & 4 deletions selfdrive/car/hyundai/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from common.conversions import Conversions as CV
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.hyundai.hyundaicanfd import get_e_can_bus
from selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, FEATURES, CAMERA_SCC_CAR, CANFD_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams
from selfdrive.car.interfaces import CarStateBase

Expand All @@ -21,7 +22,9 @@ def __init__(self, CP):
self.cruise_buttons = deque([Buttons.NONE] * PREV_BUTTON_SAMPLES, maxlen=PREV_BUTTON_SAMPLES)
self.main_buttons = deque([Buttons.NONE] * PREV_BUTTON_SAMPLES, maxlen=PREV_BUTTON_SAMPLES)

self.gear_msg_canfd = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else "GEAR_SHIFTER"
self.gear_msg_canfd = "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \
"GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \
"GEAR_SHIFTER"
if CP.carFingerprint in CANFD_CAR:
self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"]
elif self.CP.carFingerprint in FEATURES["use_cluster_gears"]:
Expand Down Expand Up @@ -425,7 +428,9 @@ def get_cam_can_parser(CP):
def get_can_parser_canfd(CP):

cruise_btn_msg = "CRUISE_BUTTONS_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS else "CRUISE_BUTTONS"
gear_msg = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else "GEAR_SHIFTER"
gear_msg = "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \
"GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \
"GEAR_SHIFTER"
signals = [
("WHEEL_SPEED_1", "WHEEL_SPEEDS"),
("WHEEL_SPEED_2", "WHEEL_SPEEDS"),
Expand Down Expand Up @@ -511,8 +516,7 @@ def get_can_parser_canfd(CP):
("ACCELERATOR_BRAKE_ALT", 100),
]

bus = 5 if CP.flags & HyundaiFlags.CANFD_HDA2 else 4
return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus)
return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, get_e_can_bus(CP))

@staticmethod
def get_cam_can_parser_canfd(CP):
Expand Down
Loading