激光雷达和IMU联合标定并运⾏LIOSAM
激光雷达和IMU联合标定并运⾏LIOSAM
激光雷达和IMU(我⽤的是Velodyne和xn传感器)标定这块我尝试了许多⽅法,钻研了好⼏天包括:
(1)浙江⼤学开源的⽅案。
(2)通过我之前对激光雷达和相机联合标定得到的变换矩阵和相机与IMU联合标定得到的变换矩阵相乘
(3)lidar-align(⾥⾯代码需要⾃⼰改写)
但是最后还是通过lidar-align标定成功了,并且将获得参数⽤到LIOSAM中(通过⾃⼰录制数据集跑出效果)。下⾯我⼀⼀介绍我标定过程中遇到的问题,希望对你有帮助。
1.浙江⼤学开源的⽅案
rosbag record -O velo_xns.bag /imu/data /velodyne_packets
然后在⼜按github的⽅法运⾏了⼀下,果不其然,终于出现标定框了,效果如下。
然后点击了初始化(Initialization)及下⾯的三个按钮,后续就⼀直是点击下⾯的按钮。
remove什么意思
问题⼆:并不知道⾃⼰得到的标定⽂件是不是对的。
上⾯点击过程持续了好久好久,我看终端⾥显⽰迭代了20多次,于是我ctrl+c关闭了,最后⽂件保存到你设置的路径下。⽂件如图:
然后我问了下师兄,师兄说这应该是的,因为它给出了四元数,于是⾃⼰写了个代码将四元数转换为旋转矩阵。感觉⾃⼰要成功了。。。最后将得出的矩阵放⼊了LIOSAM的param.yaml⽂件⾥。可惜根本就是飘的。如图:
后⾯还继续⽤这个⽅法重新录制数据集,重新标定,到最后依然飘,⽬前还不知道问题出在哪⾥,如果知道的欢迎在下⽅评论。
2.⽤之前标定的⼯作
之前我表定过雷达和相机,以及相机和IMU。于是想通过直接将它们之间的变换矩阵相乘就可以得到雷达到IMU的外参了(道理是这样的)。于是⾃⼰写了个变换代码,代码如下:
#include<Eigen/Core>
#include<Eigen/Den>
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace Eigen;
using namespace std;
using namespace cv;
int main(int argc, char **argv)
{
Matrix<double,4,4> camera2lidar;
camera2lidar<<2.4179517096019842e-01,-1.9642514858819676e-01,
9.5023799982027335e-01,-1.7757374048233032e-01,
-9.6988254863381052e-01,-7.8571928659428691e-02,
2.3055215002754242e-01,
3.9515018463134766e-02,
2.9375792004868617e-02,-9.7736564960553163e-01,
whetherornot
-2.0950763665137412e-01,1.1383673548698425e-01,0.000000,0.0000000,0.000000,1.000000;
Matrix<double,4,4> lidar2camera=camera2lidar.inver();
Matrix<double,4,4> imu2camera;
imu2camera<<-0.3461823,-0.9118556,0.22062904,0.00098007,
0.77577957,-0.41047747,-0.47924347,0.00315419,
0.5275641,0.00525389,0.84949898,0.00117689,
纸牌屋第3季0.0000000,0.00000000,0.00000000,1.00000000;
// Matrix<double, 4, 4> imu2camera=camera2imu.inver();
Matrix<double,4,4> imu2lidar=imu2camera*lidar2camera;
// Matrix<double, 4, 4> lidar2imu=imu2lidar.inver();
cout<<"imu_lidar_result:["<<imu2lidar<<"]"<<endl;
// cout<<"lidar_imu_result:["<<lidar2imu<<"]"<<endl;
return0;
}
<代码如下:
cmake_minimum_required(VERSION2.8)
project(produceYAML)
t(OpenCV_DIR "/usr/local/include/opencv")
find_package(OpenCV 3.4.3REQUIRED)
include_directories(${/usr/local/include/opencv})
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})
add_executable(lidar-imu lidar-imu)
target_link_libraries(lidar-imu ${OpenCV_LIBS})
link_directories(${OpenCV_LIBRARY_DIRS})
halloween的音标
最后将得到的变换矩阵放⼊到LIOSAM的param.yaml⽂件⾥。但是没有成功,还是飘的!!于是我对矩阵求逆,尝试了2*2=4的所有可能,最后还是没成功!!(浪费了好多时间)。于是这个⽅法也就到此为⽌了。
3.lidar-align标定
list(APPEND CMAKE_FIND_ROOT_PATH ${PROJECT_SOURCE_DIR})
t(CMAKE_PREFIX_PATH"/usr/local/lib/cmake/nlopt")
如图:
礼物英语问题解决!编译成功!
然后就是需要在lidar_align.launch⽂件⾥改成你⾃⼰录制的数据包(⾥⾯包含话题/velodyne_points和/imu/data)的路径。
然后在⼯程⽬录下打开终端输⼊
source devel/tup.bash
roslaunch lidar_align lidar_align.launch
4.运⾏LIOSAM
编译好就可以运⾏数据集了,运⾏官⽹数据集的时候不需要改写param.yaml。注意:如果运⾏⾃⼰的数据集必须使⽤的是9轴IMU!不能是6轴的!之前我就⽤zed2⾥⾃带的IMU来运⾏,发现出现如下错误:
所以⼀定是9轴IMU才可以。
然后需要在⾥⾯修改你录制的话题、IMU的内参、IMU到雷达的外参以及PCD存放路径。代码如下(这是我⾃⼰的数据哦):
lio_sam:
# Topics
# pointCloudTopic:"points_raw" # Point cloud data
pointCloudTopic:"velodyne_points"
imuTopic:"imu/data" # IMU data
# imuTopic:"imu_correct"
株洲美容odomTopic:"odometry/imu" # IMU pre-preintegration odometry, same frequency as IMU
gpsTopic:"odometry/gpsz" # GPS odometry topic from navsat, e module_navsat.launch file
# Frames
lidarFrame:"ba_link"
lidarFrame:"ba_link"
balinkFrame:"ba_link"
odometryFrame:"odom"
mapFrame:"map"
# GPS Settings
# uImuHeadingInitialization:true # if using GPS data,t to "true"
uImuHeadingInitialization:fal
uGpsElevation:fal # if GPS elevation is bad,t to "fal"
gpsCovThreshold:2.0 # m^2, threshold for using GPS data
poCovThreshold:25.0 # m^2, threshold for using GPS data
# Export ttings
# savePCD:fal # /TixiaoShan/LIO-SAM/issues/3普特英语听力论坛
savePCD:true
savePCDDirectory:"/datat/LIO-SAM/xns_velodyne" # in your home folder, starts and ends with"/". Warning: the code deletes "LOAM" folder the n recreates it. See "mapOptimization"for implementation
雅思口语话题# Sensor Settings
nsor: velodyne # lidar nsor type, either 'velodyne' or 'ouster'
N_SCAN:16 # number of lidar ,16,32,64,128)
Horizon_SCAN:1800 # lidar horizontal resolution(Velodyne:1800, Ouster:512,1024,2048)
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 ud
lidarMaxRange:1000.0 # default:1000.0, maximum lidar range to be ud
#IMU Settings
imuAccNoi:9.7816033475532395e-03
imuGyrNoi:1.9958347084630267e-03
imuAccBiasN:8.4485975927320214e-05
imuGyrBiasN:2.5139562639019187e-05
imuGravity:9.80511
imuRPYWeight:0.01
# imuAccNoi:1.9238237446574064e-02
# imuGyrNoi:1.5385754496033436e-03
# imuAccBiasN:4.9615115224550062e-04
# imuGyrBiasN:5.0721205121154150e-06
# imuGravity:9.80511
# imuRPYWeight:0.01
# Extrinsics(lidar ->IMU)
extrinsicTrans:[-0.00201536,0.00144471,-0.00145396]
# extrinsicTrans:[0.0,0.0,0.0]
# extrinsicRot:[-1,0,0,
# 0,1,0,
# 0,0,-1]
mt什么意思
# extrinsicRPY:[0,1,0,
# -1,0,0,
# 0,0,1]
# extrinsicRot:[1,0,0,
# 0,1,0,
# 0,0,1]
# extrinsicRPY:[1,0,0,
# 0,1,0,
# 0,0,1]
extrinsicRot:[-0.295055,-0.562411,0.772423,
-0.438059,-0.638821,-0.632466,
0.849145,-0.524979,-0.0578822]
extrinsicRPY:[-0.295055,-0.562411,0.772423,
-0.438059,-0.638821,-0.632466,
汉堡包的英语怎么写
0.849145,-0.524979,-0.0578822]
# LOAM feature threshold
edgeThreshold:1.0
surfThreshold:0.1