koide3 / glim

GLIM: versatile and extensible range-based 3D localization and mapping framework
MIT License
578 stars 77 forks source link

Direclty save pcd file #88

Closed Shaswat2001 closed 1 month ago

Shaswat2001 commented 1 month ago

Hi,

Is it possible to directly save the pointcloud map created as PCD file rather than exporting it via the OfflineViewer?

koide3 commented 1 month ago

It is not directly supported, but you can easily implement it by using global_mapping->export_points() at the destructor of GlimROS.

std::vector<Eigen::Vector4d> points = global_mapping->export_points();
Shaswat2001 commented 1 month ago

Thanks. And sorry, this question might be stupid. But can I make this change if the glim_ros library is installed using PPA method?

koide3 commented 1 month ago

Unfortunately, it requires modifying the source code.

Shaswat2001 commented 1 month ago

Thanks a lot for the help. I was able to make the change.

hatem-darweesh commented 1 month ago

@Shaswat2001 You can save as .ply using offline_viewer. Then convert and visualize it to (.pcd) format using python open3d.

import open3d as o3d 
pcd = o3d.io.read_point_cloud("source_pointcloud.ply")
o3d.io.write_point_cloud("sink_pointcloud.pcd", pcd)
o3d.visualization.draw_geometries([pcd])