From b1e8c38c0d23b7fd19abf514231b5643906c3353 Mon Sep 17 00:00:00 2001 From: deanlee Date: Wed, 16 Oct 2024 13:48:22 +0800 Subject: [PATCH] add PATH_OFFSET_Z constant --- selfdrive/ui/qt/onroad/model.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/onroad/model.cc b/selfdrive/ui/qt/onroad/model.cc index d1e3c7bde275a3..43b719b01def0e 100644 --- a/selfdrive/ui/qt/onroad/model.cc +++ b/selfdrive/ui/qt/onroad/model.cc @@ -3,6 +3,7 @@ constexpr int CLIP_MARGIN = 500; constexpr float MIN_DRAW_DISTANCE = 10.0; constexpr float MAX_DRAW_DISTANCE = 100.0; +constexpr float PATH_OFFSET_Z = 1.22; static int get_path_length_idx(const cereal::XYZTData::Reader &line, const float path_height) { const auto &line_x = line.getX(); @@ -53,7 +54,7 @@ void ModelRenderer::update_leads(const cereal::RadarState::Reader &radar_state, const auto &lead_data = (i == 0) ? radar_state.getLeadOne() : radar_state.getLeadTwo(); if (lead_data.getStatus()) { float z = line.getZ()[get_path_length_idx(line, lead_data.getDRel())]; - mapToScreen(lead_data.getDRel(), -lead_data.getYRel(), z + 1.22, &lead_vertices[i]); + mapToScreen(lead_data.getDRel(), -lead_data.getYRel(), z + PATH_OFFSET_Z, &lead_vertices[i]); } } } @@ -85,7 +86,7 @@ void ModelRenderer::update_model(const cereal::ModelDataV2::Reader &model, const max_distance = std::clamp((float)(lead_d - fmin(lead_d * 0.35, 10.)), 0.0f, max_distance); } max_idx = get_path_length_idx(model_position, max_distance); - mapLineToPolygon(model_position, 0.9, 1.22, &track_vertices, max_idx, false); + mapLineToPolygon(model_position, 0.9, PATH_OFFSET_Z, &track_vertices, max_idx, false); } void ModelRenderer::drawLaneLines(QPainter &painter) {