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),
19 _frame_number(frame_number),
21 _backend_ts(backend_ts),
22 _arrival_time(arrival_time),
23 _params({
p1,
p2, p3, p4, p5, p6, p7 }){}
32 size_t specific_attributes = 0;
34 specific_attributes = 3;
36 specific_attributes = 7;
38 for (
auto i = 0;
i < specific_attributes;
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);
106 strftime(buffer,
sizeof(buffer),
"%Y%m%d%H%M%S", time);
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());
129 filename <<
_filePath <<
"_" << time_Str <<
"_imu_pose.csv";
130 std::ofstream csv(filename.str());
132 throw std::runtime_error(
stringify() <<
"Cannot open the requested output file " <<
_filePath <<
", please check permissions");
134 for (
const auto& elem : _imu_pose_collection)
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();
165 long long backend_timestamp = 0LL;
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)
def axes(out, pos, rotation=np.eye(3), size=0.075, thickness=2)
std::string stream_name() const
double get_timestamp() const
std::string stringify(const T &e)
void sort(sort_type m_sort_type, const std::string &in, const std::string &out)
::realsense_legacy_msgs::pose_< std::allocator< void > > pose
float get_distance(int x, int y) const
rs2_stream
Streams are different types of data provided by RealSense devices.
unsigned long long get_frame_number() const
const char * rs2_stream_to_string(rs2_stream stream)
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
rs2_stream stream_type() const
stream_profile get_profile() const