D435i Depth Camera - Obtaining IMU data using Matlab
36 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1228907/image.png)
Any help is appreciated thank you! I do know that the camera is required to run the example but even some
0 个评论
回答(1 个)
Suraj
2023-9-20
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!