hku-mars / BALM

An efficient and consistent bundle adjustment for lidar mapping
GNU General Public License v2.0
700 stars 151 forks source link

Own datasets #27

Open EloyAldao opened 1 year ago

EloyAldao commented 1 year ago

Hi:

As I can see this work runs on individual scans in pcd format, and a csv containing the poses. Will be there an option to use other datasets, as our own bags?

BALM v1 alowed to use own datasets, isolated or with LOAM odometry.

Will be there any utility to capture external odometry to make the PCDs and the pose file?

Thanks in advance

Zale-Liu commented 1 year ago

The code we opened mainly shows the basic function of the BA for readers to understand, instead of a completed system. You can take it as a sub-module in your own projects. If you want to use your own dataset, your should save the PCDs and pose file, which are generated by a front-end (like FAST-LIO2). The PCD file is saved by the function "pcl::io::savePCDFileBinary()" and the pose file is the pose matrix (4*4 matrix). The pose and PCD must corresponding one by one. Moreover, according to the quality of front-end, you need to adjust the parameters of adaptive voxelization (like "voxel_size" and "eigen_value_array[]"). For the completed system for global BA, you can see the paper "Large-Scale LiDAR Consistent Mapping using Hierarchical LiDAR Bundle Adjustment", which will be opened in several weeks.

antun008 commented 1 year ago

can we use pcd from r3live? How can I set in fastlio/r3live to publish pose matrix and use it for balm in format like yours?

Thanks in advance

Zale-Liu commented 1 year ago

can we use pcd from r3live? How can I set in fastlio/r3live to publish pose matrix and use it for balm in format like yours?

Thanks in advance

Of course you can use r3live. You need to add some codes to fastlio, r3live or you own project. You can use the std class "ofstream" and operation "<<" to input your pose 4*4 matrix into the file.

antun008 commented 1 year ago

Can you maybe help us and create modified code for fast lio or even better for r3live. Hope its not inconvenient for you😅

EloyAldao commented 1 year ago

Only as a comment:

I tried the last version on Ubuntu 18.4 with ROS Melodic and everything compiled and worked like a charm: rviz_screenshot_2022_09_27-14_00_35

I'm now trying to use my own data and odometry. I'll give you feedback. The only thing that could be better is to have the paths and poses files as a parameter in the launchfile, instead of have them hardcoded con the cpp @antun008 I use FAST-LIO on Livox Horizon datasets. If I find an easy way to make it work I'll notice to you

Zale-Liu commented 1 year ago

Can you maybe help us and create modified code for fast lio or even better for r3live. Hope its not inconvenient for yousweat_smile

ofstream outFile; outFile.open(yourpath + "alidarPose.csv", ios::out); Eigen::Matrix4d outT; outT << state.rot_end, state.pos_end, 0, 0, 0, LidarMeasures.lidar_beg_time; outFile << fixed; for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) outFile << outT(j, k) << ","; outFile << endl; } string filename = yourpath + "full" + to_string(count) + ".pcd"; pcl::PointCloud::Ptr pcl_body(new pcl::PointCloud); transformLidar(Eye3d, Zero3d, feats_undistort, pcl_imu_body); pcl::io::savePCDFileBinary(filename, *pcl_body);

You can add this piece of code to the end of each loop in fastlio2. You need to assign some variables like "yourpath". BALM2.0 is just an instruction to show you how to use lidar BA, so it cannot deal with too long dataset due to the time and space complexity (so does visual BA). Moreover, for your own dataset, you need to adjust "voxel_size" and "eigen_value_array" to control the quality of planes that you give to the BALM2.0 solver. If you give too much bad planes or the number of planes is too less, the solver may fail. The main limitation for lidar BA is the point association (namely finding planes) which we are trying to solve.

antun008 commented 1 year ago

Thanks a lot, I will try with this modified code. I want to say additionally that you have done a really excellent thing. That's what every odometry needs to become a real slam product!

antun008 commented 1 year ago

Only as a comment:

I tried the last version on Ubuntu 18.4 with ROS Melodic and everything compiled and worked like a charm: rviz_screenshot_2022_09_27-14_00_35

I'm now trying to use my own data and odometry. I'll give you feedback. The only thing that could be better is to have the paths and poses files as a parameter in the launchfile, instead of have them hardcoded con the cpp @antun008 I use FAST-LIO on Livox Horizon datasets. If I find an easy way to make it work I'll notice to you

Thank you!:) did you maybe succeed?

bloom256 commented 1 year ago

The code we opened mainly shows the basic function of the BA for readers to understand, instead of a completed system. You can take it as a sub-module in your own projects. If you want to use your own dataset, your should save the PCDs and pose file, which are generated by a front-end (like FAST-LIO2). The PCD file is saved by the function "pcl::io::savePCDFileBinary()" and the pose file is the pose matrix (4*4 matrix). The pose and PCD must corresponding one by one. Moreover, according to the quality of front-end, you need to adjust the parameters of adaptive voxelization (like "voxel_size" and "eigen_value_array[]"). For the completed system for global BA, you can see the paper "Large-Scale LiDAR Consistent Mapping using Hierarchical LiDAR Bundle Adjustment", which will be opened in several weeks.

Are there any plans to add an open-source license?