Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Apr 8, 2022
1 parent 3a00d84 commit 551ca7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions selfdrive/car/hyundai/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
from common.conversions import Conversions as CV
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD, FEATURES, EV_CAR, HYBRID_CAR, PREV_BUTTON_FRAMES, Buttons
from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD, FEATURES, EV_CAR, HYBRID_CAR, Buttons
from selfdrive.car.interfaces import CarStateBase

PREV_BUTTON_FRAMES = 3


class CarState(CarStateBase):
def __init__(self, CP):
super().__init__(CP)
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
# cruise_buttons includes current button and two previous
# includes current button and two previous
self.cruise_buttons = deque([Buttons.NONE] * PREV_BUTTON_FRAMES, maxlen=PREV_BUTTON_FRAMES)
self.main_buttons = deque([Buttons.NONE] * PREV_BUTTON_FRAMES, maxlen=PREV_BUTTON_FRAMES)

if self.CP.carFingerprint in FEATURES["use_cluster_gears"]:
self.shifter_values = can_define.dv["CLU15"]["CF_Clu_Gear"]
Expand Down Expand Up @@ -111,7 +114,9 @@ def update(self, cp, cp_cam):
self.clu11 = copy.copy(cp.vl["CLU11"])
self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE
self.brake_error = cp.vl["TCS13"]["ACCEnable"] != 0 # 0 ACC CONTROL ENABLED, 1-3 ACC CONTROL DISABLED
self.cruise_buttons.append(cp.vl["CLU11"]["CF_Clu_CruiseSwState"])
if len(cp.vl_all["CLU11"]["CF_Clu_CruiseSwState"]):
self.cruise_buttons.append(cp.vl["CLU11"]["CF_Clu_CruiseSwState"])
self.main_buttons.append(cp.vl["CLU11"]["CF_Clu_CruiseSwMain"])

return ret

Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,4 +1174,3 @@ class Buttons:
}

STEER_THRESHOLD = 150
PREV_BUTTON_FRAMES = 3

0 comments on commit 551ca7b

Please sign in to comment.