10 #include <json/json.h>
12 #include <Eigen/Geometry>
26 bool ReadJSONFromFile(
const std::string&
path, Json::Value& json) {
27 std::ifstream file(
path);
28 if (!file.is_open()) {
33 Json::CharReaderBuilder builder;
34 builder[
"collectComments"] =
false;
36 bool is_parse_successful = parseFromStream(builder, file, &json, &errs);
37 if (!is_parse_successful) {
44 std::vector<std::pair<double, Eigen::Matrix4d>> LoadTUMTrajectory(
46 std::vector<std::pair<double, Eigen::Matrix4d>> trajectory;
49 if (!file.is_open()) {
54 while (std::getline(file, line)) {
55 std::istringstream iss(line);
56 double timestamp, x, y, z, qx, qy, qz, qw;
57 if (!(iss >> timestamp >> x >> y >> z >> qx >> qy >> qz >> qw)) {
61 Eigen::Affine3d transform = Eigen::Affine3d::Identity();
62 transform.translate(Eigen::Vector3d(x, y, z));
63 transform.rotate(Eigen::Quaterniond(qw, qx, qy, qz));
65 trajectory.emplace_back(timestamp, transform.matrix());
75 "doppler-icp-data/carla-town05-curved-walls.zip",
76 "73a9828fb7790481168124c02398ee01"};
80 for (
int i = 1; i <= 100; ++i) {
82 ss << std::setw(5) << std::setfill(
'0') << i;
83 paths_.push_back(
GetExtractDir() +
"/xyzd_sequence/" + ss.str() +
88 trajectory_path_ =
GetExtractDir() +
"/ground_truth_poses.txt";
94 "Invalid index. Expected index between 0 to 99 but got {}.",
101 double& period)
const {
102 Json::Value calibration_data;
103 Eigen::Matrix4d calibration_temp;
104 if (ReadJSONFromFile(calibration_path_, calibration_data) &&
107 calibration_data[
"transform_vehicle_to_sensor"])) {
108 calibration = calibration_temp.transpose();
109 period = calibration_data[
"period"].asDouble();
115 std::vector<std::pair<double, Eigen::Matrix4d>>
117 return LoadTUMTrajectory(trajectory_path_);
const std::string GetExtractDir() const
Get absolute path to extract directory. i.e. ${data_root}/extract/${prefix}.
DemoDopplerICPSequence(const std::string &data_root="")
std::string GetPath(std::size_t index) const
Path to the point cloud at index.
std::vector< std::pair< double, Eigen::Matrix4d > > GetTrajectory() const
Returns a list of (timestamp, pose) representing the ground truth trajectory of the sequence.
bool GetCalibration(Eigen::Matrix4d &calibration, double &period) const
Returns the vehicle to sensor calibration transformation and the time period (in secs) between sequen...
Dataset class with one or more downloaded file.
static bool EigenMatrix4dFromJsonArray(Eigen::Matrix4d &mat, const Json::Value &value)
std::string CloudViewerDownloadsPrefix()
static const DataDescriptor data_descriptor
static const std::string path
Generic file read and write utility for python interface.
Infomation about a file to be downloaded.