Re: Getting the 2D laser data into MATLAB or Excel
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Getting-the-2D-laser-data-into-MATLAB-or-Excel-tp318p319.html
Hi Alex,
With the RTAB-Map GUI (rtabmapviz or with the standalone), you can select "File -> Export 2D scans (*.ply, *.pcd)" when there are laser scans shown. If you just loaded a previous database, make sure to do "Edit->Download all clouds (update cache)". Make sure also that checkbox "Cloud filtering" in the Preferences dialog (3D Rendering panel) is not checked, otherwise not all lasers would be exported.
So for the Export 2D scans, select:
1) Assemble scans? NO
2) Binary file? NO
3) Select a directory...
4) File format, select either pcd or ply
5) When you have the pcd or ply, you can open them in a text editor, you will see all the points in plain text with some headers. Either you edit manually, or you may parse them in MATLAB -> Import data... and ignore the header lines.
I'll take a note if I can just add a plain text format (*.txt) where each lines could be "x y z" without headers (tab delimited).
Examples PCD and PLY format:
# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z
SIZE 4 4 4
TYPE F F F
COUNT 1 1 1
WIDTH 717
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 717
DATA ascii
5.086833 -2.4301226 0
5.0978403 -2.4359834 0
5.1088905 -2.4417987 0
5.1190763 -2.4534991 0
5.1306777 -2.4562593 0
5.141583 -2.4639182 0
5.1533766 -2.465591 0
5.1659813 -2.461266 0
5.2058902 -2.247663 0
[...]
ply
format ascii 1.0
comment PCL generated
element vertex 717
property float x
property float y
property float z
element camera 1
property float view_px
property float view_py
property float view_pz
property float x_axisx
property float x_axisy
property float x_axisz
property float y_axisx
property float y_axisy
property float y_axisz
property float z_axisx
property float z_axisy
property float z_axisz
property float focal
property float scalex
property float scaley
property float centerx
property float centery
property int viewportx
property int viewporty
property float k1
property float k2
end_header
5.086833 -2.4301226 0
5.0978403 -2.4359834 0
5.1088905 -2.4417987 0
5.1190763 -2.4534991 0
5.1306777 -2.4562593 0
5.141583 -2.4639182 0
5.1533766 -2.465591 0
5.1659813 -2.461266 0
5.2058902 -2.247663 0
[...]
cheers,
Mathieu