-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Adding color or infrared stream to pipeline config limits IMU data frequency #9129
Comments
Hi @newpavlov If you need to improve performance on a three-stream setup of IMU and two others (e.g depth and color) then there are two main approaches that can be taken. The first is to create separate pipelines (the IMU on one pipeline on its own and the other two streams on the second pipeline. An excellent Python script example for separate pipelines is in the link below. Typically there are not equivalent scripts for doing the same in C++. If you would rather not use separate pipelines, the other popular approach is to use callbacks. The link below has a Python callback script that streams IMU, depth and color. This link discusses callbacks for IMU in terms of C++: |
@MartyG-RealSense let mut user_data = (0u64, 0u64);
unsafe extern "C" fn on_frame(frame_ptr: *mut sys::rs2_frame, user_ptr: *mut c_void) {
let user_data = &mut *(user_ptr as *mut (u64, u64));
let mut err = std::ptr::null_mut::<sys::rs2_error>();
let count = sys::rs2_embedded_frames_count(frame_ptr, &mut err);
if err.is_null() {
user_data.0 += count as u64;
} else {
user_data.1 += 1;
sys::rs2_free_error(err);
}
sys::rs2_release_frame(frame_ptr);
}
let _profile_ptr = sys::rs2_pipeline_start_with_config_and_callback(
pipeline_ptr,
cfg_ptr,
Some(on_frame),
&mut user_data as *mut (u64, u64) as *mut c_void,
&mut err,
);
check_err!(err);
std::thread::sleep(Duration::from_secs(100));
sys::rs2_pipeline_stop(
pipeline_ptr,
&mut err,
);
check_err!(err);
println!("frames: {}, errors: {}", user_data.0, user_data.1); But I get the following result:
It looks like |
It looks as though the above script is based on Java because it is for use with Rust, in particular realsense-rust. Is that correct, please? https://github.com/Tangram-Vision/realsense-rust If it is correct: given that Rust has a compatibility wrapper for librealsense but it is not an integrated part of the RealSense SDK, it is difficult to provide programming advice for Rust. The maintainers of realsense-rust suggest raising an issue on their Gitlab site if you have a question about the workings of it. https://gitlab.com/tangram-vision-oss/realsense-rust/-/issues |
I have found that I should use |
Thanks very much @newpavlov for the update of your progress and for the sharing of information about realsense-sys, which should be of benefit to realsense-rust users reading this case in future. |
Issue Description
I have the following test code written in Rust, which uses low-level
realsense-sys
bindings:This code is executed with a D435i sensor. It should be fairly easy to understand even for those who are not familiar with Rust and it can be trivially translated to C. Even though the config clearly specifies that I want to get IMU data with maximum frequencies, I get the following results:
In other words, IMU measurements are limited by frequency of the color stream (same applies to infrared streams as well). By disabling it, I get expected numbers:
Is it possible to get complete IMU data and images using one pipeline?
The text was updated successfully, but these errors were encountered: