同步操作将从 apples/fast-lio2-map-based-localization 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
map-based localization.Modified from fast-lio2 and s-fast-lio
just to follow s-fast-lio,I won't go into further detail here.
cd ~/catkin_ws/src
git clone https://github.com/xz00/fast-lio2-map-based-localization.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
Recommend fast-lio-sam to build a global map.This work utilizes loop detection and point cloud matching, and updates the optimized pose to the front-end, enabling the creation of a high-quality map in a wide range of scenes. Can be used to create global maps based on map localization. a large global map example:
Files that need to be modified is config/velodyne_re.yaml
edit this param: globalmap_dir: "/home/xz/Desktop/catkin_fastlio_slam/data/totalmap.pcd" # starts and ends with "/".
and you should also modify the lidar topic and imu topic.
roslaunch sfast_lio mapping_velodyne_relocalization.launch
rosbag play your-bag.bag
The rough initialization method is the same as LIO-SAM_based_relocalization,complete initialization matching of point clouds by specifying an initialization position and direction in rviz.
Sometimes rough initialization method may not be successful, so it is necessary to use accurate initialization method to do NDT Registration with a better initial value.
In order to provide a better matching initial value, I used a Python script to obtain keyboard input and continuously adjusted this matching initial value, ultimately successfully initializing it in the map. Providing accurate initial values can significantly increase the success rate of initialization.
Open a new terminal in the working directory and execute the following statement:
source devel/setup.bash
rosrun sfast_lio keyboard_catch_local.py
And then in this terminal you can press the corresponding button to adjust the matching initial value:(Here, I have only defined three degrees of freedom: x, y, and yaw. This applies to most initialization situations. If you feel it's not enough, I believe readers can easily make improvements according to the code)
keyboard input | meaning |
---|---|
w | Moving forward |
s | Moving backward |
a | Moving left |
d | Moving right |
q | rotate left |
e | rotate right |
j | increase rototation resolution |
w | reduce rototation resolution |
i | increase distance resolution |
k | reduce distance resolution |
f | finish, start register |
When you think the matching initial value you adjusted is good enough, you can press “f“ to do NDT Registration.
adjust the matching initial value initialization successful
The green pointcloud is the pointcloud you are adjusting. The red pointcloud is the matched pointcloud after NDT Registration. The yellow pointcloud is the local map.
in the config/velodyne_re.yaml
note:this code can provide two kind of odometry.
- "/Odometry_relocal",this is just local scan register to local map,so when IMU is not very stable and may drift,this odometry may stable.
- "/Odometry",this is the result of loose coupling between IMU recursive results and point cloud matching results.
The principle is very easy.After the pose is initialized, based on the forward propagation of IMU, when the point cloud is generated, it is registered with the local map, and the results of IMU and point cloud registration are updated through Bayesian rule. You can change some local map's params in the config/velodyne_re.yaml.
5.1 upload the pcd and bag for reader to run an example.
here is an example link example PCD and bag
5.2 record a video to show this code how to use.
here is an old video to show example
you'd better to see this new video to know how to use rough initialization and accurate initialization to finish initialization in a more effective way: new vedio
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。