From 974b96efe98004ef7e655546efba054f13b69463 Mon Sep 17 00:00:00 2001 From: Chanho Jung Date: Thu, 24 Dec 2020 17:32:27 +0900 Subject: [PATCH] Update paint.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 수정사항 1. 수동 핸들링 감지시 트랙 가이드선 색상을 회색으로 변경 & 트랙 가이드 선 색상을 좀 더 진하게 2. 차선인식률에 따른 차선색상 변경 ( red > yellow > green ) --- selfdrive/ui/paint.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index 36c75b6..ddcecde 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -204,14 +204,14 @@ static void ui_draw_track(UIState *s, bool is_mpc, track_vertices_data *pvd) { // Draw colored MPC track Kegman's if (s->scene.steerOverride) { track_bg = nvgLinearGradient(s->vg, s->fb_w, s->fb_h, s->fb_w, s->fb_h*.4, - nvgRGBA(0, 191, 255, 255), nvgRGBA(0, 95, 128, 50)); + COLOR_BLACK_ALPHA(200), COLOR_BLACK_ALPHA(20)); //nvgRGBA(0, 191, 255, 255), nvgRGBA(0, 95, 128, 50)); } else { - int torque_scale = (int)fabs(510*(float)s->scene.output_scale); + int torque_scale = (int)fabs(255*(float)s->scene.output_scale); int red_lvl = fmin(255, torque_scale); - int green_lvl = fmin(255, 510-torque_scale); + int green_lvl = fmin(255, 255-torque_scale); track_bg = nvgLinearGradient(s->vg, s->fb_w, s->fb_h, s->fb_w, s->fb_h*.4, nvgRGBA( red_lvl, green_lvl, 0, 255), - nvgRGBA((int)(0.5*red_lvl), (int)(0.5*green_lvl), 0, 50)); + nvgRGBA((int)(0.7*red_lvl), (int)(0.7*green_lvl), 0, 50)); } } else { // Draw white vision track @@ -270,14 +270,25 @@ static void update_line_data(UIState *s, const cereal::ModelDataV2::XYZTData::Re static void ui_draw_vision_lane_lines(UIState *s) { const UIScene *scene = &s->scene; - + float red_lvl = 0.0; + float green_lvl = 0.0; // paint lanelines line_vertices_data *pvd_ll = &s->lane_line_vertices[0]; for (int ll_idx = 0; ll_idx < 4; ll_idx++) { - if (s->sm->updated("modelV2")) { + if(s->sm->updated("modelV2")) { update_line_data(s, scene->model.getLaneLines()[ll_idx], 0.025*scene->model.getLaneLineProbs()[ll_idx], pvd_ll + ll_idx, scene->max_distance); } - NVGcolor color = nvgRGBAf(1.0, 1.0, 1.0, scene->lane_line_probs[ll_idx]); + red_lvl = 0.0; + green_lvl = 0.0; + if ( scene->lane_line_probs[ll_idx] > 0.4 ){ + red_lvl = 1 - (scene->lane_line_probs[ll_idx] - 0.4) * 2.5; + green_lvl = 1 ; + } + else { + red_lvl = 1 ; + green_lvl = 1 - (0.4 - scene->lane_line_probs[ll_idx]) * 2.5; + } + NVGcolor color = nvgRGBAf(red_lvl, green_lvl, 0, 1); ui_draw_line(s, (pvd_ll + ll_idx)->v, (pvd_ll + ll_idx)->cnt, &color, nullptr); }