YWL0720 / FAST-LOCALIZATION

A LiDAR-Inertial localization package based on FAST-LIO2, operating with a known prior map.
GNU General Public License v2.0
123 stars 16 forks source link

rosbag example? #1

Open gc625-kodifly opened 8 months ago

gc625-kodifly commented 8 months ago

Hi, many thanks for this awesome repo. I was wondering whether you can provide a rosbag for an example to run the repo? Additionally any plans for supporting ouster lidar, or what is needed to add ouster support?

YWL0720 commented 8 months ago

I have submitted a new launch file on the master branch to support the Ouster lidar. Also, you can use the repository at https://github.com/YWL0720/FAST_LIO. This repository has added interfaces for saving maps and pose files. It can save point clouds and poses in the map folder. Just copy the saved maps and poses to the working directory of fast_localization for use. Currently, the bag file I use for testing is quite large and uploading it is somewhat troublesome. I will update with a smaller bag file later for testing purposes.

gc625-kodifly commented 8 months ago

thanks for the quick reply. I have a question though, I have a map of an area that was generated by another method (we can assume it is GT), and a rosbag of my own ouster lidar scans going through that same area. Are you suggesting that when generating the map used in the localization process, we must first acquire a set of pose files for that map? If so, does that mean I cannot use this repo for localization on my GT map?

YWL0720 commented 8 months ago

In FAST-LOCALIZATION, the prior map is composed of a set of point cloud frames combined through their corresponding poses. When initializing and loading the map, ScanContext is used to compute the descriptors for each point cloud frame. During localization initialization, descriptors for the initial point cloud are also computed and matched with the global map to complete the initialization of global localization. If the prior map does not meet the aforementioned conditions, the automatic initialization function of FAST-LOCALIZATION will not work properly.

giangdao1402 commented 8 months ago

Hey i use your version of fast_lio, i also set bool save to true but when i run fast_lio i have no pcd and pose.json files

YWL0720 commented 8 months ago

The pcd and pose.json files will be saved in YOUR_WORKSPACE/src/FAST_LIO/map/

giangdao1402 commented 8 months ago

Yeah i know but nothing... ![Uploading Screenshot from 2023-12-13 18-16-35.png…]()

YWL0720 commented 8 months ago

That's my carelessness, you also need to add "_save_pcd: true_" in the yaml file which you use, just like https://github.com/YWL0720/FAST_LIO/blob/704b1d2305300189fe043081254a916cfa2bdd62/config/mid360.yaml#L25

giangdao1402 commented 8 months ago

terminate called after throwing an instance of 'pcl::IOException' what(): : [pcl::PCDWriter::writeASCII] Number of points different than width * height! hey what is this error, can you give me some advise ? I use Ouster lidar

YWL0720 commented 8 months ago

Which type of Lidar are you using?

giangdao1402 commented 8 months ago

I am using Ouster

YWL0720 commented 8 months ago

Try to add pl_orig.height = 1; pl_orig.width = plsize; in line 193 https://github.com/YWL0720/FAST_LIO/blob/704b1d2305300189fe043081254a916cfa2bdd62/src/preprocess.cpp#L192C2-L192C2

YWL0720 commented 8 months ago

I have submitted the new code. If you could provide a dataset from an Ouster LiDAR for testing, I would be very grateful, as I currently do not have any data related to this kind of LiDAR.

giangdao1402 commented 8 months ago

Hey i just tried but still the error. This is the link related to Ouster dateset: https://nghiensetups-my.sharepoint.com/:u:/g/personal/truonggiangds14_nghiensetups_net/EcFY0RzcDw9Bg1ZG0x65lpoBGwXk-NEe4EEYf4hG9r2ORw?e=gN0aTW

YWL0720 commented 8 months ago

Hey i just tried but still the error. This is the link related to Ouster dateset: https://nghiensetups-my.sharepoint.com/:u:/g/personal/truonggiangds14_nghiensetups_net/EcFY0RzcDw9Bg1ZG0x65lpoBGwXk-NEe4EEYf4hG9r2ORw?e=gN0aTW

Because I have been busy with other things in the past few days, I apologize for the late reply. Thank you for providing the dataset. I have submitted the latest code, and have successfully tested the map saving and relocalization functions on my local machine. However, given the unique nature of ScanContext, it is more suitable for use on mobile robots or devices where the LiDAR is mounted horizontally. I noticed that the LiDAR in your dataset is not placed horizontally, which may negatively affect the relocalization results.

giangdao1402 commented 8 months ago

@YWL0720 Thank you for upload the new codes. I just want to ask how can you think to fix that bug I tryna learn

YWL0720 commented 8 months ago

@YWL0720 Thank you for upload the new codes. I just want to ask how can you think to fix that bug I tryna learn

The error ”pcl::IOException: [pcl::PCDWriter::writeASCII] Number of points different than width * height!“ arises because, during the conversion of the point cloud from ROS's sensor_msgs/PointCloud2 format to pcl format, the 'width' and 'height' attributes are not assigned. This prevents the use of pcl's point cloud saving interface. To resolve this, simply manually assign values to these two attributes based on the number of points in the point cloud before saving it.

giangdao1402 commented 8 months ago

Hey can i load map of 1st bag then i play 2nd bag(both recorded in the same place) Can we localize in this situation ?

YWL0720 commented 8 months ago

of course you can.

giangdao1402 commented 7 months ago

I have 2 rosbags record the same place, but the odometry is parallel and the distance between 2 odometry is about 5 to 10m. I use ouster lidar. Can i record map of bag 1 and then play bag 2 to localization ?