一、代码连接
代码下载连接:
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参数有待进一步优化