0%

LeGO-LOAM速通

请先参阅此文安装相关依赖

1. 安装LeGO-LOAM

1
2
3
4
cd ~/catkin_ws/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin_make -j1

2. 编译建图

1
2
3
4
5
cd mapping
source devel/setup.bash
catkin_make -j1
roslaunch lego_loam run.launch
rosbag play yourbag.bag --clock

注:可能出现的一个错误,找不到libgtsam,需要从/usr/local/lib拷贝到/usr/lib

还可能出现的问题是,用的激光雷达是速腾的,需要修改下run.launchutility.h

可以参考这篇文章

啥时候我切系统再把文件copy放上来

  • run.launch
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
36
37
38
39
40
41
<launch>

<!--- Sim Time -->
<param name="/use_sim_time" value="true" />
<node pkg="nodelet" type="nodelet" name="pcl_manager" args="manager" output="screen" />

<!-- Run a passthrough filter to clean NaNs -->
<node pkg="nodelet" type="nodelet" name="passthrough" args="load pcl/PassThrough pcl_manager" output="screen">
<remap from="~input" to="/rslidar_points" />
<remap from="/passthrough/output" to="/velodyne_points" />

<rosparam>
filter_field_name: z
filter_limit_negative: True
</rosparam>

<rosparam>
filter_field_name: x
filter_limit_negative: True
</rosparam>

<rosparam>
filter_field_name: y
filter_limit_negative: True
</rosparam>
</node>

<!--- Run Rviz-->
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find lego_loam)/launch/test.rviz" />

<!--- TF -->
<node pkg="tf" type="static_transform_publisher" name="camera_init_to_map" args="0 0 0 1.570795 0 1.570795 /map /camera_init 10" />
<node pkg="tf" type="static_transform_publisher" name="base_link_to_camera" args="0 0 0 -1.570795 -1.570795 0 /camera /base_link 10" />

<!--- LeGO-LOAM -->
<node pkg="lego_loam" type="imageProjection" name="imageProjection" output="screen"/>
<node pkg="lego_loam" type="featureAssociation" name="featureAssociation" output="screen"/>
<node pkg="lego_loam" type="mapOptmization" name="mapOptmization" output="screen"/>
<node pkg="lego_loam" type="transformFusion" name="transformFusion" output="screen"/>

</launch>
  • utility.h
1
2
extern const string pointCloudTopic = "/velodyne_points";
extern const string imuTopic = "/imu/data";

3. 点云可视化

1
2
3
sudo apt-get install libpcl-dev
sudo apt-get install pcl-tools
pcl_viewer pcd_file.pcd
Have fun.