wip
This commit is contained in:
@@ -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.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR
|
||||||
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
from openpilot.selfdrive.car.interfaces import CarControllerBase
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||||
LongCtrlState = car.CarControl.Actuators.LongControlState
|
LongCtrlState = car.CarControl.Actuators.LongControlState
|
||||||
|
|
||||||
@@ -120,10 +122,12 @@ class CarController(CarControllerBase):
|
|||||||
self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING))
|
self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING))
|
||||||
|
|
||||||
# LFA and HDA icons
|
# 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
|
# 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, 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
|
# blinkers
|
||||||
if hda2 and self.CP.flags & HyundaiFlags.ENABLE_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):
|
def create_button_messages(self, CC: car.CarControl, CS: car.CarState, use_clu11: bool):
|
||||||
can_sends = []
|
can_sends = []
|
||||||
|
|
||||||
|
sys.stderr.write(str({'use_clu11': use_clu11}) + '\n')
|
||||||
|
|
||||||
if use_clu11:
|
if use_clu11:
|
||||||
if CC.cruiseControl.cancel:
|
if CC.cruiseControl.cancel:
|
||||||
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP))
|
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP))
|
||||||
|
|||||||
@@ -290,8 +290,13 @@ class CarState(CarStateBase):
|
|||||||
nothing = 0
|
nothing = 0
|
||||||
|
|
||||||
# print('Hello World', file=sys.stderr)
|
# 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
|
self.lkas_enabled = lkas_enabled
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
|
|||||||
|
|
||||||
values = {
|
values = {
|
||||||
"LKA_MODE": 2, # CP: Whats this?
|
"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,
|
"TORQUE_REQUEST": apply_steer,
|
||||||
"LKA_ASSIST": 0,
|
"LKA_ASSIST": 0,
|
||||||
"STEER_REQ": 1 if lat_active else 0,
|
"STEER_REQ": 1 if lat_active else 0,
|
||||||
|
|||||||
@@ -899,9 +899,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
|||||||
// if (bg != bg_colors[STATUS_DISENGAGED]) {
|
// if (bg != bg_colors[STATUS_DISENGAGED]) {
|
||||||
// Use current background color
|
// Use current background color
|
||||||
QLinearGradient edge_gradient;
|
QLinearGradient edge_gradient;
|
||||||
edge_gradient.setColorAt(0.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255)));
|
QColor test_color = QColor(201, 41, 204, 0xd1);
|
||||||
edge_gradient.setColorAt(0.5, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255 * 0.5)));
|
edge_gradient.setColorAt(0.0, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255)));
|
||||||
edge_gradient.setColorAt(1.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255 * 0.1)));
|
edge_gradient.setColorAt(0.5, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255 * 0.5)));
|
||||||
|
edge_gradient.setColorAt(1.0, QColor(test_color.red(), test_color.green(), test_color.blue(), static_cast<int>(OTHER_LANE_ALPHA * 255 * 0.1)));
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addPolygon(scene.track_vertices);
|
path.addPolygon(scene.track_vertices);
|
||||||
|
|||||||
Reference in New Issue
Block a user