| 106 | } |
| 107 | |
| 108 | void load_pose_with_time( |
| 109 | const std::string &pose_file, |
| 110 | std::vector<std::pair<Eigen::Vector3d, Eigen::Matrix3d>> &poses_vec, |
| 111 | std::vector<double> ×_vec) { |
| 112 | times_vec.clear(); |
| 113 | poses_vec.clear(); |
| 114 | std::ifstream fin(pose_file); |
| 115 | std::string line; |
| 116 | Eigen::Matrix<double, 1, 7> temp_matrix; |
| 117 | while (getline(fin, line)) { |
| 118 | std::istringstream sin(line); |
| 119 | std::vector<std::string> Waypoints; |
| 120 | std::string info; |
| 121 | int number = 0; |
| 122 | while (getline(sin, info, ' ')) { |
| 123 | if (number == 0) { |
| 124 | double time; |
| 125 | std::stringstream data; |
| 126 | data << info; |
| 127 | data >> time; |
| 128 | times_vec.push_back(time); |
| 129 | number++; |
| 130 | } else { |
| 131 | double p; |
| 132 | std::stringstream data; |
| 133 | data << info; |
| 134 | data >> p; |
| 135 | temp_matrix[number - 1] = p; |
| 136 | if (number == 7) { |
| 137 | Eigen::Vector3d translation(temp_matrix[0], temp_matrix[1], |
| 138 | temp_matrix[2]); |
| 139 | Eigen::Quaterniond q(temp_matrix[6], temp_matrix[3], temp_matrix[4], |
| 140 | temp_matrix[5]); |
| 141 | std::pair<Eigen::Vector3d, Eigen::Matrix3d> single_pose; |
| 142 | single_pose.first = translation; |
| 143 | single_pose.second = q.toRotationMatrix(); |
| 144 | poses_vec.push_back(single_pose); |
| 145 | } |
| 146 | number++; |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | void load_keyframes_pose_pcd( |
| 153 | const std::string &pose_file, std::vector<int> &index_vec, |