hku-mars / FAST_LIO

A computationally efficient and robust LiDAR-inertial odometry (LIO) package
GNU General Public License v2.0
2.77k stars 934 forks source link

Don't save map #348

Closed Parkeunseok closed 1 week ago

Parkeunseok commented 3 months ago

It is currently in use by ubuntu 22.04 ros2 humble

The config file I set is as follows.

As you can see in the file below, the map is not saved even though "pcd_save_en" is true.

Screenshot from 2024-08-06 15-23-48

Screenshot from 2024-08-06 15-24-01

What is the solution?

roboticlemon commented 3 months ago

I've had 2 problems, 1) the ROOT_DIR wasn't setting correctly if you have a non-standard directory structure. Manually hard coding this can be a quick workaround. 2) the map wouldn't save in time before SIGKILL was sent my roslaunch. You can verify if this is happening because you won't see the

current scan saved to /PCD/

print to screen.

Ericsii commented 3 months ago

In order not to be affected by the io operation of the saved map performance, I made a new ros service map_save with type std_srvs/Trigger. You can try manually trigger the service to save the map pointcloud to file.

Parkeunseok commented 3 months ago

i'm solved it thank you

123295 commented 3 months ago

I've meet the same problem and I can't save the pcd file, could you show me your folder structure? Thank you!

pk30123 commented 2 months ago

I tried executing the service map_save, but i did not give any results , Can you please help on elaborating it

pk30123 commented 2 months ago

[fastlio_mapping-1] [INFO] [1725266567.425343949] [laser_mapping]: Saving map to /home/pradheep/Documents/flio_ws/src/FAST_LIO/PCD/test.pcd... [fastlio_mapping-1] terminate called after throwing an instance of 'pcl::IOException' [fastlio_mapping-1] what(): : [pcl::PCDWriter::writeBinary] Input point cloud has no data! [ERROR] [fastlio_mapping-1]: process has died [pid 5983, exit code -6, cmd '/home/pradheep/Documents/flio_ws/install/fast_lio/lib/fast_lio/fastlio_mapping --ros-args --params-file /home/pradheep/Documents/flio_ws/src/FAST_LIO/config/ouster64.yaml --params-file /tmp/launch_params_4__njwjw'].

arjunskumar commented 2 months ago

@pk30123 check the size of pointcloud you are trying to save

pk30123 commented 2 months ago

Do you know which topic i should check for the point cloud? i could see rviz building. Same dataset in ros1 docker works

arjunskumar commented 2 months ago

are the config same for both docker and non docker enviornment?

pk30123 commented 2 months ago

Hi, sorry to elaborate i used docker in FASTLIO ROS1 and FASTLIO2 . the calibration matrices are the same , i could see some output in RVIZ in both but there is no saved pcd files in ROS2

lidarmansiwon commented 2 months ago

@pk30123 I had the same problem and error. I tried various ways to save the map. My environment is humble and the solution was to uncomment the code below and the map was saved.

laserMapping.cpp

Uncommented the comment code at line 513.

/**** save map ****/ / 1. make sure you have enough memories / 2. noted that pcd save will influence the real-time performences **/ if (pcd_save_en) { int size = feats_undistort->points.size(); PointCloudXYZI::Ptr laserCloudWorld( \ new PointCloudXYZI(size, 1));

for (int i = 0; i < size; i++) { RGBpointBodyToWorld(&feats_undistort->points[i], \ &laserCloudWorld->points[i]); } pcl_wait_save += laserCloudWorld;

static int scan_wait_num = 0; scan_wait_num++; if (pcl_wait_save->size() > 0 && pcd_save_interval > 0 && scan_wait_num >= pcd_save_interval) { pcd_index ++; string all_points_dir(string(string(ROOTDIR) + "PCD/scans") + to_string(pcd_index) + string(".pcd")); pcl::PCDWriter pcd_writer; cout << "current scan saved to /PCD/" << all_points_dir << endl; pcd_writer.writeBinary(all_points_dir, *pcl_wait_save); pcl_wait_save->clear(); scan_wait_num = 0; } } }

pk30123 commented 2 months ago

Hi,

Thanks for the update. This made the map to save on Ctrl+C not on srv .

Thanks

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.