1、下载lidar_align源码
ethz-asl/lidar_align: A simple method for finding the extrinsic calibration between a 3D lidar and a 6-dof pose sensor (github.com)https://github.com/ethz-asl/lidar_align2、解压到ros工作空间目录下的src文件中
不知道如何创建ros工作空间的可以参考我另一篇博客:
3、编译
1
2
3sudo apt-get install libnlopt-dev cd ~/catkin_ws catkin_make
此时编译可能会遇到一些问题,比如:
CNake Error at /usr /share/cnake-3.10/Nodules/FindPackageHandlestandardArgs.cmake:137 (nessage);could NOT find NLOPT (missing: NLOPT_INCLUDE_DIR NLOPT_LIBRARY)
Call stack (most recent call first):
/usr/share/cnake-3.10/NModules/FindPackageHandleStandardArgs.cnake:378(_FPHSA_FAILURENLOPTConfig.cmake:65 (find_package_handle_standard_args)
CMakeLists.txt: 18 (find_package)
-- Configuring incomplete, errors occurred!
see also "/home/findlab/lidar_align-naster/build /CMakeFiles/CNakeoutput.log".See also "/hone /findlab/lidar_align-naster/build/CMakeFiles/CNakeError.log".
解决办法:
在lidar_align-master文件夹中的CMakeLists.txt添加以下代码:
1
2list(APPEND CMAKE_FIND_ROOT_PATH ${PROJECT_SOURCE_DIR}) set (CMAKE_PREFIX_PATH "/usr/local/lib/cmake/nlopt")
最后应该就编译成功了,如果还遇到编译问题,可以参考一下我另一篇博客,里面总结了几个可能遇到的问题解决办法:
1
2
3
4roscore source devel/setup.bash roslaunch lidar_align lidar_align.launch
此时可能会遇到一些问题
问题1:
解决办法:
修改launch文件,改为自己的bag路径
问题2:
解决办法:
修改loader.cpp文件
将以下代码放到该文件的对应位置,并将odom的代码删除或注释掉
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36std::vector<std::string> types; types.push_back(std::string("sensor_msgs/Imu")); rosbag::View view(bag, rosbag::TypeQuery(types)); size_t imu_num = 0; double shiftX=0,shiftY=0,shiftZ=0,velX=0,velY=0,velZ=0; ros::Time time; double timeDiff,lastShiftX,lastShiftY,lastShiftZ; for (const rosbag::MessageInstance& m : view){ std::cout <<"Loading imu: e[1m"<< imu_num++<<"e[0m from ros bag"<<'r'<< std::flush; sensor_msgs::Imu imu=*(m.instantiate<sensor_msgs::Imu>()); Timestamp stamp = imu.header.stamp.sec * 1000000ll +imu.header.stamp.nsec / 1000ll; if(imu_num==1){ time=imu.header.stamp; Transform T(Transform::Translation(0,0,0),Transform::Rotation(1,0,0,0)); odom->addTransformData(stamp, T); } else{ timeDiff=(imu.header.stamp-time).toSec(); time=imu.header.stamp; velX=velX+imu.linear_acceleration.x*timeDiff; velY=velX+imu.linear_acceleration.y*timeDiff; velZ=velZ+(imu.linear_acceleration.z-9.801)*timeDiff; lastShiftX=shiftX; lastShiftY=shiftY; lastShiftZ=shiftZ; shiftX=lastShiftX+velX*timeDiff+imu.linear_acceleration.x*timeDiff*timeDiff/2; shiftY=lastShiftY+velY*timeDiff+imu.linear_acceleration.y*timeDiff*timeDiff/2; shiftZ=lastShiftZ+velZ*timeDiff+(imu.linear_acceleration.z-9.801)*timeDiff*timeDiff/2; Transform T(Transform::Translation(shiftX,shiftY,shiftZ), Transform::Rotation(imu.orientation.w, imu.orientation.x, imu.orientation.y, imu.orientation.z)); odom->addTransformData(stamp, T); } }
问题3:
解决办法:
在loader.h头文件中定义Imu消息即可
1#include <sensor_msgs/Imu.h>
然后再重新编译catkin_make
此时应该编译没问题了
再执行roslaunch lidar_align lidar_align.launch
可能还会再次遇到问题
原因是点云序列号超出范围
解决办法:在sensor.h头文件中将keep_points_ratio的默认值0.01改小,比如改成0.001.
最终成功标定了
最终的标定结果文件存放在lidar_align目录下的results文件夹中
最后
以上就是典雅月饼最近收集整理的关于使用lidar_align进行激光雷达与IMU的外参标定(超详细教程)的全部内容,更多相关使用lidar_align进行激光雷达与IMU内容请搜索靠谱客的其他文章。
发表评论 取消回复