安装依赖
- ros
- gtsam
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
安装
cd ~/test_ws/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin_make -j1
如果你的工作空间中含有多个package包,并且你只想编译LeGO功能包,可以执行下面命令:
cd ~/test_ws/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin_make -DCATKIN_WHITELIST_PACKAGES="cloud_msgs"
catkin_make -DCATKIN_WHITELIST_PACKAGES="lego_loam"
VLP16 bag测试
cd ~/test_ws
source ./devel/setup.bash
roslaunch lego_loam run.launch
cd ~/test_bag
rosbag play indoor_2021-03-30-15-27-23.bag --clock --topic /velodyne_points /imu/data
其中 run.launch 内容如下:
<launch>
<!--- Sim Time -->
<param name="/use_sim_time" value="true" />
<!--- 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>
如果觉得启动两个终端比较麻烦,可以将bag包命令也写入launch文件中,执行下面命令即可:
cd ~/test_ws
source ./devel/setup.bash
roslaunch lego_loam run_VLP16_bag.launch
run_VLP16_bag.launch 内容如下:
<launch>
<!--- Sim Time -->
<param name="/use_sim_time" value="true" />
<node pkg="rosbag" type="play" name="rosbag_play" args="--clock -r 0.5 $(env HOME)/test_bag/indoor_2021-03-30-15-27-23.bag"/>
<!--- 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>
测试视频
lego_loam
问题解决
问题1
如若在运行 roslaunch lego_loam run.launch 时,出现: yourbag_ws/devel/lib/lego_loam/mapOptmization: error while loading shared libraries: libmetis.so: cannot open shared object file: No such file or directory
解决1
sudo apt-get install libmetis-dev
关键记录
介绍