Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The program crashed when calling rs2::motion_frame.get_motion_data() #11014

Closed
HEIDIES opened this issue Oct 22, 2022 · 3 comments
Closed

The program crashed when calling rs2::motion_frame.get_motion_data() #11014

HEIDIES opened this issue Oct 22, 2022 · 3 comments

Comments

@HEIDIES
Copy link

HEIDIES commented Oct 22, 2022

Required Info
Camera Model D435i
Firmware Version 05.13.00.50
Operating System & Version Ubuntu 18
Kernel Version (Linux Only) 4.9.253
Platform NVIDIA Jetson Xavier NX
SDK Version 2.50.0 }
Language C++

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:

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.
...
@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Oct 22, 2022

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);

@MartyG-RealSense
Copy link
Collaborator

Hi @HEIDIES Do you require further assistance with this case, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants