实验室小车跑开源LIO_SAM激光SLAM算法流程(IMU,雷达等串口配置)

目录

1. IMU设置

2.雷达设置

3.修改配置

4.启动4个launch文件

imu节点

LIDAR节点

LIDAR数据转换节点

LIO_SAM节点

5.最终建图效果

6.推测漂移的原因

7.相关报错

一.imu_tk标定时出现的错误(一大堆错误,类似语法问题)


1. IMU设置

开源标定包标定imu,标定结果修改配置文件

ros读imu数据_好人cc的博客-CSDN博客_ros如何读取imu数据

2.雷达设置

rs雷达串口绑定,开启节点后收发数据正常即可

rs-lidar-16电脑运行过程_好人cc的博客-CSDN博客

3.修改配置

雷达转换,相关配置文件修改

lio_sam:

  # Topics
  pointCloudTopic: "velodyne_points"               # Point cloud data
  imuTopic: "imu/data_open"                         # IMU data
  odomTopic: "odometry/imu"                   # IMU pre-preintegration odometry, same frequency as IMU
# gpsTopic: "odometry/gpsz"                   # GPS odometry topic from navsat, see module_navsat.launch file
 # gpsTopic: "imu/nav"                #   imu/nav

  # Frames
  lidarFrame: "base_link"
  baselinkFrame: "base_link"
  odometryFrame: "odom"
  mapFrame: "map"

  # GPS Settings
  useImuHeadingInitialization: false          # 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: false                              # https://github.com/TixiaoShan/LIO-SAM/issues/3
  savePCDDirectory: "/home/zhaopujun/catkin_ws"        # in your home folder, starts and ends with "/". Warning: the code deletes "LOAM" folder then recreates it. See "mapOptimization" for implementation

  # Sensor Settings
  sensor: velodyne                            # lidar sensor type, 'velodyne' or 'ouster' or 'livox'
  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. i.e., 16 = 64 / 4, 16 = 16 / 1
  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

#imuAccNoise: 1.0151327754116719e-02
# imuGyrNoise: 4.9553027388650394e-03
#imuAccBiasN: 7.4655794718659740e-04
#imuGyrBiasN: 6.3727249626266877e-05
#imuGravity: 9.8035
# imuRPYWeight: 0.01

  imuAccNoise: 7.5236637366758383e-03
  imuGyrNoise: 1.4514722960755217e-04
  imuAccBiasN: 1.9784527286040426e-04
  imuGyrBiasN: 8.7450530768693497e-07
  imuGravity: 9.8035
  imuRPYWeight: 0.01

# Extrinsics: T_lb (lidar -> IMU) #############imu-----IMU
  extrinsicTrans: [0.0, 0.0, 0.0]  #[-0.025, -0.07, -0.245]
  extrinsicRot: [0.974229, 0.225117,-0.0141541,     ###################################重新弄
               -0.225, 0.974313, 0.00939782,
                0.0159061, -0.00597096, 0.999856]
###################################    lidar imu联合标定后的结果
###################################    [0.329847, 0.186982, -0.925332,    
 ###################################   -0.242434, -0.930538, -0.274452,
 ###################################   -0.912374, 0.314859, -0.261604]

  extrinsicRPY: [0.974229, 0.225117,-0.0141541,     ###################################重新弄
                -0.225, 0.974313, 0.00939782,
                0.0159061, -0.00597096, 0.999856]
#  extrinsicRot: [1, 0, 0,
#                 0, 1, 0,
#                 0, 0, 1]
#  extrinsicRPY: [1, 0, 0,
#                 0, 1, 0,
#                 0, 0, 1]

  # LOAM feature threshold
  edgeThreshold: 1.0
  surfThreshold: 0.1
  edgeFeatureMinValidNum: 10
  surfFeatureMinValidNum: 100

  # voxel filter paprams
  odometrySurfLeafSize: 0.2                     # default: 0.4 - outdoor, 0.2 - indoor
  mappingCornerLeafSize: 0.1                    # default: 0.2 - outdoor, 0.1 - indoor
  mappingSurfLeafSize: 0.2                      # 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)

  # Loop closure
  loopClosureEnableFlag: true
  loopClosureFrequency: 1.0                     # Hz, regulate loop closure constraint add frequency
  surroundingKeyframeSize: 50                   # submap size (when loop closure enabled)
  historyKeyframeSearchRadius: 15.0             # meters, key frame that is within n meters from current pose will be considerd for loop closure
  historyKeyframeSearchTimeDiff: 30.0           # seconds, key frame that is n seconds older will be considered for loop closure
  historyKeyframeSearchNum: 25                  # number of hostory key frames will be fused into a submap for loop closure
  historyKeyframeFitnessScore: 0.3              # icp threshold, the smaller the better alignment

  # Visualization
  globalMapVisualizationSearchRadius: 1000.0    # meters, global map visualization radius
  globalMapVisualizationPoseDensity: 10.0       # meters, global map visualization keyframe density
  globalMapVisualizationLeafSize: 1.0           # meters, global map visualization cloud density




