安装过程
0.安装依赖项:
首先确定你的Ubuntu所有东西都是新的
sudo apt-get update
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,先在home/moon目录下新建文件夹,命名为catkin,打开终端进入(cd)该文件的目录下,执行以下代码:
1. Git clone https://github.com/hitcm/ceres-solver-1.11.0.git
2.执行之后,打开catkin文件夹,可以看到名字为ceres-solver-1.11.0的文件夹,打开并新建文件夹build,在终端进入到该目录下(新建文件夹也可以在终端进行),执行以下指令:
cd ceres-solver-1.11.0/build
cmake ..
make
sudo make install
2.接着安装cartographer,在catkin_ws下新建文件夹,我的命名为cat,随后在终端进入该目录下,执行以下指令:
1. git clone https://github.com/hitcm/cartographer.git
2.同样的,执行结束后可以看到一个cartographer的文件夹,在里面新建build文件夹,并在终端进入该路径下:
cd cartographer/build
3.进入后,依次执行以下指令:
cmake ..
make
sudo make install
3.安装cartographer——ros
1.进入catkin_ws的src(自己新建)目录下,执行以下指令:
git clone https://github.com/hitcm/cartographer_ros.git
2.在catkin下执行指令:
catkin_make
4.数据下载测试,我的方法是用迅雷下载到本地再复制到Ubuntu:
由于数据包有8G的和4G,这里选了较小的,只是用来测试。
10.下载完成并复制到Ubuntu后,在终端执行指令:
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/cartographer_paper_deutsches_museum.bag
刚开始使用ROS的同学运行下面两句是无法工作的,可能出现的错误如下:
[demo_backpack_2d.launch] is neither a launch file in package [cartographer_ros] nor is [cartographer_ros] a launch file nameThe traceback for the exception was written to the log file
这种错误的主要原因是ros的catkin_ws配置问题,可以运行rospack profile试试。