|
|
@ -498,13 +498,13 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { |
|
|
|
painter.restore(); |
|
|
|
painter.restore(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd) { |
|
|
|
void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::RadarState::LeadData::Reader &lead_data, const QPointF &vd) { |
|
|
|
painter.save(); |
|
|
|
painter.save(); |
|
|
|
|
|
|
|
|
|
|
|
const float speedBuff = 10.; |
|
|
|
const float speedBuff = 10.; |
|
|
|
const float leadBuff = 40.; |
|
|
|
const float leadBuff = 40.; |
|
|
|
const float d_rel = lead_data.getX()[0]; |
|
|
|
const float d_rel = lead_data.getDRel(); |
|
|
|
const float v_rel = lead_data.getV()[0]; |
|
|
|
const float v_rel = lead_data.getVRel(); |
|
|
|
|
|
|
|
|
|
|
|
float fillAlpha = 0; |
|
|
|
float fillAlpha = 0; |
|
|
|
if (d_rel < leadBuff) { |
|
|
|
if (d_rel < leadBuff) { |
|
|
@ -539,6 +539,7 @@ void AnnotatedCameraWidget::paintGL() { |
|
|
|
SubMaster &sm = *(s->sm); |
|
|
|
SubMaster &sm = *(s->sm); |
|
|
|
const double start_draw_t = millis_since_boot(); |
|
|
|
const double start_draw_t = millis_since_boot(); |
|
|
|
const cereal::ModelDataV2::Reader &model = sm["modelV2"].getModelV2(); |
|
|
|
const cereal::ModelDataV2::Reader &model = sm["modelV2"].getModelV2(); |
|
|
|
|
|
|
|
const cereal::RadarState::Reader &radar_state = sm["radarState"].getRadarState(); |
|
|
|
|
|
|
|
|
|
|
|
// draw camera frame
|
|
|
|
// draw camera frame
|
|
|
|
{ |
|
|
|
{ |
|
|
@ -589,19 +590,20 @@ void AnnotatedCameraWidget::paintGL() { |
|
|
|
if (sm.rcv_frame("modelV2") > s->scene.started_frame) { |
|
|
|
if (sm.rcv_frame("modelV2") > s->scene.started_frame) { |
|
|
|
update_model(s, sm["modelV2"].getModelV2()); |
|
|
|
update_model(s, sm["modelV2"].getModelV2()); |
|
|
|
if (sm.rcv_frame("radarState") > s->scene.started_frame) { |
|
|
|
if (sm.rcv_frame("radarState") > s->scene.started_frame) { |
|
|
|
update_leads(s, sm["radarState"].getRadarState(), sm["modelV2"].getModelV2().getPosition()); |
|
|
|
update_leads(s, radar_state, sm["modelV2"].getModelV2().getPosition()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
drawLaneLines(painter, s); |
|
|
|
drawLaneLines(painter, s); |
|
|
|
|
|
|
|
|
|
|
|
if (s->scene.longitudinal_control) { |
|
|
|
if (s->scene.longitudinal_control) { |
|
|
|
const auto leads = model.getLeadsV3(); |
|
|
|
auto lead_one = radar_state.getLeadOne(); |
|
|
|
if (leads[0].getProb() > .5) { |
|
|
|
auto lead_two = radar_state.getLeadTwo(); |
|
|
|
drawLead(painter, leads[0], s->scene.lead_vertices[0]); |
|
|
|
if (lead_one.getStatus()) { |
|
|
|
|
|
|
|
drawLead(painter, lead_one, s->scene.lead_vertices[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
if (leads[1].getProb() > .5 && (std::abs(leads[1].getX()[0] - leads[0].getX()[0]) > 3.0)) { |
|
|
|
if (lead_two.getStatus() && (std::abs(lead_one.getDRel() - lead_two.getDRel()) > 3.0)) { |
|
|
|
drawLead(painter, leads[1], s->scene.lead_vertices[1]); |
|
|
|
drawLead(painter, lead_two, s->scene.lead_vertices[1]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|