Ubuntu-20.04-noetic安装cartographer100%成功

1.安装工具我wstool,nijia,rosdep


sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow

sudo apt-get update 时候报错
E: 无法获得锁 /var/lib/apt/lists/lock。锁正由进程 1335(packagekitd)持有 N: 请注意,直接移除锁文件不一定是合适的解决方案,且可能损坏您的系统。 E: 无法对目录 /var/lib/apt/lists/ 加锁
解决方法:

sudo rm /var/lib/apt/lists/lock

2.加Google服务器域名提高下载速度

sudo gedit /etc/resolv.conf

Ubuntu-20.04-noetic安装cartographer100%成功_第1张图片

nameserver 8.8.8.8 
nameserver 8.8.4.4 

Ubuntu-20.04-noetic安装cartographer100%成功_第2张图片
注意:安装完了 及时改回来否则会影响你上网
3.打开终端ctrl+alt+t创建工作空间

mkdir cartographer_ws

4.下载三个pkg,cartographer,cartographer_ros,ceres-slover,

cd cartographer_ws
wstool init src
cd src
git clone https://github.com/googlecartographer/cartographer_ros.git
git clone https://github.com/googlecartographer/cartographer.git
git clone https://github.com/ceres-solver/ceres-solver.git

样式
Ubuntu-20.04-noetic安装cartographer100%成功_第3张图片
5.安装依赖

cd cartographer_ws
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
src/cartographer/scripts/install_abseil.sh
sudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp

6.编译

catkin_make_isolated --install --use-ninja

7.跑demo
首先下载数据集bag
数据2D,3D下载链接
我是在windows系统中下载下载完
在Ubuntu中建立个文件夹拖进去
打开终端ctrl+ail+t

cd cartographer_ws

刷新一下环境变量

source install_isolated/setup.bash

2D的

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=//你的数据的路径

3D的换成roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=即可
数据路径的获取
在放数据的文件夹中右键在终端中打开

pwd

得到一个路径
这还的加上你的数据的名字包括.bag
F:
/home/znp/bags_data/b3-2016-04-05-15-51-36.bag
感谢大佬的文章:https://blog.csdn.net/yqziqian2/article/details/118100338?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163419019816780357254630%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=163419019816780357254630&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2alltop_positive~default-1-118100338.first_rank_v2_pc_rank_v29&utm_term=ubuntu20.04%E5%AE%89%E8%A3%85cartographer&spm=1018.2226.3001.4187

你可能感兴趣的:(ubuntu,自动驾驶)