ubuntu16.04 + ros-kinetic 配置cartographer

其实一直以来都感觉纯视觉SLAM很难落地产品,所以一直在找机会学习激光slam,之前也在深蓝学院上买了一个激光salm的课程,惭愧,至今也没开始学呢,年底之前,我想工作之余研究一下激光slam和ros,我感觉这两个东西对我来说很重要,所以这两天先抽时间把google的cartographer工程配置了一下,期间也遇到了一些问题,不过我逐一解决,最终配置成功。接下来就开始研究激光slam技术,以及cartographer的代码。希望能帮上和我一起想开始学习cartographer的小伙伴,如果有什么问题,可以随时想我提问,大家一起学习。

更新:注意:我之前安装了conda,conda里面的python版本是3.7的,我在安装cartographer_ros的时候没有关闭conda所以出现了错误,因为ros只能在python2.7版本下才能正常工作,所以我就conda deactivate base.这样就恢复到了原来的python2.7的版本。

参考文献如下

https://google-cartographer.readthedocs.io/en/latest/

https://blog.csdn.net/xmy306538517/article/details/81455625

https://www.cnblogs.com/hitcm/p/5939507.html

step1:安装一些依赖库 

# Install the required libraries that are available as debs.
sudo apt-get update
sudo apt-get install -y \clang \cmake \g++ \git \google-mock \libboost-all-dev \libcairo2-dev \libcurl4-openssl-dev \libeigen3-dev \libgflags-dev \libgoogle-glog-dev \liblua5.2-dev \libsuitesparse-dev \lsb-release \ninja-build \stow# Install Ceres Solver and Protocol Buffers support if available.
# No need to build it ourselves.
if [[ "$(lsb_release -sc)" = "focal" || "$(lsb_release -sc)" = "buster" ]]
thensudo apt-get install -y python3-sphinx libgmock-dev libceres-dev protobuf-compiler
elsesudo apt-get install -y python-sphinxif [[ "$(lsb_release -sc)" = "bionic" ]]thensudo apt-get install -y libceres-devfi
fi

 

step2: 安装abseil, 注意,在最后一步执行sudo stow absl之前要先执行sudo apt-get install stow安装stow

git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git checkout d902eb869bcfacc1bad14933ed9af4bed006d481
mkdir build
cd build
cmake -G Ninja \-DCMAKE_BUILD_TYPE=Release \-DCMAKE_POSITION_INDEPENDENT_CODE=ON \-DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \..
ninja
sudo ninja install
cd /usr/local/stow
sudo stow absl

step3: 这个下载链接是google的资源,如果你没有设置全局翻墙,在terminal不可翻墙,就不能下载成功,解决方法是在github里搜索ceres-solver,然后采用git clone的方式下载,如果在网页上直接Download下载下来的工程中灭有.git文件,无法完成git checkout tags/${VERSION}

VERSION="1.13.0"# Build and install Ceres.
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
git checkout tags/${VERSION}
mkdir build
cd build
cmake .. -G Ninja -DCXX11=ON
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install

step4: 安装protobuf.使用下面的下载链接下载时如果一直出现early EOF的超时错误时,就使用

git clone --depth=1 https://github.com/google/protobuf.git 进行下载,--depth=1是约束了只下载最新git log的版本。

VERSION="v3.4.1"# Build and install proto3.
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \-DCMAKE_POSITION_INDEPENDENT_CODE=ON \-DCMAKE_BUILD_TYPE=Release \-Dprotobuf_BUILD_TESTS=OFF \../cmake
ninja
sudo ninja install

step5: 安装cartographer

# Build and install Cartographer.git clone git@github.com:cartographer-project/cartographer.git
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install

step6:安装cartographer_ros

注意:创建ros工程的workspace时,根据你自己的路径来就可以,还有在将工程的devel中的setup.bash的路径写入到.bashrc中时也要注意你的路径。这样做的好处你,你新打开一个窗口进行操作时,不需要重新执行source YOUR_PATH/devel/setup.bash了就。

sudo apt-get install -y python-wstool python-rosdep ninja-buildmkdir -p /code/ROS/catkin_ws_cartographer/src
cd /code/ROS/catkin_ws_cartographer/src
git clone --recursive https://github.com/googlecartographer/cartographer_ros.gitcd /code/ROS/catkin_ws_cartographer
catkin_make_isolated --install --use-ninja -Dcartographer_DIR="/usr/local/share/cartographer/"
source /code/ROS/catkin_ws_cartographer/devel_isolated/setup.bash
echo "source /code/ROS/catkin_ws_cartographer/devel_isolated/setup.bash" >> ~/.bashrc

step7:下载数据集

2d数据集:

https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag

3d数据集:

https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-14-14-00.bag

step8: 运行程序

注意:修改成你自己的存放数据集的路径。

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

step9: 测试结果展示

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/252362.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

virtualbox中安装ubuntu

为什么80%的码农都做不了架构师?>>> virtualboxubuntu 安装virtualbox,当前版本是6.0.4下载ubuntu安装盘,建议lubuntu,链接是http://mirrors.ustc.edu.cn/ubuntu-cdimage/lubuntu/releases/18.04.2/release/lubuntu-1…

面向对象重写(override)与重载(overload)区别

一、重写(override) override是重写(覆盖)了一个方法,以实现不同的功能。一般是用于子类在继承父类时,重写(重新实现)父类中的方法。 重写(覆盖)的规则&#…

cartographer学习笔记--如何保存cartagrapher_ros建好的地图

今天开始跟着网友大佬学习cartographer. 1. 如何保存cartographer的地图数据 在运行cartographer过程中可以随时保存建好的地图,步骤如下: 首先是重新打开一个terminal, 如果你没有将你的cartographer_ros下的setup.bash文件写入到.bashrc中&#xff…

