fix MPH & AEB(canfd) (#164)

This commit is contained in:
carrot 2025-05-10 16:48:19 +09:00 committed by GitHub
parent aad6826169
commit a40e8d686f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 19 additions and 16 deletions

View File

@ -3,6 +3,7 @@ import numpy as np
from opendbc.car import CanBusBase from opendbc.car import CanBusBase
from opendbc.car.hyundai.values import HyundaiFlags, HyundaiExtFlags from opendbc.car.hyundai.values import HyundaiFlags, HyundaiExtFlags
from openpilot.common.params import Params from openpilot.common.params import Params
from opendbc.car.common.conversions import Conversions as CV
def hyundai_crc8(data: bytes) -> int: def hyundai_crc8(data: bytes) -> int:
poly = 0x2F poly = 0x2F
@ -416,10 +417,10 @@ def create_ccnc_messages(CP, packer, CAN, frame, CC, CS, hud_control, disp_angle
if frame % 2 == 0: if frame % 2 == 0:
if CS.adrv_info_160 is not None: if CS.adrv_info_160 is not None:
values = CS.adrv_info_160 values = CS.adrv_info_160
values["NEW_SIGNAL_1"] = 0 # steer_temp관련없음, 계기판에러 #values["NEW_SIGNAL_1"] = 0 # steer_temp관련없음, 계기판에러
values["SET_ME_9"] = 17 # steer_temp관련없음, 계기판에러 #values["SET_ME_9"] = 17 # steer_temp관련없음, 계기판에러
values["SET_ME_2"] = 0 #커멘트해도 steer_temp에러남, 2값은 콤마에서 찾은거니... #values["SET_ME_2"] = 0 #커멘트해도 steer_temp에러남, 2값은 콤마에서 찾은거니...
values["DATA102"] = 0 # steer_temp관련없음 #values["DATA102"] = 0 # steer_temp관련없음
ret.append(packer.make_can_msg("ADRV_0x160", CAN.ECAN, values)) ret.append(packer.make_can_msg("ADRV_0x160", CAN.ECAN, values))
if CS.cruise_buttons_msg is not None: if CS.cruise_buttons_msg is not None:
@ -453,7 +454,8 @@ def create_ccnc_messages(CP, packer, CAN, frame, CC, CS, hud_control, disp_angle
values["SETSPEED"] = 6 if hdp_active else 3 if main_enabled else 0 values["SETSPEED"] = 6 if hdp_active else 3 if main_enabled else 0
values["SETSPEED_HUD"] = 5 if hdp_active else 2 if cruise_enabled else 1 values["SETSPEED_HUD"] = 5 if hdp_active else 2 if cruise_enabled else 1
values["vSetDis"] = int(hud_control.setSpeed * 3.6 + 0.5) set_speed_in_units = hud_control.setSpeed * (CV.MS_TO_KPH if CS.is_metric else CV.MS_TO_MPH)
values["vSetDis"] = int(set_speed_in_units + 0.5)
values["DISTANCE"] = 4 if hdp_active else hud_control.leadDistanceBars values["DISTANCE"] = 4 if hdp_active else hud_control.leadDistanceBars
values["DISTANCE_LEAD"] = 2 if cruise_enabled and hud_control.leadVisible else 0 values["DISTANCE_LEAD"] = 2 if cruise_enabled and hud_control.leadVisible else 0

View File

@ -249,13 +249,14 @@ BO_ 373 TCS: 24 XXX
BO_ 352 ADRV_0x160: 16 ADRV BO_ 352 ADRV_0x160: 16 ADRV
SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX
SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX
SG_ AEB_SETTING : 24|2@1+ (1,0) [0|3] "" XXX SG_ AEB_SETTING : 24|2@1+ (1,0) [0|255] "" XXX
SG_ NEW_SIGNAL_1 : 28|3@0+ (1,0) [0|7] "" XXX SG_ NEW_SIGNAL_1 : 30|1@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_2 : 56|8@1+ (1,0) [0|7] "" XXX SG_ NEW_SIGNAL_2 : 48|1@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_2 : 56|8@1+ (1,0) [0|1] "" XXX
SG_ SET_ME_FF : 64|8@1+ (1,0) [0|255] "" XXX SG_ SET_ME_FF : 64|8@1+ (1,0) [0|255] "" XXX
SG_ SET_ME_FC : 72|8@1+ (1,0) [0|255] "" XXX SG_ SET_ME_FC : 72|8@1+ (1,0) [0|255] "" XXX
SG_ SET_ME_9 : 80|8@1+ (1,0) [0|255] "" XXX SG_ SET_ME_9 : 80|8@1+ (1,0) [0|255] "" XXX
SG_ DATA102 : 102|1@1+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_3 : 95|8@0+ (1,0) [0|255] "" XXX
BO_ 353 ADRV_0x161: 32 ADRV BO_ 353 ADRV_0x161: 32 ADRV
SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX

View File

@ -459,14 +459,14 @@
{ {
"group": "주행튜닝", "group": "주행튜닝",
"name": "RadarReactionFactor", "name": "RadarReactionFactor",
"title": "Radar reaction factor (10)%", "title": "Radar reaction factor (100)%",
"descr": "값이 낮아지면 선행차량에 대한 반응이 빨라짐.", "descr": "값이 낮아지면 선행차량에 대한 반응이 빨라짐.",
"egroup": "LONG", "egroup": "LONG",
"etitle": "Radar reaction factor (10)%", "etitle": "Radar reaction factor (100)%",
"edescr": "", "edescr": "",
"min": 0, "min": 0,
"max": 200, "max": 200,
"default": 0, "default": 100,
"unit": 1 "unit": 1
}, },
{ {

View File

@ -2178,13 +2178,13 @@ public:
int apply_y = by - 50; int apply_y = by - 50;
if (apply_source.length()) { if (apply_source.length()) {
sprintf(apply_speed_str, "%.0f", apply_speed); sprintf(apply_speed_str, "%.0f", (s->scene.is_metric)?apply_speed:apply_speed * KM_TO_MILE);
textColor = COLOR_OCHRE; // apply speed가 작동되면... 색을 바꾸자. textColor = COLOR_OCHRE; // apply speed가 작동되면... 색을 바꾸자.
ui_draw_text(s, apply_x, apply_y, apply_speed_str, 50, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK); ui_draw_text(s, apply_x, apply_y, apply_speed_str, 50, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK);
ui_draw_text(s, apply_x, apply_y - 50, apply_source.toStdString().c_str(), 30, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK); ui_draw_text(s, apply_x, apply_y - 50, apply_source.toStdString().c_str(), 30, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK);
} }
else if(abs(cruiseTarget - v_cruise) > 0.5) { else if(abs(cruiseTarget - v_cruise) > 0.5) {
sprintf(apply_speed_str, "%.0f", cruiseTarget); sprintf(apply_speed_str, "%.0f", (s->scene.is_metric)?cruiseTarget: cruiseTarget * KM_TO_MILE);
ui_draw_text(s, apply_x, apply_y, apply_speed_str, 50, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK); ui_draw_text(s, apply_x, apply_y, apply_speed_str, 50, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK);
ui_draw_text(s, apply_x, apply_y - 50, "eco", 30, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK); ui_draw_text(s, apply_x, apply_y - 50, "eco", 30, textColor, BOLD, 1.0, 5.0, COLOR_BLACK, COLOR_BLACK);
} }

View File

@ -675,7 +675,7 @@ CarrotPanel::CarrotPanel(QWidget* parent) : QWidget(parent) {
latLongToggles->addItem(new CValueControl("LongTuningKf", "LONG: FF Gain(100)", "", "../assets/offroad/icon_logic.png", 0, 200, 5)); latLongToggles->addItem(new CValueControl("LongTuningKf", "LONG: FF Gain(100)", "", "../assets/offroad/icon_logic.png", 0, 200, 5));
latLongToggles->addItem(new CValueControl("LongActuatorDelay", "LONG: ActuatorDelay(20)", "", "../assets/offroad/icon_logic.png", 0, 200, 5)); latLongToggles->addItem(new CValueControl("LongActuatorDelay", "LONG: ActuatorDelay(20)", "", "../assets/offroad/icon_logic.png", 0, 200, 5));
latLongToggles->addItem(new CValueControl("VEgoStopping", "LONG: VEgoStopping(50)", "Stopping factor", "../assets/offroad/icon_logic.png", 1, 100, 5)); latLongToggles->addItem(new CValueControl("VEgoStopping", "LONG: VEgoStopping(50)", "Stopping factor", "../assets/offroad/icon_logic.png", 1, 100, 5));
latLongToggles->addItem(new CValueControl("RadarReactionFactor", "LONG: Radar reaction factor(10)", "", "../assets/offroad/icon_logic.png", 0, 200, 10)); latLongToggles->addItem(new CValueControl("RadarReactionFactor", "LONG: Radar reaction factor(100)", "", "../assets/offroad/icon_logic.png", 0, 200, 10));
//latLongToggles->addItem(new CValueControl("StartAccelApply", "LONG: StartingAccel 2.0x(0)%", "정지->출발시 가속도의 가속율을 지정합니다 0: 사용안함.", "../assets/offroad/icon_road.png", 0, 100, 10)); //latLongToggles->addItem(new CValueControl("StartAccelApply", "LONG: StartingAccel 2.0x(0)%", "정지->출발시 가속도의 가속율을 지정합니다 0: 사용안함.", "../assets/offroad/icon_road.png", 0, 100, 10));
//latLongToggles->addItem(new CValueControl("StopAccelApply", "LONG: StoppingAccel -2.0x(0)%", "정지유지시 브레이크압을 조정합니다. 0: 사용안함. ", "../assets/offroad/icon_road.png", 0, 100, 10)); //latLongToggles->addItem(new CValueControl("StopAccelApply", "LONG: StoppingAccel -2.0x(0)%", "정지유지시 브레이크압을 조정합니다. 0: 사용안함. ", "../assets/offroad/icon_road.png", 0, 100, 10));
latLongToggles->addItem(new CValueControl("LaneChangeNeedTorque", "LaneChange need torque", "1:need torque, 2:no lanechange", "../assets/offroad/icon_logic.png", 0, 2, 1)); latLongToggles->addItem(new CValueControl("LaneChangeNeedTorque", "LaneChange need torque", "1:need torque, 2:no lanechange", "../assets/offroad/icon_logic.png", 0, 2, 1));

View File

@ -105,7 +105,7 @@ def get_default_params():
("LongTuningKf", "100"), ("LongTuningKf", "100"),
("LongActuatorDelay", "20"), ("LongActuatorDelay", "20"),
("VEgoStopping", "50"), ("VEgoStopping", "50"),
("RadarReactionFactor", "10"), ("RadarReactionFactor", "100"),
("EnableRadarTracks", "0"), ("EnableRadarTracks", "0"),
("HyundaiCameraSCC", "0"), ("HyundaiCameraSCC", "0"),
("CanfdHDA2", "0"), ("CanfdHDA2", "0"),