* HYUNDAI_GENESIS added Cruise button event and lkMode feature. (Thanks to @donfyffe)

This commit is contained in:
Rick Lan
2020-11-05 16:17:54 +10:00
parent 3cb8df8c49
commit 2665d308ca
7 changed files with 23 additions and 9 deletions
+2
View File
@@ -2,6 +2,8 @@ dragonpilot 0.7.10.1
========================
* HYUNDAI_GENESIS 使用 INDI 控制器。(感謝 @donfyffe 提供)
* HYUNDAI_GENESIS uses INDI controller. (Thanks to @donfyffe)
* HYUNDAI_GENESIS 加入 Cruise 按紐 和 lkMode 支援。(感謝 @donfyffe 建議)
* HYUNDAI_GENESIS added Cruise button event and lkMode feature. (Thanks to @donfyffe)
dragonpilot 0.7.10.0
========================
+2
View File
@@ -19,6 +19,8 @@ dragonpilot 0.7.10.0
* Fixed auto shutdown issue when EON connect to PC/USB Charger. (Thanks to @LOVEChen)
* HYUNDAI_GENESIS 使用 INDI 控制器。(感謝 @donfyffe 提供)
* HYUNDAI_GENESIS uses INDI controller. (Thanks to @donfyffe)
* HYUNDAI_GENESIS 加入 Cruise 按紐 和 lkMode 支援。(感謝 @donfyffe 建議)
* HYUNDAI_GENESIS added Cruise button event and lkMode feature. (Thanks to @donfyffe)
dragonpilot 0.7.8
========================
+5
View File
@@ -1,3 +1,8 @@
2020-11-05 (0.7.10.0)
========================
* HYUNDAI_GENESIS 加入 Cruise 按紐 和 lkMode 支援。(感謝 @donfyffe 建議)
* HYUNDAI_GENESIS added Cruise button event and lkMode feature. (Thanks to @donfyffe)
2020-11-04 (0.7.10.0)
========================
* HYUNDAI_GENESIS 使用 INDI 控制器。(感謝 @donfyffe 提供)
+2 -6
View File
@@ -234,12 +234,8 @@ class CarState(CarStateBase):
ret.steeringRate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE']
# dp - when user presses LKAS button on steering wheel
if self.cruise_setting == 1:
if cp.vl["SCM_BUTTONS"]["CRUISE_SETTING"] == 0:
if self.lkMode:
self.lkMode = False
else:
self.lkMode = True
if self.cruise_setting == 1 and cp.vl["SCM_BUTTONS"]["CRUISE_SETTING"] == 0:
self.lkMode = not self.lkMode
self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING']
self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS']
+1 -1
View File
@@ -58,7 +58,7 @@ class CarController():
self.steer_rate_limited = new_steer != apply_steer
# disable if steer angle reach 90 deg, otherwise mdps fault in some models
lkas_active = enabled and abs(CS.out.steeringAngle) < 90.
lkas_active = enabled and abs(CS.out.steeringAngle) < 90. and CS.lkMode
# fix for Genesis hard fault at low speed
if CS.out.vEgo < 16.7 and self.car_fingerprint == CAR.HYUNDAI_GENESIS:
+8 -2
View File
@@ -1,6 +1,6 @@
import copy
from cereal import car
from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD, FEATURES, EV_HYBRID
from selfdrive.car.hyundai.values import CAR, DBC, STEER_THRESHOLD, FEATURES, EV_HYBRID
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
@@ -9,6 +9,11 @@ GearShifter = car.CarState.GearShifter
class CarState(CarStateBase):
def __init__(self, CP):
super().__init__(CP)
#dp
self.lkMode = True
def update(self, cp, cp_cam):
ret = car.CarState.new_message()
@@ -37,7 +42,7 @@ class CarState(CarStateBase):
ret.steerWarning = cp.vl["MDPS12"]['CF_Mdps_ToiUnavail'] != 0
# cruise state
ret.cruiseState.available = True
ret.cruiseState.available = cp.vl["SCC11"]["MainMode_ACC"] != 0 if self.CP.carFingerprint in [CAR.HYUNDAI_GENESIS] else True
ret.cruiseState.enabled = cp.vl["SCC12"]['ACCMode'] != 0
ret.cruiseState.standstill = cp.vl["SCC11"]['SCCInfoDisplay'] == 4.
@@ -131,6 +136,7 @@ class CarState(CarStateBase):
self.steer_state = cp.vl["MDPS12"]['CF_Mdps_ToiActive'] # 0 NOT ACTIVE, 1 ACTIVE
self.lead_distance = cp.vl["SCC11"]['ACC_ObjDist']
self.lkMode = bool(cp_cam.vl["LKAS11"]["CF_Lkas_LdwsSysState"])
return ret
@staticmethod
+3
View File
@@ -200,10 +200,13 @@ class CarInterface(CarInterfaceBase):
self.dragonconf = dragonconf
ret.cruiseState.enabled = common_interface_atl(ret, dragonconf.dpAtl)
ret.canValid = self.cp.can_valid and self.cp_cam.can_valid
ret.lkMode = self.CS.lkMode
events = self.create_common_events(ret)
#TODO: addd abs(self.CS.angle_steers) > 90 to 'steerTempUnavailable' event
if not self.CS.lkMode:
events.add(car.CarEvent.EventName.manualSteeringRequired)
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)
if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
self.low_speed_alert = True