按照https://github.com/zoe4751/LIO-SAM 步骤生成点云地图,
地图存储可以参考我的上一篇博文:
作者构建地图使用LIO-SAM提到的数据集Park dataset:
利用构建的地图实现重定位功能,参考https://github.com/YJZLuckyBoy/liorf_localization
将配置文件localization.yaml更改为:
pointCloudTopic: "/points_raw" # Point cloud data imuTopic: "/imu_raw" odomTopic: "odometry/imu" # IMU pre-preintegration odometry, same frequency as IMU gpsTopic: "odometry/gpsz" # GPS odometry topic from navsat, see module_navsat.launch file # Frames lidarFrame: "base_link" baselinkFrame: "base_link" odometryFrame: "odom" mapFrame: "map" # GPS Settings useImuHeadingInitialization: true # if using GPS data, set to "true" useGpsElevation: false # if GPS elevation is bad, set to "false" gpsCovThreshold: 2.0 # m^2, threshold for using GPS data poseCovThreshold: 25.0 # m^2, threshold for using GPS data # Export settings savePCD: true # https://github.com/TixiaoShan/LIO-SAM/issues/3 savePCDDirectory: "/Downloads/LOAM/" sensor: velodyne # lidar sensor type, 'velodyne' or 'ouster' or 'livox' or 'robosense' N_SCAN: 16 # number of lidar channel (i.e., Velodyne/Ouster: 16, 32, 64, 128, Livox Horizon: 6) Horizon_SCAN: 1800 # lidar horizontal resolution (Velodyne:1800, Ouster:512,1024,2048, Livox Horizon: 4000) downsampleRate: 1 # default: 1. Downsample your data if too many points(line). i.e., 16 = 64 / 4, 16 = 16 / 1 point_filter_num: 3 # default: 3. Downsample your data if too many points(point). e.g., 16: 1, 32: 5, 64: 8 lidarMinRange: 1.0 # default: 1.0, minimum lidar range to be used lidarMaxRange: 1000.0 # default: 1000.0, maximum lidar range to be used # IMU Settings imuType: 1 # 0: 6-axis 1: 9-axis imuRate: 100.0 # lio-sam imuAccNoise: 3.9939570888238808e-03 imuGyrNoise: 1.5636343949698187e-03 imuAccBiasN: 6.4356659353532566e-05 imuGyrBiasN: 3.5640318696367613e-05 # # # MULRAN Datasets # imuAccNoise: 0.009939570888238808e-03 # imuGyrNoise: 0.005636343949698187e-03 # imuAccBiasN: 0.64356659353532566e-03 # imuGyrBiasN: 0.35640318696367613e-03 imuGravity: 9.80511 imuRPYWeight: 0.01 # Extrinsics: T_lb (lidar -> imu) extrinsicTrans: [0.0, 0.0, 0.0] extrinsicRot: [1, 0, 0, 0, 1, 0, 0, 0, -1] extrinsicRPY: [0, -1, 0, 1, 0, 0, 0, 0, 1] # # # mulran # # Extrinsics: T_lb (lidar -> imu) # extrinsicTrans: [0.0, 0.0, 0.0] # extrinsicRot: [-1, 0, 0, # 0, -1, 0, # 0, 0, 1] mappingSurfLeafSize: 0.4 # default: 0.4 - outdoor, 0.2 - indoor # robot motion constraint (in case you are using a 2D robot) z_tollerance: 1000 # meters rotation_tollerance: 1000 # radians # CPU Params numberOfCores: 4 # number of cores for mapping optimization mappingProcessInterval: 0.15 # seconds, regulate mapping frequency # Surrounding map surroundingkeyframeAddingDistThreshold: 1.0 # meters, regulate keyframe adding threshold surroundingkeyframeAddingAngleThreshold: 0.2 # radians, regulate keyframe adding threshold surroundingKeyframeDensity: 2.0 # meters, downsample surrounding keyframe poses surroundingKeyframeSearchRadius: 50.0 # meters, within n meters scan-to-map optimization (when loop closure disabled) surroundingKeyframeMapLeafSize: 0.3 # downsample local map point cloud # Loop closure loopClosureEnableFlag: true loopClosureFrequency: 1.0 surroundingKeyframeSize: 50 # submap size (when loop closure enabled) historyKeyframeSearchRadius: 15.0 historyKeyframeSearchTimeDiff: 30.0 historyKeyframeSearchNum: 25 loopClosureICPSurfLeafSize: 0.5 # downsample icp point cloud historyKeyframeFitnessScore: 0.3 # Visualization globalMapVisualizationSearchRadius: 1000.0 # meters, global map visualization radius globalMapVisualizationPoseDensity: 10.0 globalMapVisualizationLeafSize: 1.0
打开一个终端:
roslaunch liorf_localization run_localization.launch
另外一个终端运行数据集:
rosbag play park_dataset-001.bag
运行结果图,可以实现在载入的地图中完成重定位: