  #include "selfdrive/hardware/hw.h"
  #include "selfdrive/modeld/models/driving.h"
  
  ExitHandler do_exit;
  // globals
  bool live_calib_seen;
  mat3 cur_transform;
  std::mutex transform_lock;
  
  void calibration_thread(bool wide_camera) {
    util::set_thread_name("calibration");
    util::set_realtime_priority(50);
  
    SubMaster sm({"liveCalibration"});
  
    /*
       import numpy as np
       from common.transformations.model import medmodel_frame_from_road_frame
       medmodel_frame_from_ground = medmodel_frame_from_road_frame[:, (0, 1, 3)]
 
</s> remove   Eigen::Matrix<float, 3, 3> ground_from_medmodel_frame;
  ground_from_medmodel_frame <<
 </s> add   static const auto ground_from_medmodel_frame = (Eigen::Matrix<float, 3, 3>() <<  </s> remove void run_model(ModelState &model, VisionIpcClient &vipc_client) {
 </s> add void run_model(ModelState &model, VisionIpcClient &vipc_client, bool wide_camera) { </s> remove     transform_lock.lock();
    mat3 model_transform = cur_transform;
    bool valid = live_calib_seen;
    transform_lock.unlock();

 </s> add  </s> remove   SubMaster sm({"lateralPlan", "roadCameraState"});
 </s> add   SubMaster sm({"lateralPlan", "roadCameraState", "liveCalibration"});
  #include "selfdrive/hardware/hw.h"
  #include "selfdrive/modeld/models/driving.h"
  
  ExitHandler do_exit;










  
    /*
       import numpy as np
       from common.transformations.model import medmodel_frame_from_road_frame
       medmodel_frame_from_ground = medmodel_frame_from_road_frame[:, (0, 1, 3)]
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 modeld: update live calibration in main thread (#23235)

* update live calibration in main thread

* static ground_from_medmodel_frame

* more static

* cleanup

* no lambda

* trigger ci 
selfdrive/modeld/modeld.cc