一、代碼連接
代碼下載連接:
YibinWu/LIO-EKF: Maybe the simplest LiDAR-inertial odometry that one can have. (github.com)
編譯步驟:
- cd src
- git clone git@github.com:YibinWu/LIO-EKF.git
- catkin_make
- source devel/setup.bash
運行步驟:
Replace the path to the rosbag (bagfile) in the launch files with your own path.
- roslaunch lio_ekf urbanNav20210517.launch?
- roslaunch lio_ekf street_01.launch
- roslaunch lio_ekf short_exp.launch?
運行結果如下:
三、問題及其解決方案
問題1:成功編譯,運行roslaunch lio_ekf urbanNav20210517.launch ,rviz沒有軌跡出來,檢查topic都沒有問題。
解決:把topic在代碼中修改即可,修改代碼地方如下圖:
或
config文件中的 lid_topic 修改成 lidar_topic
四、跑通mid360設備采集的數據
4.1 啟動mid360的SDK驅動
具體連接:全網最詳細的 Ubuntu 18.04 安裝Livox mid-360驅動,測試 fast_lio2_ubuntu mid360 fastlio-CSDN博客
- cd Livox-SDK2_ROS_driver
- source devel/setup.bash
- roslaunch livox_ros_driver2 rviz_MID360.launch?? //一定運行這個launch
4.2 修改LIO-EKF代碼
把IMU數據中的加速度乘以9.8,因為mid360采集IMU數據時,加速度的單位是g,角速度的單位是rad/s.
4.3 增加并修改mid360.yaml的配置文件
內容如下:
common:lidar_topic: "/livox/lidar" imu_topic: "/livox/imu" lidar:deskew: truepreprocess: truemax_range: 100.0 min_range: 5.0max_points_per_voxel: 20voxel_size: 1max_iteration: 1# imu: # # IMU noise parameters # arw: [1087, 1087, 1087] # [deg/sqrt(hr)] 1087, 1087, 1087 # vrw: [18.9, 18.9, 18.9] # [m/s/sqrt(hr)] 18.9, 18.9, 18.9 # gbstd: [2063.0, 2063.0, 2063.0] # [deg/hr] 2063.0, 2063.0, 2063.0 # abstd: [1000.0, 1000.0, 1000.0] # [mGal] 1000.0, 1000.0, 1000.0 # corrtime: 1.0 # [hr] imu:# IMU noise parametersarw: [2, 2, 2] # [deg/sqrt(hr)]vrw: [4, 4, 4] # [m/s/sqrt(hr)]gbstd: [20.0, 20.0, 20.0] # [deg/hr]abstd: [500.0, 500.0, 500.0] # [mGal]corrtime: 1.0 # [hr]lio:# initial position std, north, east and down in n-frame. [m, m, m]initposstd: [ 0.05, 0.05, 0.05 ]# initial velocity std, north, east and down speed in n-frame. [m/s, m/s, m/s]initvelstd: [ 0.05, 0.05, 0.05 ]# initial attitude std, roll, pitch and yaw std. [deg, deg, deg]initattstd: [ 0.1, 0.1, 0.1 ]extrinsic_T: [-0.011, -0.02329, 0.04412]extrinsic_R: [ 1, 0, 0, 0, 1, 0, 0, 0, 1]#transform the imu frame to front-right-down (which is used in the code)#換成自己的設備,這個參數需要改一下。mid360: 前左上,對應的imu_tran_R如下:imu_tran_R: [1,0,0,0,-1,0,0,0,-1]
4.4? 增加并修改Mid_360.launch的配置文件
內容如下:
<?xml version="1.0"?> <launch><rosparam command="load" file="$(find lio_ekf)/config/mid360_lioekf.yaml" /><!-- ROS paramaters --><arg name="visualize" default="true"/><arg name="odom_frame" default="odom"/><param name="outputdir" type="string" value="$(find lio_ekf)/output/" /><!-- Odometry node --><node pkg="lio_ekf" type="lio_ekf_node" name="lio_ekf_node" output="screen"/><!-- Visualizer --><group if="$(arg visualize)"><node pkg="rviz" type="rviz" name="rviz" args="-d $(find lio_ekf)/rviz/lio_ekf.rviz"/></group></launch>
4.5 運行代碼?
- cd ~/VIns_Code/Lidar_IMU/LIO_EKF
- catkin_make
- source devel/setup.bash
- roslaunch lio_ekf Mid_360.launch
結果如下:
注意:配置文件中的IMU參數有待進一步優化