# Navsat (convert GPS coordinates to Cartesian)
navsat:
  frequency: 50
  wait_for_datum: false
  delay: 0.0
  magnetic_declination_radians: 0
  yaw_offset: 0
  zero_altitude: true
  broadcast_utm_transform: false
  broadcast_utm_transform_as_parent_frame: false
  publish_filtered_gps: false

# EKF for Navsat
ekf_gps:
  publish_tf: false
  map_frame: map
  odom_frame: odom
  base_link_frame: base_link
  world_frame: odom

  frequency: 50
  two_d_mode: false
  sensor_timeout: 0.01
  # -------------------------------------
  # External IMU:
  # -------------------------------------
  imu0: imu_correct
  # make sure the input is aligned with ROS REP105. "imu_correct" is manually transformed by myself. EKF can also transform the data using tf between your imu and base_link
  imu0_config: [false, false, false,
                true,  true,  true,
                false, false, false,
                false, false, true,
                true,  true,  true]
  imu0_differential: false
  imu0_queue_size: 50 
  imu0_remove_gravitational_acceleration: true
  # -------------------------------------
  # Odometry (From Navsat):
  # -------------------------------------
  odom0: odometry/gps
  odom0_config: [true,  true,  true,
                 false, false, false,
                 false, false, false,
                 false, false, false,
                 false, false, false]
  odom0_differential: false
  odom0_queue_size: 10

  #                            x     y     z     r     p     y   x_dot  y_dot  z_dot  r_dot p_dot y_dot x_ddot y_ddot z_ddot
  process_noise_covariance: [  1.0,  0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    1.0,  0,    0,    0,    0,    0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    10.0, 0,    0,    0,    0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0.03, 0,    0,    0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0.03, 0,    0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0.1,  0,     0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0.25,  0,     0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0.25,  0,     0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0.04,  0,    0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0.01, 0,    0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0.01, 0,    0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0.5,  0,    0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,    0.01, 0,      0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,    0,    0.01,   0,
                               0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,    0,    0,      0.015]

用rs_lidar雷达跑lio_sam_好人cc的博客-CSDN博客

4.启动4个launch文件

imu节点

roslaunch openzen_sensor openzen_lpms_ig1.launch 

LIDAR节点

 roslaunch rslidar_sdk start.launch 

LIDAR数据转换节点

roslaunch rs_to_velodyne rs2v.launch 

LIO_SAM节点

roslaunch lio_sam run.launch 

5.最终建图效果

最终建图还是会产生漂移

6.推测漂移的原因:

1.imu标定误差较大

2.GPS未使用,无法校正累计漂移

3.特征点较少的场景会出现退化导致漂移

相关报错:

一.imu_tk标定时出现的错误(一大堆错误,类似语法问题)

原因:ceres_slover的版本过高

解决:

1 删除ceres库,头文件和lib中

sudo rm -rf /usr/local/include/ceres 
sudo rm -rf /usr/local/lib/libceres.a

2 安装较低版本库1.14.0

参考:反复踩坑的ceres安装-----ubuntu18.04_小猫咪朴素的生存智慧的博客-CSDN博客_ceres ubuntu

Ubuntu18.04安装Ceres,图文详解_振华OPPO的博客-CSDN博客_ceres安装

3 安装后还有其他问题   /usr/bin/ld: 找不到 -l.......

参考:

ubuntu Make时,“/usr/bin/ld: 找不到 -lXXX”问题的解决方法_highoooo的博客-CSDN博客_/usr/bin/ld

猜你喜欢

转载自blog.csdn.net/weixin_68647501/article/details/127857239