|
|
@ -77,14 +77,10 @@ void update_line_data(const UIState *s, const cereal::XYZTData::Reader &line, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void update_model(UIState *s, |
|
|
|
void update_model(UIState *s, |
|
|
|
const cereal::ModelDataV2::Reader &model, |
|
|
|
const cereal::ModelDataV2::Reader &model) { |
|
|
|
const cereal::UiPlan::Reader &plan) { |
|
|
|
|
|
|
|
UIScene &scene = s->scene; |
|
|
|
UIScene &scene = s->scene; |
|
|
|
auto plan_position = plan.getPosition(); |
|
|
|
auto model_position = model.getPosition(); |
|
|
|
if (plan_position.getX().size() < model.getPosition().getX().size()) { |
|
|
|
float max_distance = std::clamp(*(model_position.getX().end() - 1), |
|
|
|
plan_position = model.getPosition(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
float max_distance = std::clamp(*(plan_position.getX().end() - 1), |
|
|
|
|
|
|
|
MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE); |
|
|
|
MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE); |
|
|
|
|
|
|
|
|
|
|
|
// update lane lines
|
|
|
|
// update lane lines
|
|
|
@ -110,8 +106,8 @@ void update_model(UIState *s, |
|
|
|
const float lead_d = lead_one.getDRel() * 2.; |
|
|
|
const float lead_d = lead_one.getDRel() * 2.; |
|
|
|
max_distance = std::clamp((float)(lead_d - fmin(lead_d * 0.35, 10.)), 0.0f, max_distance); |
|
|
|
max_distance = std::clamp((float)(lead_d - fmin(lead_d * 0.35, 10.)), 0.0f, max_distance); |
|
|
|
} |
|
|
|
} |
|
|
|
max_idx = get_path_length_idx(plan_position, max_distance); |
|
|
|
max_idx = get_path_length_idx(model_position, max_distance); |
|
|
|
update_line_data(s, plan_position, 0.9, 1.22, &scene.track_vertices, max_idx, false); |
|
|
|
update_line_data(s, model_position, 0.9, 1.22, &scene.track_vertices, max_idx, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd) { |
|
|
|
void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd) { |
|
|
@ -212,8 +208,7 @@ static void update_state(UIState *s) { |
|
|
|
scene.world_objects_visible = scene.world_objects_visible || |
|
|
|
scene.world_objects_visible = scene.world_objects_visible || |
|
|
|
(scene.started && |
|
|
|
(scene.started && |
|
|
|
sm.rcv_frame("liveCalibration") > scene.started_frame && |
|
|
|
sm.rcv_frame("liveCalibration") > scene.started_frame && |
|
|
|
sm.rcv_frame("modelV2") > scene.started_frame && |
|
|
|
sm.rcv_frame("modelV2") > scene.started_frame); |
|
|
|
sm.rcv_frame("uiPlan") > scene.started_frame); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ui_update_params(UIState *s) { |
|
|
|
void ui_update_params(UIState *s) { |
|
|
@ -249,7 +244,7 @@ UIState::UIState(QObject *parent) : QObject(parent) { |
|
|
|
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>>({ |
|
|
|
sm = std::make_unique<SubMaster, const std::initializer_list<const char *>>({ |
|
|
|
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", |
|
|
|
"modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", |
|
|
|
"pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "driverStateV2", |
|
|
|
"pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "driverStateV2", |
|
|
|
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "uiPlan", "clocks", |
|
|
|
"wideRoadCameraState", "managerState", "navInstruction", "navRoute", "clocks", |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Params params; |
|
|
|
Params params; |
|
|
|