diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 12d736e..e082589 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -9,6 +9,8 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR from openpilot.selfdrive.car.interfaces import CarControllerBase +import sys + VisualAlert = car.CarControl.HUDControl.VisualAlert LongCtrlState = car.CarControl.Actuators.LongControlState @@ -120,10 +122,12 @@ class CarController(CarControllerBase): self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING)) # LFA and HDA icons - if self.frame % 5 == 0 and (not hda2 or hda2_long): + # if self.frame % 5 == 0 and (not hda2 or hda2_long): # CLEARPILOT TEST self.CS.lkas_enabled + # can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled, CC.latActive)) - can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CS.lkas_enabled, CS.lkas_enabled)) + + # can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CS.lkas_enabled, CS.lkas_enabled)) # blinkers if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: @@ -178,6 +182,9 @@ class CarController(CarControllerBase): def create_button_messages(self, CC: car.CarControl, CS: car.CarState, use_clu11: bool): can_sends = [] + + sys.stderr.write(str({'use_clu11': use_clu11}) + '\n') + if use_clu11: if CC.cruiseControl.cancel: can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 91788d5..f1332ac 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -290,8 +290,13 @@ class CarState(CarStateBase): nothing = 0 # print('Hello World', file=sys.stderr) - # print(json.dumps(self), file=sys.stderr) - sys.stderr.write(str({k: v for k, v in vars(self).items() if isinstance(v, (int, float, str, bool))}) + '\n') + # sys.stderr.write(str({k: v for k, v in vars(self).items() if isinstance(v, (int, float, str, bool))}) + '\n') + # notes: + # lkas_enabled = 1 = lkas button has been pressed + # prev_cruise_buttons = 0 (none), 1, 2 - up down + # new lane change works perfect + # need to auto disable lat on turn lower than 20 + turn signal as default + self.lkas_enabled = lkas_enabled diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index 760a497..ca43349 100644 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -41,7 +41,7 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer): values = { "LKA_MODE": 2, # CP: Whats this? - "LKA_ICON": 2 if enabled else 1 if lat_active else 0, # CP: Whats this? + "LKA_ICON": 2 if enabled else 1 if lat_active else 0, # right mode icon "TORQUE_REQUEST": apply_steer, "LKA_ASSIST": 0, "STEER_REQ": 1 if lat_active else 0, diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 7f14dd3..909889d 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -899,9 +899,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // if (bg != bg_colors[STATUS_DISENGAGED]) { // Use current background color QLinearGradient edge_gradient; - edge_gradient.setColorAt(0.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast(OTHER_LANE_ALPHA * 255))); - edge_gradient.setColorAt(0.5, QColor(bg.red(), bg.green(), bg.blue(), static_cast(OTHER_LANE_ALPHA * 255 * 0.5))); - edge_gradient.setColorAt(1.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast(OTHER_LANE_ALPHA * 255 * 0.1))); + QColor test_color = QColor(201, 41, 204, 0xd1); + edge_gradient.setColorAt(0.0, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast(OTHER_LANE_ALPHA * 255))); + edge_gradient.setColorAt(0.5, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast(OTHER_LANE_ALPHA * 255 * 0.5))); + edge_gradient.setColorAt(1.0, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast(OTHER_LANE_ALPHA * 255 * 0.1))); QPainterPath path; path.addPolygon(scene.track_vertices);