Skip to content

Commit 594a1a8

Browse files
committed
Model lanelines on LCD cluster
1 parent 7e9facb commit 594a1a8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

selfdrive/controls/controlsd.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from openpilot.common.realtime import DT_CTRL
1313
from opendbc.car.car_helpers import interfaces
14+
from opendbc.car.hyundai.values import CAR
1415
from opendbc.car.vehicle_model import VehicleModel
1516
from openpilot.selfdrive.controls.lib.drive_helpers import clip_curvature
1617
from openpilot.selfdrive.controls.lib.latcontrol import LatControl
@@ -150,6 +151,7 @@ def state_control(self):
150151

151152
def publish(self, CC, lac_log):
152153
CS = self.sm['carState']
154+
model_v2 = self.sm['modelV2']
153155

154156
# Orientation and angle rates can be useful for carcontroller
155157
# Only calibrated (car) frame is relevant for the carcontroller
@@ -169,9 +171,16 @@ def publish(self, CC, lac_log):
169171
hudControl.leadVisible = self.sm['longitudinalPlan'].hasLead
170172
hudControl.leadDistanceBars = self.sm['selfdriveState'].personality.raw + 1
171173
hudControl.visualAlert = self.sm['selfdriveState'].alertHudVisual
172-
173-
hudControl.rightLaneVisible = True
174-
hudControl.leftLaneVisible = True
174+
if len(model_v2.laneLineProbs) and self.CP.carFingerprint == CAR.KIA_CARNIVAL_4TH_GEN:
175+
hudControl.rightLaneProb = model_v2.laneLineProbs[2]
176+
hudControl.rightLaneVisible = model_v2.laneLineProbs[2] > 0.5
177+
hudControl.leftLaneProb = model_v2.laneLineProbs[1]
178+
hudControl.leftLaneVisible = model_v2.laneLineProbs[1] > 0.5
179+
else:
180+
hudControl.rightLaneProb = 1.0
181+
hudControl.rightLaneVisible = True
182+
hudControl.leftLaneProb = 1.0
183+
hudControl.leftLaneVisible = True
175184
if self.sm.valid['driverAssistance']:
176185
hudControl.leftLaneDepart = self.sm['driverAssistance'].leftLaneDeparture
177186
hudControl.rightLaneDepart = self.sm['driverAssistance'].rightLaneDeparture

0 commit comments

Comments
 (0)