The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

t/euroc: Fix race condition in imu and gt csv writers

Multiple cameras were flushing the imu/gt queues but only one should do so.

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
642549b5 4b78b4c5

+5 -3
+5 -3
src/xrt/auxiliary/tracking/t_euroc_recorder.cpp
··· 100 100 *er->imu_csv << "#timestamp [ns],w_RS_S_x [rad s^-1],w_RS_S_y [rad s^-1],w_RS_S_z [rad s^-1]," 101 101 "a_RS_S_x [m s^-2],a_RS_S_y [m s^-2],a_RS_S_z [m s^-2]" CSV_EOL; 102 102 103 - create_directories(path + "/mav0/gt0"); 104 - er->gt_csv = new ofstream{path + "/mav0/gt0/data.csv"}; 103 + create_directories(path + "/mav0/gt"); 104 + er->gt_csv = new ofstream{path + "/mav0/gt/data.csv"}; 105 105 *er->gt_csv << std::fixed << std::setprecision(CSV_PRECISION); 106 106 *er->gt_csv << "#timestamp [ns],p_RS_R_x [m],p_RS_R_y [m],p_RS_R_z [m]," 107 107 "q_RS_w [],q_RS_x [],q_RS_y [],q_RS_z []" CSV_EOL; ··· 208 208 extern "C" void euroc_recorder_save_cam##cam_id(struct xrt_frame_sink *sink, struct xrt_frame *frame) \ 209 209 { \ 210 210 euroc_recorder *er = container_of(sink, euroc_recorder, writer_sinks[cam_id]); \ 211 - euroc_recorder_flush(er); \ 211 + if (cam_id == 0) { \ 212 + euroc_recorder_flush(er); \ 213 + } \ 212 214 euroc_recorder_save_frame(er, frame, cam_id); \ 213 215 } 214 216