ROS noetic 安装编译Cartographer踩坑记录

简介: ROS noetic 安装编译Cartographer踩坑记录

ROS noetic 安装编译Cartographer踩坑记录

安装编译工具

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build

首先来说,python-rosdep已经被废弃了

2018122814580746.png

sudo apt-get install python3-rosdep

不过注意,noetic和python3-rosdep有冲突,所以,你在安装中有可能碰到把ros部分组建给卸掉的情况,这时你只能重装(挺快的)

sudo apt install ros-noetic-desktop-full

创建工作空间

mkdir -p ~/ROS_WS/cartographer
cd ~/ROS_WS/cartographer

用wstool拉源码

wstool init src
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall

编辑src目录下的.rosinstall

#鉴于github源码在国内访问较慢,可以使用国内码云仓库,在我的仓库中已经设置为公有
vim ./src/.rosinstall

将文件修改为如下内容:

- git:
    local-name: cartographer
    uri: https://gitee.com/moresweet/cartographer.git
    version: master
- git:
    local-name: cartographer_ros
    uri: https://gitee.com/moresweet/cartographer_ros.git
    version: master
- git:
    local-name: ceress-solver
    uri: https://gitee.com/moresweet/ceres-solver.git

2018122814580746.png

成功后会拉下来三套源码

2018122814580746.png

编译安装

rosdep update
rosdep install ——from-paths src ——ignore-src ——rosdistro=${ROS_DISTRO} -y

可能会出现问题

若rosdep update很慢报错,请参照

https://blog.csdn.net/leida_wt/article/details/115120940?spm=1001.2014.3001.5506

第二条可能会报错

ERROR: Rosdep cannot find all required resources to answer your query
Missing resource ——from-paths
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/opt/ros/noetic/share

这明显是–from-path参数不认识,猜测是python3-rosdep2有了变动,操作不一样了,并且报错是环境变量中的路径找不到,那么直接catkin_make(不需要编译成功,目的是出现devel目录,将此目录环境导入PATH中,当然也可以选择直接更改环境变量的方式)

catkin_make #不管成功与否,只是为了生成devel目录
source devel/setup.bash #这样本功能包的目录就在终端环境中了

此时再执行rosdep install ——from-paths src ——ignore-src ——rosdistro=${ROS_DISTRO} -y会发现

ERROR: Rosdep cannot find all required resources to answer your query
Missing resource ——from-paths
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/moresweet/ROS_WS/cartograher/src
ROS path [2]=/opt/ros/noetic/share

多了一行

2018122814580746.png

我们直接用rosdep在src中安装就可以了

cd src
rosdep install cartographer

一步一步的按y点回车就好了

安装cartographer的依赖(记住这个地方,后面编译出错,可以会来看看是不是确实的东西,这里有,有就装上)

cd cartographer/scripts/
vim install_proto3.sh  
#修改github项目地址为https://gitee.com/shenyinsong_admin/protobuf.git
vim install_abseil.sh
#修改github项目地址为https://gitee.com/moresweet/abseil-cpp.git
./install_proto3.sh
./install_abseil.sh

然后回到工作空间,用ninja编译

cd ~/ROS_WS/cartographer
catkin_make_isolated ——install ——use-ninja

如果报错

- Found GMock: gmock_main;-lpthread
CMake Error at CMakeLists.txt:32 (find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.

请确定安装cartographer的依赖那一步install_abseil.sh是否成功安装。

测试运行

下载测试数据集

cd ~
wget https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/cartographer_paper_deutsches_museum.bag

2018122814580746.png

至此,安装成功

相关实践学习
Docker镜像管理快速入门
本教程将介绍如何使用Docker构建镜像,并通过阿里云镜像服务分发到ECS服务器,运行该镜像。
阿里云资源编排ROS使用教程
资源编排(Resource Orchestration)是一种简单易用的云计算资源管理和自动化运维服务。用户通过模板描述多个云计算资源的依赖关系、配置等,并自动完成所有资源的创建和配置,以达到自动化部署、运维等目的。编排模板同时也是一种标准化的资源和应用交付方式,并且可以随时编辑修改,使基础设施即代码(Infrastructure as Code)成为可能。 产品详情:https://www.aliyun.com/product/ros/
相关文章
|
8月前
|
Ubuntu Java Python
ROS2通讯中间件安装与使用
本文记录主要ROS2的安装、如何JAVA和PYTHON对ROS2消息的订阅和发布。
|
9月前
|
Python
Ubuntu18.04 ROS Melodic安装和卸载
Ubuntu18.04 ROS Melodic安装和卸载简单过程
185 0
|
1天前
[ROS2] --- ROS2安装
[ROS2] --- ROS2安装
62 0
|
1天前
|
Ubuntu
ubuntu20.04 ros-noetic 安装
ubuntu20.04 ros-noetic 安装
78 0
|
8月前
ROS创建工作空间添加包并编译
ROS创建工作空间添加包并编译
95 0
|
8月前
|
Ubuntu 索引
Ubuntu 安装 ROS 详细教程(以最后一个ROS1版本Noetic为例)
Ubuntu 安装 ROS 详细教程(以最后一个ROS1版本Noetic为例)
518 0
|
9月前
|
C语言 C++ Python
【ROS 开发神器 Visual Studio Code 的安装和设置】
【ROS 开发神器 Visual Studio Code 的安装和设置】
358 0
【ROS 开发神器 Visual Studio Code 的安装和设置】
|
9月前
|
Ubuntu
问题解决:Ubuntu安装ROS依赖出现ERROR: the following packages/stacks could not have their rosdep keys resolvedt
问题解决:Ubuntu安装ROS依赖出现ERROR: the following packages/stacks could not have their rosdep keys resolvedt
788 0
|
9月前
|
机器学习/深度学习 机器人 决策智能
ubuntu16.04 kinetic 版本ROS安装PR2
ubuntu16.04 kinetic 版本ROS安装PR2
|
9月前
|
机器学习/深度学习 Ubuntu 决策智能
ubuntu16.04 下ROS操作系统学习笔记(一)ROS-kinetic安装
ubuntu16.04 下ROS操作系统学习笔记(一)ROS-kinetic安装

推荐镜像

更多