Java微信公众号开发(五)—— SVN版本控制工具

1 作用 两个疑问: 什么是版本控制?为什么要用版本控制工具?作用: 受保护受约束合作开发中,版本控制工具更重要的作用就是让开发者更好地协作,每个人的代码既能互相调用,来共同完成一个较大的功…

Linux之《荒岛余生》(二)CPU篇

为什么80%的码农都做不了架构师?>>> 温馨提示,动图已压缩,流量党放心查看。CPU方面内容不多,我们顺便学点命令。本篇是《荒岛余生》系列第二篇,垂直观测CPU。其余参见: Linux之《荒岛余生》&am…

PTA 06-图2 Saving James Bond - Easy Version (25分)

题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/672 5-10 Saving James Bond - Easy Version (25分) This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the worlds most famous spy, was captured by…

Ubuntu16.04上安装kitti2bag

kitti2bag是一个可以将kitti数据集转换为bag文件的工具,可以直接通过pip进行安装。由于kitti2bag中使用到ros,所以安装时你使用的python版本应该是2.7的因为ros只有在Python2.7时才能正常工作。比如说我,我安装了conda,在conda中安…

Nginx之windows下搭建

去nginx.org下载nginx 以nginx-1.8.1为例解压到D盘nginx-1.8.1目录 假设NGINX_HOME为D:\nginx-1.8.1 3种启动途径: 一、双击nginx.exe图标,可见黑窗口一闪而过,启动完毕。 二、命令行到nginx目录,输入nginx启动。(注&a…

单片机错误笔记

记录下使用单片机过程中的一些错误,便于以后查询: 单片机型号:STC15F2K60S2 晶振:18.432 报错代码: *** WARNING L1: UNRESOLVED EXTERNAL SYMBOLSYMBOL: REC_DAT1MODULE: .\Objects\usart.obj (USART) …

软件开发记录03

今天我完成了软件设置&#xff0c;预算列表&#xff0c;添加预算的页面布局。 &#xff08;1&#xff09;软件设置 <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"…

395. Longest Substring with At Least K Repeating Characters

题目要求 Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.Example 1:Input: s "aaabb", k 3Output: 3The longest substring is "aaa&qu…

UICollectionView 具体解说学习

UICollectionView 和UITableView非常像,是APPLE公司在iOS 6后推出的用于处理图片这类UITableView 布局困难的控件,和UITableView 一样,它也有自己的Datasource和delegate。以下具体说下像这种方式的效果. 首先来看看UICollectionView 的DataSource。protocol UICollectionView…

70.文件异常

ferror检测文件异常perror提示文件错误信息clearerr清除异常,让文件指针回到开头完整代码 1 #define _CRT_SECURE_NO_WARNINGS2 #include<stdio.h>3 #include<stdlib.h>4 //perror提示文件错误信息5 //ferror检测文件异常6 //clearerr清除异常,让文件指针回到开头…

ServiceNow 中关于UI Action 在portal端的使用

在 portal端是可以使用Form和UI Action的&#xff0c;例如&#xff1a;var data.f $sp.getForm()&#xff1b;//需要添加上相应参数在开箱组件Form的Server script中就有如下代码&#xff1a;data.f $sp.getForm(data.table, data.sys_id, data.query, data.view);data.f对象中…

特殊密码锁

总时间限制: 1000ms内存限制: 1024kB描述有一种特殊的二进制密码锁&#xff0c;由n个相连的按钮组成&#xff08;n<30&#xff09;&#xff0c;按钮有凹/凸两种状态&#xff0c;用手按按钮会改变其状态。 然而让人头疼的是&#xff0c;当你按一个按钮时&#xff0c;跟它相邻…

系统安全题目(二)

1、在 php mysql apache 架构的web服务中输入GET参数 index.php?a1&a2&a3 服务器端脚本 index.php 中$GET[a] 的值是&#xff1f;正确答案: C A 1B 2C 3D 1,2,3 2、以下哪些不是CSRF漏洞的防御方案&#xff1f;正确答案: D A 检测HTTPrefererB 使用随机tokenC 使用验…

转发和重定向的区别?

实际发生位置不同&#xff0c;地址栏不同 转发是发生在服务器的 转发是由服务器进行跳转的&#xff0c;细心的朋友会发现&#xff0c;在转发的时候&#xff0c;浏览器的地址栏是没有发生变化的&#xff0c;在我访问Servlet111的时候&#xff0c;即使跳转到了Servlet222的页面&a…

BZOJ3795 : 魏总刷DP

对于HARD&#xff1a; 需要满足$ku[i]\times k\leq Tlate[i]$。 对于EASY&#xff1a; 需要满足$ku[i]\times k\leq T-rest[i]$。 故对于HARD&#xff0c;设$a[i]-late[i]$&#xff0c;对于EASY&#xff0c;设$a[i]rest[i]$&#xff0c;并将所有题目的$u[i]$都$1$。 那么需要满…

信息学竞赛相关优秀文章合集[持续更新]

线段树详解 &#xff08;原理&#xff0c;实现与应用&#xff09;可持久化线段树 简介 运用伸展树解决数列维护问题.pdfSplay 学习笔记&#xff08;一&#xff09;Splay 学习笔记&#xff08;二&#xff09;Splay 学习笔记&#xff08;三&#xff09; 请要相信我&#xff0c;30…

ceres-solver学习笔记

前一段时间总有一个想法&#xff0c;那就是&#xff0c;我只直到视觉slam是远远不够的&#xff0c;激光slam仍然是一个比较稳妥的技术&#xff0c;好落地&#xff0c;应用广泛&#xff0c;我想着&#xff0c;如果我学会了会大大增加自己的核心竞争力&#xff0c;所以我抽时间开…