14 long long frame_ts,
long long backend_ts,
long long arrival_time,
15 double p1,
double p2,
double p3,
16 double p4,
double p5,
double p6,
double p7) :
17 _stream_type(stream_type),
18 _stream_idx(stream_index),
21 _backend_ts(backend_ts),
23 _params({
p1,
p2, p3, p4, p5, p6, p7 }){}
29 << std::fixed << std::setprecision(3) << _frame_ts <<
"," << _backend_ts <<
"," << _arrival_time;
32 size_t specific_attributes = 0;
34 specific_attributes = 3;
36 specific_attributes = 7;
38 for (
auto i = 0;
i < specific_attributes;
i++)
39 ss <<
"," << _params[
i];
41 return ss.str().c_str();
66 <<
"_" << std::setprecision(14) << std::fixed << depthframe.
get_timestamp()
69 std::stringstream metadata_file;
72 <<
"_metadata_" << std::setprecision(14) << std::fixed << depthframe.
get_timestamp()
75 std::string filenameS =
filename.str();
76 std::string metadataS = metadata_file.str();
79 [filenameS, metadataS, depthframe] {
80 std::ofstream
fs(filenameS, std::ios::trunc);
102 auto t = time(
nullptr);
104 const tm* time = localtime(&
t);
108 return std::string(
buffer);
115 std::cout <<
"No imu or pose data collected" << std::endl;
120 std::vector<uint64_t> frames_per_stream;
122 frames_per_stream.emplace_back(kv.second.size());
124 std::sort(frames_per_stream.begin(), frames_per_stream.end());
132 throw std::runtime_error(
stringify() <<
"Cannot open the requested output file " <<
_filePath <<
", please check permissions");
136 csv <<
"\n\nStream Type,F#,HW Timestamp (ms),Backend Timestamp(ms),Host Timestamp(ms)"
137 << (
val_in_range(elem.first.first, { RS2_STREAM_GYRO,RS2_STREAM_ACCEL }) ?
",3DOF_x,3DOF_y,3DOF_z" :
"")
138 << (
val_in_range(elem.first.first, { RS2_STREAM_POSE }) ?
",t_x,t_y,t_z,r_x,r_y,r_z,r_w" :
"")
141 for (
auto i = 0;
i < elem.second.size();
i++)
142 csv << elem.second[
i].to_string();
158 auto stream_uid = std::make_pair(
f.get_profile().stream_type(),
159 f.get_profile().stream_index());
165 long long backend_timestamp = 0LL;
174 f.get_profile().stream_index(),
175 f.get_frame_number(),
182 auto axes = motion.get_motion_data();
188 auto pose = pf.get_pose_data();
189 record._params = {
pose.translation.x,
pose.translation.y,
pose.translation.z,
199 std::unique_lock<std::mutex> lck(
_m);
219 if (motionframe || poseframe)