首页 > 其他分享 >okvis

okvis

时间:2023-07-03 13:45:36浏览次数:25  
标签:std const Eigen ofs WS okvis

 将文件okvis_app_synchronous.cpp中代码修改为:

 
class PoseViewer
{
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  constexpr static const double imageSize = 500.0;
  PoseViewer()
  {
    cv::namedWindow("OKVIS Top View");
    _image.create(imageSize, imageSize, CV_8UC3);
    drawing_ = false;
    showing_ = false;
    std::string ofs_out = "/home/zoe/OKVIS_catkin_ws/okvis-test/trajecty.txt";//std::string ofs_out = "trajecty.txt";
    ofs_traj = std::ofstream(ofs_out.c_str());
  }
  // this we can register as a callback
  void publishFullStateAsCallback(
      const okvis::Time & t, const okvis::kinematics::Transformation & T_WS,
      const Eigen::Matrix<double, 9, 1> & speedAndBiases,
      const Eigen::Matrix<double, 3, 1> & /*omega_S*/)
  {
    // save pose
    //setTime(t);
    Eigen::Vector3d p_WS_W = T_WS.r();
    Eigen::Quaterniond q_WS = T_WS.q();
    std::stringstream time;
    time << t.sec << std::setw(9) << std::setfill('0') << t.nsec;
    ofs_traj << t.sec << "." << t.nsec << " "
             << p_WS_W(0) << " " << p_WS_W(1) << " " <<  p_WS_W(2) << " " 
             << q_WS.x() << " " << q_WS.y() << " " << q_WS.z() << " " << q_WS.w() 
             << std::endl;

找到代码:

std::atomic_bool showing_;

在后面添加:

std::ofstream ofs_traj;

标签:std,const,Eigen,ofs,WS,okvis
From: https://www.cnblogs.com/liuweiweitju/p/17522548.html

相关文章