运行 lio-sam 定位建图算法,error解决
运行 lio-sam 定位建图算法,error解决
运行:
source devel/setup.bash
roslaunch lio_sam run.launch
出现以下error:
[lio_sam_imuPreintegration-2] process has died [pid 5821, exit code 127, cmd /home/firefly/ccy/cd_code/mapping_ws/devel/lib/lio_sam/lio_sam_imuPreintegration __name:=lio_sam_imuPreintegration __log:=/home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195/lio_sam_imuPreintegration-2.log]. log file: /home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195/lio_sam_imuPreintegration-2*.log [lio_sam_mapOptmization-5] process has died [pid 5820, exit code 127,cmd /home/firefly/ccy/cd_code/mapping_ws/devel/lib/lio_sam/lio_sam_mapOptmization
__name:=lio_sam_mapOptmization __log:=/home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195 lio_sam_mapOptmization-5.log]. log file:/home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195/lio_sam_mapOptmization-5*.log
[lio_sam_imuPreintegration-2] process has died [pid 5823, exit code 127, cmd /home/firefly/ccy/cd_code/mapping_ws/devel/lib/lio_sam/lio_sam_imuPreintegration __name:=lio_sam_imuPreintegration __log:=/home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195/lio_sam_imuPreintegration-2.log]. log file:/home/firefly/.ros/log/7cd1f9c6-9ccc-11ef-b312-a243d775b195/lio_sam_imuPreintegration-2*.log
分析原因:
出现上述error的原因在于gtsam依赖库没正确安装或者版本号不对。匹配的gtsam版本号是gtsam-4.0.2。
解决方法:
(1)下载 gtsam-4.0.2;
(2)进入gtsam-4.0.2,依次运行以下命令:
mkdir build
cd build/
cmake …
sudo make install -j8
之后gtsam-4.0.2出现:
确保gtsam版本号正确的情况下,运行:
source devel/setup.bash
roslaunch lio_sam run.launch
之后如果还出现前述error,那么原因出在了:
**库文件libmetis.so 的位置。**它是一个运行时库,但是当应用程序查找它时,它的位置不在预期的目录中。在通过运行命令sudo make install -j8安装库gtsam 时,文件libmetis.so安装在/usr/local/lib/的默认位置,但是当启动 ros 工作区时,运行时库查看位置/opt/ros/noetic/
解决方法,运行如下文件:
cd /usr/local/lib/
sudo cp libmetis.so /opt/ros/noetic/lib/
按照前述方法后,重新打开终端,进入到工作空间内,运行:
source devel/setup.bash
roslaunch lio_sam run.launch
可以正常启动lio-sam算法。
lio-sam运行成功后,播放bag包:
rosbag play 2024-08-20-08-00-34.bag
bag包可以正常播放: