How can I get gyro and accel values from L515 at MATLAB?
I am trying to implement SLAM in MATLAB using L515. So I try to get the gyro and accel values from L515, but I can't get them.
First of all, it says that get_pose_data cannot be performed when the code below is written and executed (I don't understand why it is made into video_frame class, not pose_frame).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
del = exist ('pipe','class');
if ( ( del ~= 0) )
pipe.stop();
pipe.delete;
clear('pipe');
end
clc;
clear;
width_depth = 640;
height_depth = 480;
width_infrared = 640;
height_infrared = 480;
width_rgb = 1280;
height_rgb = 720;
fps = 30;
pipe = realsense.pipeline();
cfg = realsense.config();
cfg.enable_stream(realsense.stream.color,width_rgb,height_rgb,realsense.format.rgb8,fps);
cfg.enable_stream(realsense.stream.depth,width_depth,height_depth,realsense.format.z16,fps);
cfg.enable_stream(realsense.stream.infrared,width_infrared,height_infrared,realsense.format.y8,fps);
cfg.enable_stream(realsense.stream.gyro,realsense.format.motion_xyz32f);
cfg.enable_stream(realsense.stream.accel,realsense.format.motion_xyz32f);
profile = pipe.start(cfg);
for i = 1:5 %% 1:20
fs = pipe.wait_for_frames();
end
while(1)
%Wait for the frames
fs = pipe.wait_for_frames();
%Select color frame
color = fs.get_color_frame();
infrared = fs.get_infrared_frame();
% Select depth frame
depth = fs.get_depth_frame();
%Get actual data and convert into a format imshow can use
data_color = color.get_data();
data_infrared = infrared.get_data();
pos= fs.get_pose_frame();
pos_data = pos.get_pose_data();
% %(Color data arrives as [R, G, B, R, G, B, ...] vector)
% %img(:,:,1) = red,img(:,:,2) = green,img(:,:,3) = blue
%img = permute(reshape(data_color,[3,color.get_width(),color.get_height()]),[3 2 1]); %color frame
img = permute(reshape(data_infrared,[infrared.get_width(),infrared.get_height()]),[2 1]); %infrared frame
%Display the image
imshow(img);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I want you to tell me why the problem occurs above and how we can solve it." (Is there a problem on SDK's side, or is my code a problem?)
The best thing is, as mentioned above, I would like you to tell me about examples where you can get gyro and accel values from matlab, or things you can refer to.
kind regards
-
Hi Jrh3503 L515 related questions are handled on the RealSense GitHub forum. Please re-post your question there by visiting the link below and clicking on the New Issue button. Thanks!
https://github.com/IntelRealSense/librealsense/issues
Please sign in to leave a comment.
Comments
1 comment