Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: add PATH_OFFSET_Z constant #33802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions selfdrive/ui/qt/onroad/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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]);
}
}
}
Expand Down Expand Up @@ -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) {
Expand Down
Loading