谷歌Cartographer安装

官方安装步骤一直没有成功

以下安装步骤参考hitcm的博客

需要安装3个软件包ceres-solver、cartographer和cartographer_ros。

0.安装所有依赖项

sudo apt-get install -y google-mock libboost-all-dev  libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev  libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx  ros-indigo-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

1.首先安装ceres solver,选择的版本是1.11,路径随意

git clone https://github.com/hitcm/ceres-solver-1.11.0.git

cd ceres-solver-1.11.0

mkdir build

cd build

cmake ..

make -j4

sudo make install

2.然后安装 cartographer,路径随意

git clone https://github.com/hitcm/cartographer.git

cd cartographer

mkdir build

cd build

cmake .. -G Ninja

ninja

ninja test

sudo ninja install 

3.安装cartographer_ros。

谷歌官方提供的安装方法比较繁琐,对原来的文件进行了少许的修改,核心代码不变,只是修改了编译文件

#初始化工作空间
mkdir -p ~/catkin_google_ws/src

cd ~/catkin_google_ws/src

catkin_init_workspace

cd ..

catkin_make

echo "source ~/catkin_google_ws/devel/setup.bash" >> ~/.bashrc

source ~/.bashrc

#安装cartographer_ros

cd ~/catkin_google_ws/src

git clone https://github.com/hitcm/cartographer_ros.git

cd ~/catkin_google_ws

catkin_make

4.数据下载测试
2d数据

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag

3d数据

wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/cartographer_3d_deutsches_museum.bag

运行launch文件

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/cartographer_3d_deutsches_museum.bag

刚开始使用ROS的同学运行下面两句是无法工作的,可能出现的错误如下。

[demo_backpack_2d.launch] is neither a launch file in package [cartographer_ros] nor is [cartographer_ros] a launch file name
The traceback for the exception was written to the log file

这种错误的主要原因是ros的catkin_google_ws配置问题,可以运行rospack profile试试。

实在不行还有如下所示的两种解决方法。推荐第二种。
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值