运行环境
wget -O ~/Downloads/gtsam.zip https://github.com/borglab/gtsam/archive/4.0.0-alpha2.zip
cd ~/Downloads/ && unzip gtsam.zip -d ~/Downloads/
cd ~/Downloads/gtsam-4.0.0-alpha2/
mkdir build && cd build
cmake ..
sudo make install
mkdir catkin_ws
cd catkin_ws
mkdir src
catkin_make
cd src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin_make -j1
根据GitHub上面的测试集进行相对应的测试
source ~/devel/setup.bash
roslaunch lego_loam run.launch
rosbag play *.bag --clock --topic /velodyne_points /imu/data
https://github.com/RoboSense-LiDAR/rslidar_sdk/releases
根据官网的介绍,下载 rslidar_sdk.tar.gz
压缩包
打开工作空间进入src文件夹下将下面的文件解压到此处,先不要编译
安装pcap
和Yaml
:
sudo apt-get install -y libpcap-dev
sudo apt-get install -y libyaml-cpp-dev #若已安装ROS desktop-full, 可跳过
(1) 将文件顶部的set(COMPILE_METHOD ORIGINAL)
改为set(COMPILE_METHOD CATKIN)
(2) 将set(POINT_TYPE XYZI)
改为set(POINT_TYPE XYZIRT)
(3) 将rslidar_sdk工程目录下的package_ros1.xml
文件重命名为package.xml
rslidar_sdk
只有一份参数文件 config.yaml
, 储存于rslidar_sdk/config
文件夹内。打开此文件,找到以下部分:
idar:
- driver:
//此处修改激光雷达型号
lidar_type: RS128
frame_id: /rslidar
msop_port: 6699
difop_port: 7788
start_angle: 0
end_angle: 360
min_distance: 0.2
max_distance: 200
use_lidar_clock: false
激光雷达型号默认RS128,修改为自己的激光雷达型号即可
不修改则会报错,并且读取不到激光扫描参数:
lidar:
- driver:
lidar_type: RS16 #LiDAR type - RS16, RS32, RSBP, RS128, RS80, RSM1, RSHELIOS
frame_id: /rslidar #Frame id of message
msop_port: 6699 #Msop port of lidar
difop_port: 7788 #Difop port of lidar
start_angle: 0 #Start angle of point cloud
end_angle: 360 #End angle of point cloud
min_distance: 0.2 #Minimum distance of point cloud
max_distance: 200 #Maximum distance of point cloud
use_lidar_clock: false #True--Use the lidar clock as the message timestamp
#False-- Use the system clock as the timestamp
cd ~/catkin_ws/src
git clone https://github.com/HViktorTsoi/rs_to_velodyne.git
cd ../
catkin_make
修改LeGO-LOAM的launch文件:
将这句话的true
改成false
<param name="/use_sim_time" value="false"/>
rs_to_velodyne
节点(这里要注意LeGO-LOAM需要的雷达点云是XYZIR
格式的,话题还是velodyne_points)catkin_make
source devel/setup.bash
roslaunch rslidar_sdk start.launch
rosrun rs_to_velodyne rs_tovelodyne XYZIRT XYZIR
roslaunch lego_loam run.launch
其中
rosrun rs_to_velodyne rs_to_velodyne XYZIRT XYZIR
这个节点启动,可以该写成下面的launch文件进行启动。
在与src并列的位置新建launch文件夹,在launch文件夹内新建XX.launch文件用来启动节点,并在launch内写入如下。其中args="XYZIRT XYZIR"
是Main函数的输入参数:XYZIRT、XYZIR,使用空格隔开参数。<launch> <node pkg="rs_to_velodyne" name="rs_to_velodyne" type="rs_to_velodyne" args="XYZIRT XYZIR" output="screen"> node> launch>
遇到的问题:[mapOptmization-7] process has died
原因:可能是libmetis 库没有安装,安装libparmetis-dev可以解决
解决方法:
sudo apt-get update
sudo apt-get install libparmetis-dev
使用参考链接2方法遇到的问题
遇到的问题:[ERROR] [1638358942.333987429]: Point cloud is not in dense format, please remove NaN points first!
解决方法:
找到utility.h
将useCloudRIng
设置为false
并重新编译
暂未解决,使用其它方法直接对速腾的雷达数据进行转换时遇到的问题
遇到的问题:[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!
原因: