You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two pipelines in the program, which open depth stream and IMU stream respectively. The IMU data is used for subsequent calculations.
The program runs well at first, but the program crashed when calling rs2::motion_frame.get_motion_data() after about an hour every time.
The main codes are as follows:
cfg.enable_stream(RS2_STREAM_ACCEL, RS2_FORMAT_MOTION_XYZ32F, 250);
cfg.enable_stream(RS2_STREAM_GYRO, RS2_FORMAT_MOTION_XYZ32F, 200);
pipeline.start(cfg, [&](const rs2::frame &frame) {
std::lock_guard<std::mutex> lock(pipe_mutex);
if (auto mf = frame.as<rs2::motion_frame>()) {
if (mf.get_profile().stream_type() == RS2_STREAM_GYRO) {
gyro = mf;
gyro.keep();
} else if (mf.get_profile().stream_type() == RS2_STREAM_ACCEL) {
accel = mf;
accel.keep();
}
}
});
...
auto data = accel.get_motion_data(); // program crashed here.
...
The text was updated successfully, but these errors were encountered:
Hi @HEIDIES As you are using the Keep() instruction, I would recommend monitoring over a period of time the amount of available remaining memory that your computer has, using an Ubuntu system monitoring tool such as htop. This is because Keep() causes frames to be stored in the computer's memory, so the computer's memory capacity is progressively consumed over time. When available memory falls below a certain level, an application's performance will start to degrade and it will eventually lead to a program freeze or crash.
If the crash occurs within a consistent time frame then that may indicate that memory is being consumed at approximately the same rate each time the program is run, leading to a crash at around the same time duration after starting the program.
You may be able to extend the amount of time that a program using Keep() can run for by periodically releasing frames from the memory. In C++ frames can be released with the rs2_release_frame instruction, such as rs2_release_frame(frame);
Issue Description
There are two pipelines in the program, which open depth stream and IMU stream respectively. The IMU data is used for subsequent calculations.
The program runs well at first, but the program crashed when calling rs2::motion_frame.get_motion_data() after about an hour every time.
The main codes are as follows:
The text was updated successfully, but these errors were encountered: