D435i Depth Camera - Obtaining IMU data using Matlab

17 vues (au cours des 30 derniers jours)
JIAN-HONG YE ZHU
JIAN-HONG YE ZHU le 12 Déc 2022
Réponse apportée : Suraj le 20 Sep 2023
Hello, I am trying to obtain the IMU data from the D435i depth camera in order to figure out the rotating angle of the depth camera. I have seen the examples in Intel Realsense github but am unsure how to enable the accelerometer and gyroscope stream to obtain this.
The capture_example.m seems to be an app that shows this data in real-time but I simply want to be able to read the gyro and accelerometer values off so I can use it as a basic function that prints these values in the command window. From what I see in the app they designed an interface and the primarily functions that calculate the gyroscope and accelerometer values are function set_motion_data(app,h,d) and function h = draw_motion_data(app,ag,at,d,ss), the other functions are mostly used for start up and app interface I believe. I think the set_motion function has the equations I require to do this but not sure how to extract them outside of the app.
Any help is appreciated thank you! I do know that the camera is required to run the example but even some

Réponses (1)

Suraj
Suraj le 20 Sep 2023
Greetings Jian-Hong,
I understand that you’d like to use the data shown by “capture_example.m” app. You can obtain these sensor readouts by writing a script of your own that utilizes the functions provided by the “realsense” library.
One such example is provided in the Readme file of the library: https://github.com/IntelRealSense/librealsense/blob/development/wrappers/matlab/readme.md
I suggest that you go through “capture_example.m” as it contains the logic for reading and processing sensor data apart from the code for the app UI. Your script would then look something like this:
function camera_example_without_ui()
% Make Pipeline object to manage streaming
pipe = realsense.pipeline();
% Make Colorizer object to prettify depth output
colorizer = realsense.colorizer();
% Start streaming on an arbitrary camera with default settings
profile = pipe.start();
% Set the frame rate for image caputre
period = 1.0;
% Register a function reads and processes a frame at an interval of
% "period" seconds
timer( ...
'ExecutionMode', 'fixedRate', ... % 'fixedSpacing', ...
'Period', period, ...
'BusyMode', 'queue',... % 'drop', ...
'TimerFcn',@tmProcess ...
);
pipe.stop();
end
Please add a handle to your own timer function in place of "@tmProcess" using the logic from "tmProcess" and "set_motion_data" functions in “capture_example.m”.
I hope this helps!
Thanks & regards,
Suraj.

Catégories

En savoir plus sur MATLAB Support Package for USB Webcams dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by