Skip to content

Commit

Permalink
Merge pull request commaai#162 from xx979xx/HKG_6.4
Browse files Browse the repository at this point in the history
LDWS improve
  • Loading branch information
xx979xx authored Oct 4, 2019
2 parents 779add5 + 6623d3a commit ca9ee2f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions selfdrive/car/hyundai/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class SteerLimitParams:

VisualAlert = car.CarControl.HUDControl.VisualAlert

def process_hud_alert(visual_alert, car_fingerprint):
def process_hud_alert(enabled, fingerprint, visual_alert, left_line,
right_line, left_lane_depart, right_lane_depart):
if visual_alert == VisualAlert.steerRequired:
return 5 if car_fingerprint in [CAR.SANTA_FE, CAR.SANTA_FE_1] else 4
hud_alert 5 if fingerprint in [CAR.SANTA_FE, CAR.SANTA_FE_1] else 4
else:
return 0
hud_alert 0

def process_lane_visible(enabled, left_line, right_line, hud_alert):
# initialize to no line visible
lane_visible = 1
if left_line and right_line or hud_alert:
Expand All @@ -38,7 +38,15 @@ def process_lane_visible(enabled, left_line, right_line, hud_alert):
elif right_line:
lane_visible = 6

return lane_visible
# initialize to no warnings
left_lane_warning = 0
right_lane_warning = 0
if left_lane_depart:
left_lane_warning = 1 if fingerprint in [CAR.GENESIS , CAR.GENESIS_G90, CAR.GENESIS_G80] else 2
if right_lane_depart:
right_lane_warning = 1 if fingerprint in [CAR.GENESIS , CAR.GENESIS_G90, CAR.GENESIS_G80] else 2

return hud_alert, lane_visible, left_lane_warning, right_lane_warning

class CarController(object):
def __init__(self, dbc_name, car_fingerprint):
Expand Down Expand Up @@ -69,8 +77,9 @@ def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, visual_alert,

self.apply_steer_last = apply_steer

hud_alert = process_hud_alert(visual_alert, self.car_fingerprint)
lane_visible = process_lane_visible(enabled, left_line, right_line, hud_alert)
hud_alert, lane_visible, left_lane_warning, right_lane_warning =\
process_hud_alert(enabled, self.car_fingerprint, visual_alert,
left_line, right_line,left_lane_depart, right_lane_depart)

can_sends = []

Expand Down

0 comments on commit ca9ee2f

Please sign in to comment.