Revert to using CLU15 message for Gear Selection for Compatability Reasons (#362)

* hyundai WIP

* steer_driver_factor is 1

* removed unnecessary file

* removed unnecessary code

* Update carcontroller.py

bug fix

* safety tuning and fixed interface stiffness

* better lateral tuning, some fixes

* Fix set speed

* added camera state reading, autoresume from stop, cancel on accel, hud alerts

* WIP

* Updated for Kia Sorento *WIP*

* Cleanup

* clean2

* Bug Fixes

* pre-merge

* Add all the cars!

* Panda to auto-detect Camera Bus

* Move Checksum Check

* Final Sorento Tuning

* Make CAN3 for Cam default

* Update README.md

* update panda, minor aesthetic updates

* few other minor changes

* added steer not allowed alert

* bup panda version to force panda update

* fixed camera alerts

* Revert to using CLU15 for Gear Selection

* Missing Defines

Didn’t realise this was removed as well!

* Change Gear Selection Definitions

Add logic to use transmission message rather than cluster message for all gear selections UNLESS the car in question does not have the known good transmission messages

* Revert Camera CAN Bus

* self.candidate

* fixed fingerpint, tested on Sorento

* Update for Elantra on Hyundai-Dev Branch

Latest Elantra values that correlate to progress Community branch.
pull/394/merge
Andrew Frahn 7 years ago committed by rbiasini
parent c499aa549c
commit 5641fc986d
  1. 19
      selfdrive/car/hyundai/carstate.py
  2. 12
      selfdrive/car/hyundai/interface.py

@ -44,6 +44,11 @@ def get_can_parser(CP):
("CF_Clu_AmpInfo", "CLU11", 0), ("CF_Clu_AmpInfo", "CLU11", 0),
("CF_Clu_AliveCnt1", "CLU11", 0), ("CF_Clu_AliveCnt1", "CLU11", 0),
("CF_Clu_InhibitD", "CLU15", 0),
("CF_Clu_InhibitP", "CLU15", 0),
("CF_Clu_InhibitN", "CLU15", 0),
("CF_Clu_InhibitR", "CLU15", 0),
("CF_Lvr_Gear","LVR12",0), ("CF_Lvr_Gear","LVR12",0),
("ACCEnable", "TCS13", 0), ("ACCEnable", "TCS13", 0),
@ -204,7 +209,7 @@ class CarState(object):
self.pedal_gas = cp.vl["EMS12"]['TPS'] self.pedal_gas = cp.vl["EMS12"]['TPS']
self.car_gas = cp.vl["EMS12"]['TPS'] self.car_gas = cp.vl["EMS12"]['TPS']
# Gear Selecton - This should be compatible with all Kia/Hyundai with Auto's # Gear Selecton - This is not compatible with all Kia/Hyundai's, But is the best way for those it is compatible with
gear = cp.vl["LVR12"]["CF_Lvr_Gear"] gear = cp.vl["LVR12"]["CF_Lvr_Gear"]
if gear == 5: if gear == 5:
self.gear_shifter = "drive" self.gear_shifter = "drive"
@ -217,6 +222,18 @@ class CarState(object):
else: else:
self.gear_shifter = "unknown" self.gear_shifter = "unknown"
# Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, as this seems to be standard over all cars, but is not the preferred method.
if cp.vl["CLU15"]["CF_Clu_InhibitD"] == 1:
self.gear_shifter_cluster = "drive"
elif cp.vl["CLU15"]["CF_Clu_InhibitN"] == 1:
self.gear_shifter_cluster = "neutral"
elif cp.vl["CLU15"]["CF_Clu_InhibitP"] == 1:
self.gear_shifter_cluster = "park"
elif cp.vl["CLU15"]["CF_Clu_InhibitR"] == 1:
self.gear_shifter_cluster = "reverse"
else:
self.gear_shifter_cluster = "unknown"
# save the entire LKAS11 and CLU11 # save the entire LKAS11 and CLU11
self.lkas11 = cp_cam.vl["LKAS11"] self.lkas11 = cp_cam.vl["LKAS11"]
self.clu11 = cp.vl["CLU11"] self.clu11 = cp.vl["CLU11"]

@ -95,14 +95,15 @@ class CarInterface(object):
ret.steerKpV, ret.steerKiV = [[0.25], [0.05]] ret.steerKpV, ret.steerKiV = [[0.25], [0.05]]
ret.minSteerSpeed = 0. ret.minSteerSpeed = 0.
elif candidate == CAR.ELANTRA: elif candidate == CAR.ELANTRA:
ret.steerKf = 0.00004 ret.steerKf = 0.00006
ret.steerRateCost = 0.5 ret.steerRateCost = 0.5
ret.mass = 1275 + std_cargo ret.mass = 1275 + std_cargo
ret.wheelbase = 2.7 ret.wheelbase = 2.7
ret.steerRatio = 16.9 ret.steerRatio = 13.73 #Spec
tire_stiffness_factor = 0.385
ret.steerKiBP, ret.steerKpBP = [[0.], [0.]] ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
ret.steerKpV, ret.steerKiV = [[0.20], [0.01]] ret.steerKpV, ret.steerKiV = [[0.25], [0.05]]
ret.minSteerSpeed = 35 * CV.MPH_TO_MS ret.minSteerSpeed = 32 * CV.MPH_TO_MS
elif candidate == CAR.GENESIS: elif candidate == CAR.GENESIS:
ret.steerKf = 0.00005 ret.steerKf = 0.00005
ret.steerRateCost = 0.5 ret.steerRateCost = 0.5
@ -190,6 +191,9 @@ class CarInterface(object):
ret.wheelSpeeds.rr = self.CS.v_wheel_rr ret.wheelSpeeds.rr = self.CS.v_wheel_rr
# gear shifter # gear shifter
if self.CP.carFingerprint == CAR.ELANTRA:
ret.gearShifter = self.CS.gear_shifter_cluster
else:
ret.gearShifter = self.CS.gear_shifter ret.gearShifter = self.CS.gear_shifter
# gas pedal # gas pedal

Loading…
Cancel
Save