          scene.view_from_wide_calib.v[i*3 + j] = view_from_wide_calib(i,j);
        }
      }
      scene.calibration_valid = sm["liveCalibration"].getLiveCalibration().getCalStatus() == 1;
    }
    if (s->worldObjectsVisible()) {
      if (sm.updated("modelV2")) {
        update_model(s, sm["modelV2"].getModelV2());
      }
      if (sm.updated("radarState") && sm.rcv_frame("modelV2") > s->scene.started_frame) {
        update_leads(s, sm["radarState"].getRadarState(), sm["modelV2"].getModelV2().getPosition());
      }
    }
    if (sm.updated("pandaStates")) {
      auto pandaStates = sm["pandaStates"].getPandaStates();
      if (pandaStates.size() > 0) {
        scene.pandaType = pandaStates[0].getPandaType();
 
</s> remove 
  if (sm.updated("carState")) {
    float v_ego = sm["carState"].getCarState().getVEgo();
    // TODO: support replays without ecam by using fcam
    // Wide or narrow cam dependent on speed
    if ((v_ego < 10) || s->wide_cam_only) {
      scene.wide_cam = true;
    } else if (v_ego > 15) {
      scene.wide_cam = false;
    }
  }
 </s> add  </s> remove static void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::ModelDataV2::XYZTData::Reader &line) {
 </s> add void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::ModelDataV2::XYZTData::Reader &line) { </s> remove static int get_path_length_idx(const cereal::ModelDataV2::XYZTData::Reader &line, const float path_height) {
 </s> add int get_path_length_idx(const cereal::ModelDataV2::XYZTData::Reader &line, const float path_height) { </s> remove     if (!vipc_client || cur_stream_type != stream_type) {
 </s> add     if (!vipc_client || cur_stream != requested_stream_type) { </s> remove   VisionStreamType cur_stream_type = stream_type;
 </s> add   VisionStreamType cur_stream = requested_stream_type;
    scene.calibration_wide_valid = wfde_list.size() == 3;
          scene.view_from_wide_calib.v[i*3 + j] = view_from_wide_calib(i,j);
        }
      }
      scene.calibration_valid = sm["liveCalibration"].getLiveCalibration().getCalStatus() == 1;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    scene.calibration_wide_valid = wfde_list.size() == 3;
    }
    if (sm.updated("pandaStates")) {
      auto pandaStates = sm["pandaStates"].getPandaStates();
      if (pandaStates.size() > 0) {
        scene.pandaType = pandaStates[0].getPandaType();
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 UI: draw onroad objects on right frame (#26306)

* update before draw

* fix a lot of janky

* fix more flicker

* cleanup

* fix flicker when opening settings

* simplify 
selfdrive/ui/ui.cc